The one with the frameworks

I was thinking a lot about frameworks in general lately. Framework is this set of tools, that helps programmer to just focus on business logic instead of language. What is the difference between framework and library then? I heard on one polish podcast (listen) a nice quote that I’ll paraphrase – “Framework is what calls you, You are the one, who calls a library”. Given this definition one can conclude that often you have to give up your flexibility to speed up programming your application when you choose to pick up framework. There are people much smarter than me, that are arguing about when to use frameworks so I want to focus on the other problem – junior level one. From beginners perspective, when you are learning a programming language it’s really hard to tell when you should start to learn a framework.

Let me give you an example from my recent experience.

Because of one microservice that I had to add functionality into, I had to dive into Ruby language, because it was written in Ruby on Rails (RoR) framework. With only a glimpse of knowledge about the language itself and no prior experience with RoR I had to use websockets (that I knew nothing about) for my feature, so three solutions came to my mind:

– find websockets gem with good documentation and just use it at the same time making my already huge application even bigger

– create websocket functionality with vanilla ruby. To do it I would need to be reeeaaally comfortable with Ruby language (minuses: it will take a long time to make it work and I would go against the rule to not reinvent the wheel)

– use a tool that is inside the framework that the application is already in (Active Cable).

I was asking myself questions. How to dive into it? Should I start with basics of language just to know what I’m looking at and to see the difference between language and its framework, or should I just pick up RoR first and guess language syntax from the usage?

The best approach for me was to just do what you have to do to achieve a goal in a fastest possible way. I researched and planned what I need to code, to make it work, so rather than doing language tutorial or going through full documentation on framework, I just googled how others implemented what I’m trying to do in ruby. Most people used Active Cable, so why I shouldn’t? But hey – It’s not that I didn’t have to learn vanilla Ruby at all, while going through all those framework built-in methods.

I found out that diving into a language with a framework from day one has one big merit – you will do a lot of things the way it is done in commercial projects and as a side effect you will slowly gain confidence in language you’re using, because after all you need to fill the framework with business logic to make application whole.


Leave a Reply

Your email address will not be published. Required fields are marked *