Monday, 26 October 2015

Week 5 [26.10 - 1.11.2015] Ruby on Rails



Have you ever thought that you could be a programmer? I will show you now, why Ruby on Rails framework is so easy for beginner developers.
I know that many people here are disgusted with programming at our academy. They forced us to learn programming languages like Java, C# or C++ for many terms. To be honest-I also didn't like programming until last year when I met Ruby on Rails.
Ruby on Rails (or just 'Rails') is a web development framework, which was written in Ruby programming language. Sample pages written in Ruby on Rails are Github, Kickstarter, Twitter and Polish pages like Durszlak or Kwejk. So, what makes Rails so great? Firstly, Rails is 100% open source framework. What is more- we write less code than in e.g. Java and We have the same effect. Also we do not use semicolons. Lack of semicolons – a small thing which enjoys so much;)
I will show you some simple code written in Ruby on Rails

number = 3
if number%2 == 0
                p 'Number is even'
else
                p 'Number is odd'

That was a short example that checks if the number is even. In Java the first line of code should contain 'int'. Ruby is a dynamically typed language, so we don't need write the variable type. Another advantage is that you do not need brackets before and after condition (second line of code). It also applies curly braces ;) The last difference is that we have 'p' to write something instead 'System.out.println()'.
The example above is only the beginning of facilities for developers. Rails’ developers community likes to save time and if someone comes up with an idea to improve work, write less code or save time, he/she writes a gem. The gem is something like a plugin. The Gem is a packaged Ruby application. An example of the Gem could be Devise. If you need a login system to your application, you should use it. It is really simple, and you can read more about it at:
https://github.com/plataformatec/devise#getting-started
Most of gems are free and available on Github.
If I persuaded you and you want to start learning Ruby on Rails there is a lot of free material collected at this address:
http://iwanttolearnruby.com/
I am  so sorry that you had to read it :)


42 comments:

  1. " I am so sorry that you had to read it :)"
    Why? I think it very interesting. To make it even more interesting you could write a little about money you can earn on Rails because, from what I've heard, it's well paid technology.
    What concerns me is no need to write the variable type. Maybe it's good in some cases but it's also a problem. Let's assume that we have a lots of variables and thousands lines of code. You get an error because you in variable "sum" you added a text " greater than zero" or something else. Is that easy to detect error? I think that no need to write a variable type it's tempting but it can cause problems if someone don't know how to keep his code clean.

    P.S. I always thought that kwejk is on wordpress. You even buy ready and very similar theme for something around 100$

    ReplyDelete
    Replies
    1. Daniel usually thinks about the money - obviously ;)
      In Ruby on Rails You can write some app faster than in other technologies, so salaries are higher.
      Ruby is duck typing language. It means that "when you see a bird that walks like a duck and swims like a duck and quacks like a duck, I call that bird a duck". The point is that the variable can change its type in out code as often as you like, but if you want to check the type of variable - of course you can. You have method is_a? which accepts as an attribute type of a variable. For example '1.is_a? Integer' returns true
      I found for you one Kwejk job offer from 2011 - It could be much clarified
      http://forum.rubyonrails.pl/t/kwejk-ror-developer/4302

      Delete
  2. Thanks for a presentation of Ruby on Rails. I never had a contact with this language. Currently employers are looking for a lot of developers, who program in Ruby. The great advantage is that we don't need remember initialize variable type. It's nice that we can write the same program but much shorter.

    ReplyDelete
    Replies
    1. Unfortunately, most of job advertisements is for more experienced Ruby on Rails developers ;)

      Delete
  3. For me it's interesting topic . Even once I tried to learn this language but without success , maybe because I had too much work on those days and in first time , it were strange for me, because like You said,in this language we don't need to write a lot of things, like brackets or type of variable . For me code with these things, looks more clear , but maybe it's out of habit

    ReplyDelete
    Replies
    1. First days of a new programming language are always hard. In Ruby on Rails there are some strict rules e.g. Convention over Configuration. It takes some time to know where you should write the magic line of code. Here You have the link to the course which explains everything from scratch
      http://railsforzombies.org/
      P.S. cool theme of this course

      Delete
  4. I have heard from many sources that the rails are one of the nicest programming languages, not without reason was to create under the slogan "Developer happines". Although I had no opportunity to program in this language I'm sure, this will be next programming language that I use at work. You did not mention that it's also very efficient backend language, often used to connect mobile applications such as servers.

    ReplyDelete
    Replies
    1. Cezery Ciosek
      You can use Bootstrap to create responsive websites. It's another framework for frontend developers, which helps with creating mobile websites When you wrote responsive website, you do not need write mobile app

      Delete
  5. Very interesting topic. I think that your presentation encourage me to find out what's Ruby on Rails, because I've never used that language before.
    It looks simply and it seems that learning Ruby will be a pleasure. However, I don't think so that I will be use it in my work, but who knows. It's better to know more than less!
    Thanks for familiar me with this topic :)

    ReplyDelete
    Replies
    1. "However, I don't think so that I will be use it at my work, but who knows" - A few months ago, I would not say that I would become a programmer, so who knows ;)

      Delete
  6. I am afraid I don't feel convinced Ruby would be the right language for me. Most of the advantages stated in the post I consider downsides.

    Semicolons: is that so much more work to put one sign at the end of a statement? For me it just decreases code readibility.
    Dynamic types: I'm more of a fan of strongly typed languages, it bothers me already in javascript, but at least you can put a 'var', here: nothing.
    Brackets: same as above - readibility. Not much more to be said.

    I hope it's not the future of programming, I'd hate to have to adapt.

    ReplyDelete
    Replies
    1. Hi Grzegorz. I have got some good information for you. The brackets and semicolons are optional in Ruby. If the brackets or semicolons improves the readability of your code you can use them, but I would not say that the semicolon improves readability

      Delete
  7. I once had contact with this programming language. Because of the many very positive reviews I tried to know that language. At first I liked that I don't need to write a lot of code. However, this has also negative aspects. For me the code becomes less readable. Maybe I too quickly resigned from learning that language or my habits from languages such as Java and C # were stronger.
    However, this is a very interesting programming language, worthy of closer attention.

    ReplyDelete
    Replies
    1. Ruby on Rails is 10 years younger than Java, so maybe let's give it some time to be such as java

      Delete
  8. I tried once to understand this language, at start it was nice to learn and looks nice, but later it was a problem for me to understand what is going on, beacuse its's becomes less readable. Probably i will try later to understad ruby, but now i focus on C# which is more friendly for me.

    ReplyDelete
    Replies
    1. In C# you have .NET, which it is similar, so the de facto you do not need to learn Rails Emotikon wink

      Delete
  9. auto x = 4;
    printf("The number is %s", x&1 ? "odd" : "even");

    Also, this:

    "Why do the startups only want RoR developers?

    It's hipster technology. They create an internet startup with Rails or Node.js on top of MongoDB. They have an .io domain with a name that normally ends in -er but they removed the 'e'. They code in Sublime Text on their macbooks while sitting in Starbucks. When people ask about their work they refer to thenselves as a "code artisan". "

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
    2. >> It's hipster technology. (...) They code in Sublime Text on their macbooks while sitting in Starbucks.

      Finally something funny ( ͡° ͜ʖ ͡°)

      Delete
    3. I was afraid of your answer. Your stereotype is absolutely correct. Currently I use text sublime - because it is free. And that's the end of similarities when it comes to me. I am usually drink coffee in home or in cheap cafe (6pln per coffee). My operating system is debian (cinnamon). And I do not use MongoDB, because it causes some complications with complex databases

      Delete
  10. This comment has been removed by the author.

    ReplyDelete
  11. Michał Stankiewicz1 November 2015 at 16:46

    As a game programmer it's obviously not my first choice for a programming language. I has some contact with it and even though the programming in it can be fast and quite easy, I dislike the languages where I don't have any control over the types. It's mostly connected with the programms I'm working with, where there are a lot of tooltips and coding support connected with these types.

    What's more ruby is not used in any programming languages, and when looking at easy to learn, fast to code languages, I would rather aim at Python. The Pygame allows to create simple games quite easily, and python itself allows for example to create addons for commonly used applications.

    ReplyDelete
    Replies
    1. You're absolutely right. Ruby on Rails is the web framework. It is useless in game development. But the ruby is derived from Python, so maybe one day it will be possible to create games in that programming language

      Delete
  12. >>Rails is 100% open source framework

    Like many other frameworks ;)

    >>we write less code than in e.g. Java

    Ok, I agree with this. Java has grown too big.

    https://s-media-cache-ak0.pinimg.com/736x/d0/42/57/d04257e932e2a804445e0fd1d8139bc1.jpg

    Look at this, especially at "Code written at a large company".

    >>Lack of semicolons – a small thing which enjoys so much;)

    Maybe with source that has about 100 lines of code, above IMHO we get readibility problems. It also applies to brackets.

    >> In Java the first line of code should contain 'int'

    And it should be in other languages too. Sorry, but this feature is a downside for me. PHP is now also a weak typed language and with php 7 (god bless the php devs :D) it will probably give an end to this approach.


    ReplyDelete
    Replies
    1. You can use brackets and semicolons - they are optional. Php in Poland is still the most popular among web developers - I do not know why ;(

      Delete
    2. >>You can use brackets and semicolons - they are optional
      ok, didnt know it ;)

      >>Php in Poland is still the most popular among web developers - I do not know why ;(

      I think you have in your mind php 5.x where x<3. PHP has been improved since that time and when you use it with a good framework like laravel or symfony then it isnt as bad as you think ;)

      And PHP 7 will be released this year.

      Delete
  13. This topic is very interesting to me, because it's connected to web apps and dynamically typed languages (I wouldn't say scripting language, because it's too deep topic). We talked about this with Rafal. The topic of C#, Java, C++ is pain for the most people here at our school. I personally like those languages but it just turned out I went to work and I started to work in Python. Those languages have they similarities - the most important are: Python and Ruby they are very very unpopular, and by that I mean that there are no lectures. I do not know any school that would offer lectures of those languages, this situation has it's consequences, at current state, there is not enough python/ruby developers.
    For people saying that it's not the future: You know it's already happening, it's the future like it's the 'future' now. This languages are strong like C#, Java are.
    It can be less readable for the beginning and when You write or read bad code. Variables should be documented - in docstrings for example so the person who reads it will understand what is going on :)
    Dynamically typed languages are about conventions, if you manage to learn them and remember you are halfway to become a good programmer :)

    ReplyDelete
    Replies
    1. I really enjoyed your opinion, but I can not agree with one thing
      Ruby on Rails and Python is very popular for example in the USA.
      http://www.google.pl/imgres?imgurl=http://static5.businessinsider.com/image/4dcaf41749e2ae467a0b0000/chart.jpg&imgrefurl=http://www.businessinsider.com/heres-why-ruby-on-rails-is-hot-2011-5&h=300&w=400&tbnid=Hq8hdld_MRtYvM:&docid=rKMnMKZOr9uDBM&ei=iF42Vv6kLsmAywPjmIfYCg&tbm=isch&ved=0CB8QMygAMABqFQoTCP6I6d_x78gCFUnAcgodY8wBqw
      In Poland we are a little old-fashioned. And you can find many materials about Ruby on Rails on the web. The truth is, there are no good in Polish, so you have to read English version ;)

      Delete
  14. I agree with most opinions here, some of them partially. But first things first.
    First time I encountered Rails, was about a year and a half ago. That time I heard it's a programming language commonly used in the US and working as a Rails programmer is rather well paid. Then I started thinking, while in Europe it's not so popular yet, maybe it's worth to learn RoR and be prepared for interesting job offers. The easiest and fastest way for me to learn it, was railsforzombies.org. Short lessobs and well explained Rails.
    I think the advantages and disadvantages depends on the point of view. If someone has a little experience and knowledge in other programming languages, Rails would be clear and easy. Perfect choice for beginners with small expectations or simple web app project.
    In other cases - issues mentioned in posts above.

    ReplyDelete
    Replies
    1. You could write how your progress in RoR learning. Rails for zombies are probably the best choice to start - Good choice.

      Delete
  15. I think that it is a good manner of the programming. however personally I didn't like him, becouse it wasn't explained. And the fact, less code, but identical effects, where in java will fill it far more.
    Cool presentation, interesting, and really in the free time I will study this language.

    ReplyDelete
    Replies
    1. You can start with railsforzombies.com. First episodes are free ;)

      Delete
  16. I think it's very good IT language. I heard a lot of positive opinions. Maybe in the future i would like 'meet' with this language. I also saw many jobs, Companies offered good salary and good perspective in the future. Thanks for very interesting topic.

    ReplyDelete
    Replies
    1. We'll see how the salaries will be in the future

      Delete
  17. About year ago I changed my primary programming language, Java, for Scala.
    And now I can't imagine that I would write a program in an imperative language like Ruby. It's hard to write scalable applications in Ruby, and I like dynamic typed languages. I also don't like Rails because it propagates an "Convention over configuration" idea, which is good until you want to do something offbeat.

    ReplyDelete
    Replies
    1. in most cases it works, at least you know where are the files and you know their names

      Delete
  18. I think this is very attractive alternative.
    I’m interested with how popular it will be. Maybe like Java or C++. And who knows maybe large companies are useing ruby.

    ReplyDelete
    Replies
    1. >> I think this is very attractive alternative. (...) Maybe like Java or C++

      c++? Compering c++ with ruby is like compering vegetables to candies. They both are food, but they have different using.

      Ruby is a high level script language and c++ is low level language. They are used in different projects and they cannot be replaced by each other.

      Delete
  19. I never had contact with Ruby but I have feelings that this language isn't developed enough to do advanced things. You said that websites like kwejk are written in Ruby and they are examples of very simple websites what confirm my thesis that only simple applications can be made in Ruby. Like I said I never made any app in ruby so I can be wrong. I would have to read more about this language and try writing something by myself to check if I'm right.

    ReplyDelete
  20. As a programmer using some high level languages I find it an interesting option for starting some web-app development in it. I have most experience with .Net but I don’t find any fun in it. How about synergy with other web languages like javascript?

    ReplyDelete
  21. Not everyone will agree with me, but I do think that there are more universal, and less universal languages, and every language has a very obvious reason to exist.

    For now, definitely most universal languages are C#, Java and (slowly dying) C++. You can code anything in them, from very simple console applications, through desktop ones, web services, ending on APIs and websites. They're very efficient, easy to use, have many tutorials and basically you just simply "can't go wrong" with either of that language. If you start creating X, suddenly it grows to be much larger Y, and finally will differ so much that you won't even consider it X anymore, but Z, the language will still be valid, and still superior.

    I did use many different languages for many different projects. I wrote programs in bash, perl, python, C, C++, C#, Java, php, even something in node.js. And you know what? All of these languages had their own flaws and advantages, but I found myself very often in situations when e.g. my perl was just not comfortable enough to continue writing in it, or my bash script became so complex that I had to switch to C.

    I do not think that RoR is wrong, it has it's potential, and same as PHP is targetted at very obvious type of projects, which are webs. But I'd seriously think about making any complex website or service using RoR, python, perl or any other fancy language that is used nowadays by so-called "hipsters".

    I share same opinion as Przemek, I guess.

    ReplyDelete