Summarized using AI

Hanami - New Ruby Web Framework

Anton Davydov • June 23, 2017 • Singapore • Talk

In this presentation at the Red Dot Ruby Conference 2017, Anton Davydov introduces Hanami, a new Ruby web framework that emphasizes modularity, simplicity, and lightweight design. Anton explains that Hanami, developed by Italian engineer Luca, offers a fresh perspective on building web applications by focusing on separation of concerns and providing the developer with more freedom and choices compared to conventional frameworks like Rails. Key points discussed include:

  • Modularity: Hanami allows developers to swap out components easily and offers a clear structure for organizing code into small, manageable pieces.
  • Simplicity and Lightweight: The framework is designed to help developers start building production applications more quickly, promoting a straightforward approach.
  • Business Logic Separation: It emphasizes separating business logic from data flow, making it easier to manage and scale applications.
  • Testing and Dependency Injection: Hanami encourages best practices like dependency injection and provides a more tangible approach to testing, reducing reliance on monkey-patching.
  • Comparison with Other Frameworks: Anton discusses the differences between Hanami and popular frameworks like Rails and Sinatra, emphasizing the strengths and weaknesses of each. He argues that Hanami's structure is better suited for modern web applications due to its clean design and focus on modularity.
  • Current Limitations: Despite the advantages, Anton acknowledges Hanami's youth and the challenges it faces, such as limited documentation and fewer available gems compared to more established frameworks.

In conclusion, Anton advocates for exploring Hanami for developers looking for a flexible, modern solution that can cater to their specific needs in web development, promising its growth and the ongoing development of the ecosystem surrounding it.

Hanami - New Ruby Web Framework
Anton Davydov • June 23, 2017 • Singapore • Talk

Speaker: Anton Davydov, Indie OSS Developer

Hanami is quite new and interesting framework which you are unlikely to write complex applications. But this does not mean that this framework is not worth your attention. Besides old approaches, you can also find new interesting solutions. In my presentation, I'm going to talk about Hanami framework and why you should look on this. We give consideration about advantages and disadvantages. And also I talk about future with Hanami.

Speaker's Bio

Anton is an indie developer from Russia. He works on some side projects and builds Space-Rocket ships at night. Also, he loves open source, cats and collecting stereotypes.

Event Page: http://www.reddotrubyconf.com/

Produced by Engineers.SG

Help us caption & translate this video!

http://amara.org/v/8HYG/

Red Dot Ruby Conference 2017

00:00:04.390 hello Singapore I'm happy to see all you
00:00:08.200 and it's my second time in Singapore and
00:00:11.230 rubyconf and because today we have after
00:00:14.890 party I need to say some small thing
00:00:17.320 about Singapore do you need or do you
00:00:20.320 know what Neverland is defined it's a
00:00:23.980 monumental the center of CG it's a big
00:00:26.589 monument with are its lair and fish but
00:00:32.890 in Singapore this means something else
00:00:40.559 so my name is Anton you can find some
00:00:44.350 links here and I'm a software engineer
00:00:46.719 from Russia
00:00:48.010 two days ago I said ten hours to gxy
00:00:51.969 from Moscow to Singapore it was fun and
00:00:57.160 just to think what you need to know
00:01:00.129 about me
00:01:01.239 first I read a lot of stickers and
00:01:03.180 second I really love I'm sorry a little
00:01:06.430 of open-source and maybe that's why I'm
00:01:09.130 canonical and mica needs and Ludacris
00:01:11.980 you can find in some projects like Ruby
00:01:15.250 rails dry roam and crystal and also I am
00:01:19.300 creator of one small community in Moscow
00:01:23.320 it's muscular beam and we have metals
00:01:25.990 and crafts and something else but today
00:01:28.630 we'll talk about Konami are in Japanese
00:01:30.850 language you can find definition of
00:01:33.280 Konami and usually it's a process when
00:01:37.240 you watching are watching the flower
00:01:40.780 bloom I have a special illustration for
00:01:44.230 this process but of course today we'll
00:01:46.780 talk about Ruby and framework is called
00:01:49.030 hanami tool and this framework was was
00:01:56.380 created by developer from Italy his name
00:01:59.830 is Luca and he has a birthday today so
00:02:04.240 this the first comment was created three
00:02:07.150 and half years ago and as you can see
00:02:10.119 her name is really young framework also
00:02:13.660 so we have a person in core team
00:02:16.720 Murray on was speak out for one hour
00:02:20.320 though maybe more and let's talk about
00:02:24.790 general ideas the first idea is
00:02:31.080 modularity
00:02:32.550 it means two things in konami first you
00:02:36.310 can change any part of konami to other
00:02:38.290 part for example you can drop your OEM
00:02:40.480 and use active record for example i
00:02:43.180 don't know why but you can and second
00:02:46.780 part is a really simple way to separate
00:02:49.810 your logic to small modular models and
00:02:53.340 second thing is simplicity and
00:02:56.380 lightweight I think the simple tool is
00:03:00.300 provide your ability to start working on
00:03:03.190 production application of production
00:03:05.260 projects faster and I think that
00:03:08.290 framework is just a tool don't make a
00:03:10.870 good of it next idea is a critic to the
00:03:14.560 sound if you are going to use Konami you
00:03:19.270 gain more freedom it means that you
00:03:22.870 don't mean to think how you can mix in
00:03:25.420 your application and say more
00:03:27.640 conventional and you can just use both
00:03:30.940 and all the good are also next idea is
00:03:34.959 pull objects and there are
00:03:36.459 monkey-patching
00:03:37.740 why is there a monkey passion is so
00:03:40.450 important or for this I have a special
00:03:42.850 quiz for you I just try to answer its
00:03:46.920 rails method or rubia what so who thinks
00:03:51.850 that it's really that ok are who think
00:03:57.880 that it's Ruby method oh okay it's a
00:04:03.520 real method and last part is last main
00:04:08.350 ideas from voltage thread-safe
00:04:10.120 it's really important because we don't
00:04:15.310 worry about parallel computing and
00:04:17.760 please remember if you want to remember
00:04:21.489 only one thing from my talk just
00:04:25.050 I think it's a really important are
00:04:27.750 random it's not rails it's important
00:04:32.669 silly and where else is not Konami it's
00:04:36.479 two different web framework and
00:04:39.419 compassion is the released stupid idea
00:04:41.460 but of course we'll compare this
00:04:43.080 framework later so let's talk about
00:04:47.490 typical web project you can see any web
00:04:52.080 project and you will see two different
00:04:54.180 parts just path is the business logic
00:04:58.199 and second it's a data flow and let's
00:05:02.759 talk about data flow so what I mean what
00:05:06.900 I mean on the data flow chart usually
00:05:09.719 it's something which take your request
00:05:12.650 do something what you don't know and
00:05:15.479 after that response is request and and I
00:05:20.190 may have a specialist it actually it's a
00:05:22.590 continuous each actually and what's mean
00:05:25.050 for you as you develop for developer
00:05:28.009 it's we have only one we have one folder
00:05:31.979 and it's a Applications folder and in
00:05:35.400 this folder you can see you can see are
00:05:39.020 some applications or small application
00:05:42.029 and in each application for example on
00:05:44.729 this slide is admittedly keishon you can
00:05:47.759 see our controllers view objects routing
00:05:51.150 and some assets into place in one place
00:05:53.729 and also if you look on web application
00:05:57.060 in this example you'll see something
00:05:58.620 like in administration and why it's so
00:06:02.039 important and cool so the first idea why
00:06:07.289 school is for example you have a very
00:06:09.960 different instance of your application
00:06:11.669 with three different placated three
00:06:14.940 instance of your project with three
00:06:17.699 instance of these three parts of these
00:06:21.180 three applications in each instance and
00:06:23.419 with this architecture you can in future
00:06:29.759 you can start your sharer only with one
00:06:32.940 application for example ah for example
00:06:35.969 you can start your server only with
00:06:38.700 in application or maybe only with web or
00:06:41.220 IP I application and why it's important
00:06:43.950 for example you want to protect
00:06:45.920 admission in private network and now and
00:06:51.150 in next version of Konami
00:06:52.860 you can just start terror on the visa
00:06:55.500 unification we want ends at all so let's
00:07:01.080 talk a bit about business logic all
00:07:03.870 business logic you can find in foreign
00:07:06.300 soldier library library and usually here
00:07:10.770 you can see module in Konami we use
00:07:14.400 repository pattern we will talk about it
00:07:17.430 later
00:07:17.940 also you can find some interactors
00:07:21.410 measures and what you want to see so I
00:07:26.130 chose that Konami is a model web
00:07:28.860 framework and this framework consists of
00:07:31.320 ten different gems the first five is
00:07:36.650 Konami the base repository of this
00:07:39.870 common line interface and usually when
00:07:42.030 you put in your console Konami new
00:07:43.890 project name works this gem Genesis
00:07:49.410 router controller chills model and the
00:07:54.590 validations helper view a certain
00:07:57.030 measure and I know that all this
00:08:01.260 geological stuff is looked difficult as
00:08:04.500 well let's talk about difference between
00:08:06.870 Konami and other frameworks and such my
00:08:10.560 example is reka plication typical direct
00:08:14.100 application consists of one class with
00:08:16.200 one a public method usually it's called
00:08:19.620 method you and this method take
00:08:22.910 environment and you need to return array
00:08:26.580 of three elements its status
00:08:29.130 environments and somebody in array and
00:08:33.000 what we can see in hanami ax in this
00:08:36.000 example I use Konami router it's a
00:08:38.479 replication and we can mount this
00:08:40.979 replication into our router and it will
00:08:44.220 be work let's talk about Sinatra in
00:08:48.990 Sinatra we have one class we
00:08:51.170 the one class methods which take bath
00:08:54.680 and body and result in Kaname we can
00:09:00.250 define block for our rotor and mop
00:09:03.200 something to rotor and it's logical to
00:09:06.829 compare rail section and Kaname action I
00:09:09.110 have a really nice example of typical
00:09:11.000 rail the rail section it look like this
00:09:13.579 I am just kidding
00:09:15.920 relax so I told that compare of relson
00:09:21.620 Kaname is really stupid idea it's
00:09:23.389 different frameworks and all those
00:09:26.300 frameworks use MVC pattern and that's
00:09:29.060 why I think it will be good to check
00:09:32.980 every part of MVC
00:09:34.910 and display and show how it's realized
00:09:38.029 how it makes in rails and Kaname and
00:09:40.690 this starts with controllers just a
00:09:46.220 second in rails we have one class with
00:09:52.750 some methods and each method in this
00:09:55.880 class it's action you can call this
00:09:58.640 method in any name you can use anything
00:10:01.820 and what you want in of course you can
00:10:09.860 use the H style for this H style for
00:10:15.380 your controllers it will be only rest
00:10:18.500 actions and but in Kaname we have little
00:10:24.620 bit as a trajectory we have only one
00:10:30.050 class and each class is action
00:10:34.579 it means if you have controller with
00:10:37.250 five and points it will generate one
00:10:40.040 model and five classes and you can see
00:10:44.390 that this class have only one public
00:10:47.149 method it's called method and it look
00:10:50.750 like a service object functional object
00:10:52.850 what you want and also it's really
00:10:56.060 important and super cool you can
00:10:58.579 validate your parameters in action and
00:11:02.870 it's separate logic for all your actions
00:11:06.580 let's talk about models typical rails
00:11:10.670 model it's a one class and in this class
00:11:15.380 you can find some includes from I don't
00:11:21.110 know for example is grab a stick also
00:11:27.020 this class has called AK and data logic
00:11:29.410 also this class have data based logic
00:11:31.910 and associations and after all these
00:11:35.900 this class care validations and I have
00:11:38.540 only one question it's is it normal that
00:11:41.450 one class I know about four or five
00:11:45.380 different things I think no and in
00:11:49.430 Konami Konami based on Rome Rome its
00:11:52.910 Ruby object matter it's a really nice
00:11:56.360 project and as I told Konami our
00:12:00.680 provides depository button this portion
00:12:03.710 consists of two different things
00:12:05.320 such things is entity and entity is a
00:12:09.640 usual data object it's immature
00:12:12.490 immutable data object like liters or dry
00:12:16.100 types or what you want and you can
00:12:21.190 initialize your object or with some
00:12:25.100 attributes you can get this attributes
00:12:27.590 well your but you can assign some new
00:12:30.950 value to distribute and position it to
00:12:34.660 initialize new object with new
00:12:37.160 attributes and the second part is
00:12:39.620 repository depository it's a one class
00:12:42.800 which know all about your database in my
00:12:47.540 case you can see that position know
00:12:50.360 about the stations and also in instance
00:12:53.900 methods you can see the title Rome
00:12:56.390 relation and work with Israel or America
00:12:58.760 relation and usage of dishes look like
00:13:03.860 this it's you need to analyze initialize
00:13:09.070 relate a repository object and
00:13:11.420 afterwards call some method foolish
00:13:15.290 so if you if you talk about view and we
00:13:18.290 also have our view folder and I don't
00:13:21.350 know why but we have templates in this
00:13:24.050 folder and rail shelters are someone has
00:13:27.650 a problem with rails helpers well in
00:13:34.670 Konami we have a little bit different
00:13:37.670 way we have a view objects it's just
00:13:41.270 glass for each v8 for each template and
00:13:46.070 also we have templates and in this tin
00:13:48.260 place you can use you can call our view
00:13:50.900 logic and some that from your actions
00:13:56.380 unfortunately I don't like this part of
00:13:58.640 my talk that's why I leave it as a
00:14:01.760 liquid for independent view but in any
00:14:05.900 project you can use webpack so let's
00:14:08.900 talk about proxy pros and cons so first
00:14:13.640 process no magic it's not about it's not
00:14:19.130 only about monkey-patching it's about
00:14:22.010 testing for example and in this example
00:14:24.710 you can see typical enemy action it's
00:14:27.710 just across remembers and if you want to
00:14:31.040 tell this class you need to write this
00:14:34.160 test and the salt in this test you need
00:14:36.950 to you know as here in action instance
00:14:40.640 and after that you need to call this
00:14:43.190 method method called with params in my
00:14:46.340 case is just has and this action will
00:14:50.210 return our array of three different
00:14:52.250 elements first element is status second
00:14:55.280 is environment variables and lost its
00:14:58.070 body and after that you can check it
00:15:00.260 like like poor Ruby object so I told
00:15:06.020 about monkey by junk and I think it's a
00:15:08.000 big problem because because I really
00:15:11.450 often see is the smaller questions on
00:15:13.910 Stack Overflow in this question one guy
00:15:16.730 to one person asked how he can call
00:15:21.190 method weeks from integer in Sinatra
00:15:25.550 application
00:15:28.280 I think is why I think it's so important
00:15:31.070 to see the difference between language
00:15:33.890 and framework next pros it's a best
00:15:40.100 practice and I think enemy are it great
00:15:44.660 tool because they teach developers to
00:15:47.420 dependency injection you can open
00:15:49.790 dynamic guides and you'll see that in
00:15:53.120 one big batch of actions part about
00:15:57.410 dependency injection injection so why
00:15:59.480 it's so cool and how we can test some
00:16:02.320 actions without mocking and stubbing
00:16:07.600 Konami teach developers to lobby
00:16:10.010 separation in this case you can use you
00:16:15.140 can use interactors for this you start
00:16:18.950 thinking about where I need to put the
00:16:21.080 logic in action in model in entity or
00:16:24.980 maybe in repository and also committed
00:16:28.130 our developer how to DVD and this
00:16:32.960 framework use testers principles and I
00:16:37.120 displayed one example how to test how to
00:16:41.420 test action in the right way and if you
00:16:45.230 open a getting started guide in Konami
00:16:48.410 our first code will you see it will be a
00:16:51.260 test code but I'm sorry I forgot the TDD
00:16:56.240 is did is that and let's talk about cons
00:17:00.350 and the first glance is TDD it's not a
00:17:04.070 problem of Konami or rails or something
00:17:06.470 else it's a problem of TDD and this DVD
00:17:09.680 you need to cover your test by some
00:17:13.040 strange and not important method like
00:17:17.050 method form in your view object are
00:17:21.800 other cons it's good but not great
00:17:25.160 documentation it's a really young
00:17:27.080 framework and we have very nice
00:17:30.290 documentation but if you try to do
00:17:33.140 something super custom you will get here
00:17:36.200 and usually
00:17:39.560 hard to find some documentation for
00:17:42.140 hanami if we look something I don't know
00:17:44.900 during 15 tables with some something
00:17:47.780 else something else something else in
00:17:49.910 rails we have other other situations we
00:17:53.900 have many blog post documentation about
00:17:56.390 it and other cons is missing gems gems
00:18:00.380 I just think Ralph is 10 years old 10
00:18:03.800 years old framework a Sinatra is 8 years
00:18:06.530 old and I had this doubt 1 year ago a
00:18:11.540 year ago and when I prepared to this
00:18:15.440 talk today I saw one interesting one is
00:18:19.940 an interesting thing on previous year
00:18:24.200 with all this stuff we had a problem but
00:18:27.920 today we have problem only with one part
00:18:30.530 it's something like device but in next
00:18:34.250 anime release in 1.1 I will fix this
00:18:38.090 problem because this problem of
00:18:39.500 command-line interface and it's not
00:18:42.170 super important but anyway if you want
00:18:44.750 to if you want to add something special
00:18:48.590 for hanami you can do it myself and give
00:18:52.100 this so I told about some gems and
00:18:58.430 solutions all we have are awesome list
00:19:01.760 on this link you can find information
00:19:04.850 about some gems some integration this
00:19:08.690 psychic for example or something else
00:19:10.400 and useful and helpful blog post and if
00:19:15.830 you have if you have a free time and you
00:19:19.430 want to play with real production
00:19:22.640 applications or regional Konami I have
00:19:25.550 some open source projects which I use
00:19:29.500 every day maybe every week the first
00:19:32.540 project is my project it's a simple way
00:19:35.240 to find in here started to procedures
00:19:37.490 it's written on Konami is full open
00:19:40.250 source you can send the pull request if
00:19:41.840 you want and second project is Konami
00:19:44.780 contributors it's like Rails
00:19:46.460 contributors but regional Konami and
00:19:51.530 some contacts on this page you can find
00:19:53.630 our site on the sides you can find many
00:19:56.780 useful information also we have a chat
00:20:00.410 or where you can ask anything every time
00:20:03.020 and we have fallen for some feature
00:20:05.450 requests and salsa and this is all and
00:20:08.960 thank you any questions as the man said
00:20:17.780 any questions other hands being rid of a
00:20:25.040 missing something any questions at all
00:20:28.990 yeah so thank you guys I'll come so I
00:20:34.880 think you mentioned that there is no
00:20:37.460 monkey patch how to enforce that in my
00:20:40.850 project if we use special models and it
00:20:43.340 look like Konami which is string and in
00:20:47.450 this thing we use all methods which we
00:20:49.430 need okay
00:20:50.840 and of course you can use it in your
00:20:54.590 application any more questions
00:21:05.419 and so I was following these the
00:21:09.900 development of hanami and the dryer B
00:21:11.970 stack and I know that at some point
00:21:14.669 hanami I do not do that on its own
00:21:16.830 validations module and instead of using
00:21:18.630 the dry validations I wonder if you're
00:21:20.669 planning managing or do you think that
00:21:22.470 these are these two stacks will be just
00:21:24.630 developed in parallel from now on so you
00:21:28.710 can only use devastation for and you can
00:21:32.220 use all features of draw validation like
00:21:36.450 sharing your scheme and such etc and
00:21:40.040 about the second question it was about
00:21:42.720 so I'm wondering if you're going to if
00:21:45.059 hanami is going to merge to to build its
00:21:48.090 features on top of dry RB in more cases
00:21:50.669 if you're planning to I don't know dude
00:21:52.169 use it for a business logic or for
00:21:54.330 containers or monads I'm asking about
00:21:57.960 the development part of the hanami what
00:21:59.790 if it's in the roadmap if you're
00:22:01.710 planning to make these two stacks at
00:22:05.480 first with overuse driver and we need it
00:22:09.140 and you can use dry stack and you can I
00:22:13.830 map location it's usually you can use
00:22:15.570 transactions and what you want but in
00:22:17.549 hanami I don't know we have a features
00:22:19.890 and problems but when we don't have
00:22:22.020 something like oh we need to use dried
00:22:25.020 transactions we really need it we need
00:22:27.090 to find some problem to fix it with dry
00:22:29.340 transaction
00:22:30.120 now we don't have okay sorry for someone
00:22:39.390 speaking
00:22:48.590 okay with a question from the back
00:22:51.620 unveils we database table magazine right
00:22:56.610 what types are record equally village in
00:22:58.710 the nativist schema so is there any
00:23:02.010 future like DB migration I'm sorry I
00:23:06.210 don't hear you oh yeah we have deep
00:23:09.660 immigration from my sequel of by Jeremy
00:23:13.130 you can use it now and it will work now
00:23:16.170 and I think in future guys from our own
00:23:19.710 want to create super immigrations stuff
00:23:22.710 and I think in future we'll use this
00:23:25.020 stuff a kind of sicko all right okay we
00:23:32.130 want the back and my friend will run to
00:23:35.910 him instead of me
00:23:36.570 oh I forgot to say I have a sticker so
00:23:41.850 any over $1 there's enough what inspire
00:23:45.060 you to do to Hannum whatever what do you
00:23:48.510 want buy it you to do that symbol or
00:23:51.090 five team to do that framework I'm sorry
00:23:54.300 I think it's like why hanami and what
00:23:57.660 was the inspiration for it for me for
00:24:01.980 the hanami project so if you want you
00:24:05.880 can find a blog post from Luca it's four
00:24:09.990 years old blog post if I remember right
00:24:11.940 and he had some troubles with rails
00:24:15.210 because he tried to fix some stuff which
00:24:20.600 he tried to fix some architectural stuff
00:24:24.620 else and he had a big problem because
00:24:27.570 conventional phrase very important think
00:24:31.890 of rails and that's why he understands
00:24:34.770 that okay I'll write myself work with
00:24:37.560 something
00:24:41.360 okay yes anyone else
00:24:50.070 all right let's give it up for Anton
00:24:54.330 thank you
Explore all talks recorded at Red Dot Ruby Conference 2017
+12