Archive for March, 2010

Quick tips for learning Rails

Share

Know you basics well:
Without knowing your basics(programming, object oriented concepts, design patterns, database concepts),
you would face many difficulties in the path of becoming an expert.

Learn Ruby
It is a myth that knowing Ruby is not required to learn rails. But beware, without Ruby your path on Rails would be very bumpy and short.

Learn SQL:
Knowledge of sql is a must to write complex queries in active record and debugging problems related to database.

Write Code, Write Code, Write Code
This the best thing you can do.

Type out the code you write, do not copy paste from an ebook or any training material you are reffering.
This point is not about copy pasting chunks of code from the internet. When you are learning rails from some ebook or some e material, then when you try out examples, you tend to copy paste from the material. This way you never learn/remember the syntax and the method names.

Believe me, follow this one and you will remember the syntax, names of the methods only after 2-3 times you type it out. If you copy paste code, then even after 2 yrs of working on rails, you would be stuck without api.rubyonrails.org or google to refer for syntax.

Ask why
Ask why, understand why you are writing this and not something else. At first there will be many questions. Move ahead, and keep asking the questions, slowly all the pieces of the puzzle will join, and your questions will be answered.
Do not get stuck at some point, if you are not understanding some thing. Assume and move ahead, and come back to it later. Don’t be very fanatic about understanding everything in the first go. This way you may get frustrated and stop.

Read others good code.

This will help you prevent making mistakes and write better code faster.


Share

The darker side of the frameworks

Share

Frameworks  and libraries make our life easier. But they also have their darker side.

They take away the basic power of the programmer, the power to think.

Yes frameworks make us lazy, and when difficult problems arise then we feel lost.

This is most true for people who directly start programming with some high level languages.

When difficult situations come, we are not ready to face it.

People who have worked with C (and assembly), had to write code for operations link  sorting an array, for searching in an array and many such operations.

This builds their programming ability and prepares them to face tough business logic programs. I agree a lot of time was wasted in writing duplicate code due to this.

Today there are frameworks and libraries,for all the basic tasks which we come across during coding there are methods available. This saves lots of time and prevents duplication of efforts. But it also makes the programmers lazy.

A bit of complexity creates a turbulence in the mind of the programmer.

I am absolutely not telling you do not use the ready made methods available.

My point is keep aside a portion of your learning time to write some complex programs, so that you get a hang of them. That’s it.

These programs may be simple ruby programs.  Let them have no relation with Rails. But they will help build your programming skills and your thought process.

Examples of some of such programs are

Sort an array of numbers by using different techniques

Print an array of numbers in all possible combination of order.

Loop through a 2 dimensional array and print all the pairs of elements.

Search in an array of numbers for a particular number, and return the first instance found

Write a program to find factorial of 2 numbers

Share