How long does it take for an encoder to learn ruby?

How long does it take a developer to learn ruby. And to develop a production site such as stackoverflow? Normally. If the developer has .NET experience but no ruby ​​and MYSQL or PostgreSQL experience.

+6
ruby
source share
3 answers

I worked with .net for about 3-4 years, and Java 3 years before, now I work in a rail store.

Learning the basic syntax is simple. Wrapping your head around some concepts will take much longer. Like a little checklist

  • how instance variables work (they are very different from C #)
  • like everything related to methods is just messaging sugar.
  • what self means in any part of your code (especially in and of itself in the area of ​​class declaration and in the field of declaration definition)
  • Impurities
  • when to use the module, when to use the class
  • how classes are just another object

This is simple stuff. After that, you want to know more about it.

  • learn about the most commonly used language level callbacks (e.g. method_missing and included)
  • wrapping around methods defining methods
  • understanding of blocks, coroutines, procs and how they all work together (this is probably number one).
  • understanding how the parsing method works, and choosing the right amount () or {}, which will lead to the least typing
  • head wrapping around the individualization of objects (for me it took some time)
  • stop using objects for everything and stick to hashes where necessary
  • find out when metaprogramming is appropriate and when not (many, many rubists do not know this well).
  • to learn how to solve common problems with these new tools at best, then it’s possible with something like C # (Builders, Adapters and Strategies stand out for me as the most radically different in terms of GoF templates).

It's hard to say how long it will take. For me, the first bits took about a month of playing with a ruby ​​and reading books. The second half probably took more than three or four (although there were rails there)

As for MySQL / pg, this is not like you should start all over from scratch. The toolkit is not as good as SSMS (imo, the best part of the MS stack), but that’s enough. If you use rails, most of the database material is abstracted. If you need to check something in db, nine times out of ten you run the script / console and just use the ActiveRecord api (which comes out of this world amazingly)

EDIT:

Object individualization means that each instance of an object is its own β€œthing”, which is based on a class, but may not just be that class. here are some examples

first build a class

irb(main):001:0> class TestClass irb(main):002:1> def tc irb(main):003:2> puts 'testclass method' irb(main):004:2> end irb(main):005:1> end => nil 

now we repeat it twice

 irb(main):006:0> t1 = TestClass.new => #<TestClass:0x7fea78ee6f78> irb(main):007:0> t2 = TestClass.new => #<TestClass:0x7fea78ed6ba0> 

def method that is only on t2

 irb(main):008:0> def t2.only_on_t2 irb(main):009:1> puts 'this will not be accessible anywhere else' irb(main):010:1> end => nil irb(main):011:0> t1.only_on_t2 NoMethodError: undefined method `only_on_t2' for #<TestClass:0x7fea78ee6f78> from (irb):11 from :0 irb(main):012:0> t2.only_on_t2 this will not be accessible anywhere else => nil 

override the method that is extracted from the class, but only on t1

 irb(main):013:0> def t1.tc irb(main):014:1> puts 'redeffing something picked up from the class' irb(main):015:1> end => nil irb(main):016:0> t1.tc redeffing something picked up from the class => nil irb(main):017:0> t2.tc testclass method => nil 

The above code is extremely rare, because having a set of inline method definition tools in another method is usually pretty ugly. Mixing in modules with specific instances is quite effective, especially when you accept duck print.

 irb(main):018:0> module TestModule irb(main):019:1> def tm irb(main):020:2> puts 'this is where it gets interesting' irb(main):021:2> end irb(main):022:1> end => nil irb(main):023:0> t2.extend TestModule => #<TestClass:0x7fea78ed6ba0> irb(main):024:0> t2.tm this is where it gets interesting => nil irb(main):025:0> t1.tm NoMethodError: undefined method `tm' for #<TestClass:0x7fea78ee6f78> from (irb):25 from :0 irb(main):026:0> t1.is_a? TestModule => false irb(main):027:0> t2.is_a? TestModule => true 

This is more advanced stuff, and this is one of those things you should aim for, but there are times when doing it on the fly is a much more elegant solution to the problem than alternatives (which is a general warning with most advanced rubies, don't this because you can, just do it when you need to)

+11
source share

This is a massively subjective question, as it depends on your experience and time. However, I recently recognized Ruby and was able to pick up the basics within a few days after reading Kikkaks's book. I would recommend this book if you have previous programming experience, or the _why Poignant Guide to Ruby if you have never programmed before.

Thus, after several hours of work, you should know some basic syntax, but it will take you much longer to speak the language. Expect you to learn to call yourself advanced in a few months.

Since you mentioned web development, frameworks like Sinatra are pretty easy to get started. Rails is a bit more complicated and requires additional training before you can create a functional website. So, if I knew Ruby, I would say that from 2 to 3 weeks (depending on the time spent) to be able to create the "right" sites with Sinatra. As for something like StackOverflow, it will take a lot longer, and probably the development team.

+1
source share

If you follow Ruby Koans , you will learn a lot about Ruby in about 4 hours. After that, you will have a practice and it will come.

This is not a difficult language to learn, especially if you are already familiar with languages ​​that combine functional and object-oriented concepts (for example, C #). It is a very expressive language and allows you to do more than C # when you get into metaprogramming.

As for website development with Ruby, the defacto framework is Rails, which can certainly be written on a site like StackOverflow. This is due to its own steeper (IMO) learning curve. Rails abstracts the database from you, so knowledge of specific databases is not necessary.

0
source share

All Articles