A Primer on Ruby on Rails – Part 1
Mohamad Haj Hasan
2 |Page
Why RoR?
RoR offers a lot of great advantages, some of which are:1. Good organizationRoR is opinionated software, which means that it makes small decisions on your behalf.RoR organizes folders that look the same across different projects (e.g. app, views, helpers,etc.).2. Good practicesRoR is based on test-driven development, which tries to minimize bugs over the long run.3. Good toolsRoR has a good set of support libraries called gems as well as specific RoR code calledplugins (which are sets of functionality that are written by others that you can use “off theshelf” that save you the time of re-writing the functionality all over again). RoR also hasother useful tools such as the “rake” tool, which is great for system administration.4. Great (and active) community5. It makes YOU a better programmer
Object-oriented Languages
RoR is an object-oriented language; everything is an “object”. For a better understanding, takethis example:In the real world, you often have many “objects” of the same kind. For example, your bicycle isreally just one of many bicycles in the world. Using object-oriented terminology, we say that your bicycle is an “instance” of the “class” of “objects” known as bicycles. All bicycles have somestates (current gear, current motion, two wheels) and behaviors (change gears, brake) incommon.When building bicycles, manufacturers take advantage of the fact that bicycles share somecharacteristics, and they build many bicycles from the same blueprint. It would be veryinefficient to produce a new blueprint for every individual bicycle they manufactured.In object-oriented software, it's also possible to have many objects of the same kind that sharecharacteristics: rectangles, employee records, video clips, and so on. Like the bicyclemanufacturers, you can take advantage of the fact that objects of the same kind share certaincharacteristics and you can create a blueprint for those objects. Software blueprints for objectsare called
classes
. A class is a template or prototype that defines the variables and themethods (or functions) common to all objects of a certain kind.
Leave a Comment