Choosing a framework and a language

Torsten Ruger
rubydesign_web
Published in
8 min readAug 12, 2017

The first question i often get is: what language should i learn. This is not quite the right question, and it really takes all of those articles i’ve written to begin to examine the real question here.

The very first question is really if you want to do the client server model that i described here, or client side app that i talked about last. Or something completely different like big-data. As i said, i don’t think client side apps are for beginners, not only because they are marginal (even if that margin is on the rise), but because they are more complicated and you should start with the basics, aka learn to walk before you run.

The next things that beginners often don’t understand, is how software development is a joint effort, especially with open source. A developers work is much more assembling than creating. Like a builder, using bought materials, it about glueing those parts together. Nine times out of ten, when faced with a problem, a developer will use an existing solution and integrate that into his application.

What is a Framework

As building web apps is a relatively old problem, many ready solution exist to start you off, and unless you have compelling reason not to, you will use those, off course. Those solutions are called frameworks, as they give you a “frame” to work in.

Frameworks are different from libraries: A library is a piece of software that you can use, like you would use a any tool. Meaning you are in charge of how you use the tool, and can choose to use the tool in any way you wish. You could think of it as mountain bike ride through the woods, choosing your pace and direction as you feel like. In this analogy, a framework is more like driving a car. Mostly you can only go straight, though sometimes there are junctions where you can make choices. But you go fast, as the road is paved and you have a big engine.

The “engine” in the framework is usually quite a bit of code that solves the problem in a specific way. You loose some freedom, but gain a whole lot of speed. And believe me, there are a whole bunch of standard problems to be solved in getting a web application to work, that you really don’t care about. Like the details of how http is really implemented, or the differences between different databases.

How to choose a framework

So what we want is a framework, but how do we go about choosing one? Especially as a beginner, meaning without experience, you can only really read what people say about them and try and get the one that fits your priorities. Or you can be like most developers and just take the one you like and then, also like most developers, bend the argument to suit the result. Here are some good arguments for the one i am going to choose / have chosen.

The framework should allow us to develop quickly. Really our highest priority should be developer happiness, as a happy (or content) developer is a productive one. This is a win win situation, as it is good for the developer (obviously), but also the business, as things get done faster. Usually we have to choose whether we value developer speed, or program speed, but machines are cheap, and developers are not, so it’s not a difficult choice.

If the framework has been around for a while, is mature, that usually comes with many benefits. A large and lively community for example. Which in turn brings many ready made solutions with it (remember the assembly model). But maybe most importantly, the experiments of the youth have lead to good and stable solutions. And those solutions are well documented, both online and in books / courses.

A framework should be complete, meaning that it should allow us to solve all the common cases in an easy way. In other words it should not be so small that it’s limitations will become obvious in even a medium sized project. Small may be nice for learning quickly, but in this case is not what we are looking for. Also, while we want the framework to make the common task easy, we do not want it to lock us in. This property is called being extensible, and most frameworks are, really, so it’s not a separate point.

It should be easy to learn, which is only possible if it’s easy to use and built on solid principles. Also it will need to be mature to have the documentation and tutorials in place. But mainly this is about best practises, and also concerns the language which the framework is built in.

And the winner is… Ruby on Rails, or just rails. Surprisingly for exactly the reasons that i mentioned above :-) Rails is the most mature framework that has brought together all best practises that the industry uses. How good it is is shown by how many other frameworks have copied it’s concepts and that no-one has come up with a better way in 10 years. Rails is built in the ruby programming language, which is very clear and simple, easy to learn and a joy to use.

But don’t just trust me on this, it is a big decision to build your career on someone else’s word, after all. Google it, and you will find all the facts i mentioned. You will probably also find two main things against it, one of which is the speed i already mentioned. To that i say that there are sites with millions of users (like airbnb and soundcloud) that are built with rails. Another “problem” is called concurrency, which basically means that you can’t use ruby to handle millions of things at the time. Like you can with, eg go. But as this is a completely different problem, i find it is a moot point.

About other languages

Now that we have chosen the framework, we got the language that comes with it, ruby. Ruby is a dynamic object oriented language, and i’ll talk a little about what that means. Object oriented means that the language works in terms of things that have properties, called objects and actions called methods. This is easy to understand, because it is how our brain works. The world is full of things (like birds and cars, that are blue or red), and they can do things like sing or drive. Since programming is a lot about building digital representations of real world processes (and the things involved in them), object orientation is well suited for this task. The dynamic just means that as programmers, we can play around with the actual program too, which in so called static languages is impossible. This makes the language more powerful in a way.

Through the rise of rails, ruby is mostly used in the web application field. This is much wider than one may think, as all kinds of processing (eg image or pdf, barcode etc) needs to be done, but still, it is not used for most of the things other languages are used for. I’ll give a very brief overview of some other languages you may hear.

Python is probably the language that is in feel and design closest to ruby. It is used a lot in the scientific community, and because of that is good at number related tasks, big-data etc. It does have a web framework, django, which has matured quite a bit later than rails and has much less users.

Go is a language by google, invented to do their system programming. System programming, often file or network related, is low level programming. But people are starting to write web services in it too, especially if concurrency (many connections) is an issue. Go is replacing c++ ( an object oriented version of c) at google, and is much easier to use than c++ (or c). C is what operating system are written in, and is as hard to use as that sounds.

Rust is also more a low level language, created my the mozilla team. It aims to replace C (ie be fast) and be safe. Even it is not very big, i mention it because it has very good ruby integration. This means that it is very simple to write part of a ruby/rails system in rust, especially of course performance critical sections. Thus one can avoid one very common problem in software development called premature optimisation. This happens when developers think they know what the problem will be and solve it before it has emerged, usually wasting valuable resources. Instead, one can develop in ruby, then measure performance, and then fix performance problem once they have been identified, eg by changing critical parts to rust.

Off course there a at least a dozen more, well used languages, out there. Like swift, apple’s iOS language, or java, mainly used in enterprises (also for web), c#, the latest microsoft language, php , used in wordpress and small apps, and many more.

As a proficient programmer it is off course good to know many languages, but as a beginner it is better to choose. Learn one, and then another and another. Trying to lear several at the beginning will slow you down (just like bilingual kids), and expose you to the great risk of never getting good at any.

So, if you continue reading this, it will be ruby from now on. In the beginning i will just throw you in the deep end and show rails code and sort of expect you to pick the ruby up by yourself, or do a course. Later i will do a separate post about common difficulties.

--

--