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)