Saturday, March 21, 2009

RoR Outsourcing Checklist

Again someone asked a great question on LinkedIn and it inspired me to blog my opinions here… :-)

So the question is “Should you look for anything in particular when outsourcing a RoR project?”

And my answer goes like this … 
Yup! one should look for at least these things in particular : 

1. Obvious one, Company has enough expertise on RoR. Should have successfully developed and deployed a few RoR projects. Having said that, I would like to state that if you are technical guy Or you have extreme confidence in your outsourcing partner you can still get your RoR project outsourced to even first timers. That’s exactly how I got my first one. 
 
2. Company has sound experience in Web 2.0 - Coz RoR is mostly not a standalone solution. The team should be well equipped with other open source technology experts like Linux (scripting and admin), MySQL, Repo mgmnt, Issue tracking and PM tools, JavaScript, Ajax, Flex etc. You should make sure that these experts are available to help/assist the core RoR development team part time. 

3. Company has sound experience in Agile methodologies, otherwise it wastes a lot of time to get them out of conventional ways of development. 

This along with normal outsourcing checklist should complete your analysis before outsourcing your IT. 

Happy Outsourcing!
Posted by Ujjwal Trivedi at 08:07:26 | Permalink | No Comments »

Tuesday, December 16, 2008

Pitfalls to avoid for Ruby-on-Rails start-ups

Here is an important question from Micky. (Account manager at Ruby-people.com.) And the question he put on a linked in group is What are the main pitfalls to avoid for Ruby-on-Rails start-ups? After I answered him there it occured to me to put it here for everyone to review and discuss:
 
Here is my take:

1. RoR is not “replace all” solution: It is highly recommended for database driven small and medium sized Web2.0 based web products. If you want a content based website you dont need RoR, a lot simpler solutions are available. Its not fit for any Real time use too.

2. Continuous evolution: RoR is evolving quite fast and any startup need to keep up pace with the latest.

3. Only paranoids survive: Keep a strict watch on performance, scalability and security. Ruby has its own vulnerabilities and that can be (should be) taken care of.

4. Complete skill set: RoR is a part of the Web product’s big picture. It should help any startup to have MySQL, Linux (shell scripting) and UI(Flex/JS, Ajax) experts on-board as well.

5. Look for niche: For a start-up it would help to look for a niche area in developing RoR (RoR still has a huge scope of improvement) as well. Being a part of product or services clan may not help much until you really have an excellent out-of-the-world product.  
Posted by Ujjwal Trivedi at 16:13:07 | Permalink | No Comments »

Friday, October 31, 2008

Ruby on rails Interview questions

A few months I had been looking for interview questions to prepare myself for a switch. And all I could find were these from Ryan and these from a so called job interview questions website. 

But now when I was requested by a friend for some interview questions and I look for them I find some better results:  
 Puneet Pandey presents an exhaustive list of questions. Though you ll have to fight for the answers of a few of them. 
 Joe also has a nice variety. 
 And there is good list at RubyAssist
 Ben also has a good compilation of quality questions and Answers.  

And then of course here is the list of questions that i could remember of my own interviews… 

Basic
Q. Why ruby on rails? Why do you prefer RoR to other technologies like PHP, Python?
Q. What is Ruby on rails?
Q. What is scaffolding? What generates a scaffold?
Q. What is MVC? Does it score over n-tier? How?
Q. Do you use an IDE? Which?Why?

Specific Technical questions

Q. What in RoR is similiar to events in .NET. (Since I was familiar to .NET)
Ans. Callbacks (Read Active record callbacks)
Q. What is the difference between include and require?
Q. How is route/url mapping done in Rails? What files would you be changing?
Q. How can object oriented programming be implemented in ruby?
Q. What is rake? how does it help in migration?
Q. Tell us something about date and time support in rails?
Q. What is the base class of any class in ruby? Ans. Object
Q. How would you use a table to store a hierarchy? Ans. Acts_as_tree 
Q. What is the difference between “.save” and “save!” ?
Q. Tell me about some validation helpers in active record that you have used?
Q. What steps will you take to tune performance in a rails based app?
Q. How do you deploy a rails based app?
Q. Can you use third party tools in Rails app? How?

Some of the answers have been given right there. Some Answers can be found in my blog, especially for the questions in Basic category. And for more your effort to find them in the book should be worth it. And if you still need help on any let me know…. All the best for your interviews.  
Posted by Ujjwal Trivedi at 19:18:15 | Permalink | Comments (2)

Saturday, October 25, 2008

Include V/s Require in Ruby

With a switch in the company I had been a little distant from coding and with my new ideakosh and journal initiatives I almost forgot that this is a technical blog after all. Never mind its been great time, and I am all geared up to flex some brain muscles with Flex2.0. I know 3.0 is out but my client wants 2.0. But before that here is an answer to a question that i asked long back …. I asked it because people asked me in interviews.

Diff b/w include and require in Ruby?
Michael Morin (The ruby guide of About .com) has been generous to answer me thru email. Here is the answer:

——————————————————-
The include and require methods do very different things.  The require method does what include does in most other languages, run another file.  It also tracks what you’re required in the past and won’t require the same file twice.  To run another file without this added functionality, you can use the load method.
The include method takes all the methods from another module and includes them into the current module.  This is a language-level thing as opposed to a file-level thing with require.  The include method is the primary way to “extend” classes with other modules (usually referred to as mix-ins).  For example, if my class defines the method “each”, I can include the mixin module Enumerable and it can act as a collection.  This can be confusing as the include verb is used very differently in other languages.
——————————————————-

Thanks Micheal, I think thats an excellent answer.

Posted by Ujjwal Trivedi at 20:58:57 | Permalink | No Comments »

Friday, July 25, 2008

Top ten resources to build RoR based enterprise solution

These are essentially the ten resources you would need to build your first ruby on rails based enterprise solution. Considering you a total newbie, these will give you all the required help, information and mentoring from level alpha to level omega.   


  1. Agile web development with rails - book by Dave Thomas. The ultimate source for everything you need in the first year with RoR. It’s got everything from the basic rhymes to the most complex enterprise application formulae. You won’t think it was costly after reading it. Together with The Ruby CookBook. it equips you with complete armor.

  2. Try Ruby online - very basic ruby hands-on guide to showcase the power of ruby.
 
  3. Simplest ruby ebook : The first steps to learning. Just read it and you should find yourself comfortable with ruby code in less than a day.  

  4. Another refreshing Rails guide to deal with initial learning curve… all this is obviously good only if you are not reading reference number 1.

  5. Screencasts and self learning videos should sharpen your learning curves and teach you those fine tit-bits and caveats.

  6. Ruby on Rails official documentation. The best technical help you will get while learning and working all by yourself. You will need this on every step.

  7. The ruby on rails link library. All the best online resources for ruby on rails are listed and categorized into better heads like introduction, promotion, performance, security.

  8. Plugins Directory:- A nice directory of all the available plug-ins that you will want to use for your application. It lists the plugins with their user ratings.

  9. Rails Performance Issues and improvement :- Stefan Kaes is great when he talks about ruby and rails performance issues. There are more website that will deal with different issues in different ways, so you can help yourself, or refer rails library. And don’t forget this nice compilation somewhere down on this page. :-)

  10.Security issues in ruby on rails based apps are best dealt here. So if you have reached the stage where you need to think about saving your web product from cross-site scripting attacks, just go through this website and you find answers to all your concerns. If not send me a note.   

This top-ten is not listed according to priority, they are sorted according how you will need them one by one during your course of constructing a RoR based application.   

Posted by Ujjwal Trivedi at 22:04:45 | Permalink | No Comments »

Saturday, July 5, 2008

Whats the heck Ruby on rails anyway?

I have had nightmares of mobs hitting me with paper rockets and asking questions like what is open source, what are communities after all. So Ruby (not language) came to my dreams and inspired me to write this post, to enlighten the souls living in dark jungle of licenced software. No hard feelings.

Open Source

Here is how I would describe open source. Think about a library, (Stop thinking about DLLs and code libraries), think about a huge building with a massive collection of Books, newpapers, pamphlets, manuscripts, photos, photo-albums etcetera. Every one can freely visit that library. Read anything, copy anything, write his own manuscripts and publish his own books. There are big encyclopedias which can be edited by anyone and every visitor is free to access it and add to it. There are loads of Software available for you to use. You can use them directly or tweak their source code to suit your needs and then use, distribute, sell them.  You can put in your own manuscripts, profile, photo-albums, software and showcase it so that someone on the other side of the world can benefiit from what you created the other night.

Communities

People realized the potential of such a great resource and found that working in teams would help improve this resource. So they formed Groups called Communities. It smells communist but is capitalist. So now the little guys can stand the monopolist bullies. People with similiar interest and aim joined those communities and contributed to their common aim. Since everything is (most of the time) public, it is scrutinized by many and tends to get better and better with the help of ever increasing community. There are teams which built products which can be used by anybody. Many versions of Linux (for example) were developed by such communities.

So this is about open source and communities. It has its own rules and standards. Find out more. So far so good, but i know you will have concerns.

Show me the money!!!

The biggest concern about free software is the word free. Free stands for freedom, freedom of creation, sharing and use. But, that doesnt mean there is no money involved. Hmmm the easiest way you would be able to accept the phenomenon is to think (or find out) about Google. All the services it provides you are best in class and free of cost. Worth mentioning is that it may also help you earn (Adsense) without any investment. Google is still a multi-billion dollar company. Interesting! hope that triggers you to do some sole searching, just to find out where you stand.

Agreed! So what is this Ruby on rails stuff?
   
Ruby ..the old stuff (Old is gold)

Per Wiki
“Ruby is a dynamic, reflective, general purpose object-oriented programming language that combines syntax inspired by Perl with Smalltalk-like features. Ruby originated in Japan during the mid-1990s and was initially developed and designed by Yukihiro “Matz” Matsumoto. Ruby supports multiple programming paradigms, including functional, object oriented, imperative and reflection. It also has a dynamic type system and automatic memory management; it is therefore similar in varying respects to Python, Perl, Lisp, Dylan, and CLU.” I dont think I can add more jargons to this description. IMHO its a wonderful to learn, fantastic to use scripting language.

Here are some of my experience which state why I talk about ruby so much.
 High level readability: After a sharp learning curve you can start reading the code just like newspaper headlines.
 Developer’s bliss: It is perfect for newbie (inexperienced) and lethargic coders like me to take up a language in which you can do in one line what I used to do in at least 10 lines in VC++. (Yes! I used to work in VC++, MFC and was trained in .Net).
 Fast developement: Less number of lines of code means faster development and easier maintenance.

 Powerful: So there is nothing that can be done in Java and .Net and cannot be done in RoR.

Rails..the new thing (simple and sexy)

Ruby on Rails was extracted by David Heinemeier Hansson from his work on Basecamp, a project management tool by the web design (now web application) company 37signals. It was first released to the public in July 2004. Simply put, Rails is a full-stack framework for developing database-backed web applications according to the Model-View-Control pattern. It is conceptualized on the principles of ‘DRY’ and ‘CoC’. DRY says Dont repeat yourself, and puts a clean check on redundancy. ‘CoC’ (Convention over configuration) says you can follow a few simple conventions and avert a whole lot of configurations. This means lesser and cleaner code and more smiles.

I hope after reading this you wont, at least, drop your jaws next time you hear some developer say “I m doin Ruby these days”. Of course, to ruby or not-to-ruby is your decision afterall.

Posted by Ujjwal Trivedi at 17:34:16 | Permalink | Comments (1) »

Tuesday, June 17, 2008

Walking with Ruby… on Rails!!!


The title induces fantacies and I know what you are imagining. Believe me, developing in Ruby is as fantastic as what you were thinking just now. J  Jokes apart, if you are in to web development and RoR has not crossed your radar yet, I can aver that you are significantly out-of-date. Fortunately though, if you keep reading this, you will certainly get a glimpse of the revolution in web development that open source communities have brought.  

What Ruby and Rails can do for an organization?

What can any language-framework pair do for an organization? If there are answers popping up in your mind, be kind enough to consider the same for Ruby on Rails. RoR can do all that in a much easier, faster and cost effective way. On the other hand if you don’t know the answers yet, here is a glimpse of what RoR can do:

·         Build customer centric small/medium websites
·         Deploy a web product with advanced (web 2.0-ish) features in a very limited time.
·         Create automated testing frameworks 
·         Legacy Application extension, integration and migration

Why only ruby on rails?

 Well if you are on the initial stages of paranoia you may like to consider other languages and frameworks, develop a few projects and find out the difference. If you are confident enough to rely on what the open source community has to say, hear this:
·         Productivity gains: exponential savings because of smaller teams, more productivity, improved time to market.
·         Easy development, easy maintenance : Lesser lines of code (10 times less than Java) , makes development faster and maintenance easier
·         Agility: Rails is Agile, no matter how confused you are on your business concept, rails will help you visualize. It adapts to your changing requirements quickly and easily.
·         Free: Its free and open source, can’t talk more on cost effectiveness.
·         Powerful: Its can be simply put as what you SEEK is what you get.

For a more technical soul here is how ruby on rails score over others 

·         Support for Representational State Transfer (REST) architecture
·         SOA-like integration with enterprise systems
·         Convention over configuration framework simplifies data management
·         Don’t Repeat Yourself or DRY model based on Ruby’s inherent ability to provide Domain specific languages
·         MVC (model view controller) design pattern
·         Built in testing at every level
·         Capistrano / ActiveRecord migration
·         Ajax support in any framework; runs on any Unix open source platform

What RoR has done already?

Testimonials: Some live projects singing the success story for ruby on rails.
Ø       Amazon.com: Yes! The same Amazon.com
Ø       Basecamp: project management tool by 37 signals
Ø       Bixee: An upcoming Indian job portal
Ø       BharathRentals: India ’s car rental service
Ø       Dimewise: personal finance management
Ø       HBO Asia : HBO’s Asian broadcast online
Ø       Scribd : online document sharing and publishing
Ø       Shopify: e-commerce
Ø       simplifyMD: digital chart room for small hospitals
Ø       Twitter: Online community, social networking and microblogging
Ø       Google: With Gears on rails google has brought online documents mangement offline 


 

Posted by Ujjwal Trivedi at 08:58:48 | Permalink | No Comments »

Wednesday, May 7, 2008

Performance issues in Ruby on Rails based Apps

Of course my RoR based app had performance issues and there is a great deal of help available to identify and rectify the same. You can read Stefan Kaes to get the whole bunch of information in one go.

Always bear in mind that Ruby is slow (Pankaj). Still fortunately enough,  there is a lot you can do about it.

“”Framework Related:”" Rails as compared with other frameworks (Django-python, Symfony-PHP) looks to be decent with performance. (http://wiki.rubyonrails.org/rails/pages/Framework+Performance). Some  patches though, should boost rails performance.

“”Server related:”" Webrick v/s Mongrel v/s NGinx

”’DB related:”’ See that all the table columns used in the rails queries are indexed. Primary and Foriegn keys are automatically indexed so dont worry about them as much. To find out what columns are indexed use ’show index from ‘. Just as an experience I can say that you ‘d find most of the queries on ‘name’ and ‘type’ columns in your table. It would be good to take a few cautions before going on an indexing drive on an existing database.

Secondly, you can count on removing unnecessary DB calls. Check to see if you are searching the same table through a loop. If a queries are used several times in the entire App, you can also, with caution, use environment variables.
Third, Make sure you are not flashing too much information on one screen. Sometimes its a feature in your application that forces you to bring everything on a common interface. Here, a lilttle out-of-the-box thinking is required. Believe me, there will be things that can be ‘reduced’ if not completely avoided. How about providing links instead of showing the whole list?

“”OS Related: “” 64 Bit OS is considerably faster than 32 bit, of course if hardware is not a limitation.

Posted by Ujjwal Trivedi at 08:08:58 | Permalink | No Comments »

Friday, March 21, 2008

Aptana (IDE) CheatSheet

As a developer with some experience on VC++ and MFC, Visual Studio had already spoilt me a great deal. When i started I just could not believe that an entire application be developed on text editors like notepad or Scite. Here is more about other editors: http://www.devx.com/RubySpecialReport/Article/34454/ because I chose Aptana-radrails and most of this blog will talk about that.
If you are very used to Visual Studio and likes here is one editor that comes close (somewhat) when you wanna develop a Rails or pure Ruby Application. Good thing is its quite integrated (many features in one) and its VS like.

Here is a quick set of hotkeys that i found really useful:

  • ctrl+q = open last closed tab
  • ctrl+w = close current tab
  • ctrl+e = opens the list of all open tabs so you can run thru them
  • ctrl+l = Goto line number
  • ctrl+ m = Maximize/Minimize
  • ctrl+n=New (file/project etc.)
  • ctrl+h = Search in Workspace
  • ctrl+f = Find/replace
They are documented in Key Assist (Ctrl+Shift+L) with many more but I ‘d actually use only the mentioned ones.
So its handy! :-)

And Also like VS when you wanna find the definition of one function or variable its easy. Just ctrl+click on the variable or function name and flash!!!! there you are…  

If you are working on a “Ruby” (and not Rails) or selenium project, you may go for Ruby perspective. For rails have RadRails plugin installed and get going. I love using “Data perspective” quite often. That saves me a lot of time firing queries on database. It just list all the tables and represents them graphically. You may (if you are very fond of SQL) write queries in the in-built sql browser and see results. 
Aptana also comes with in built web server (webbrick and mongrel) and web browsers. I rarely use browsers tho. I ’d prefer IE-7.0. or may be Mozilla when i need Firebug.    
Posted by Ujjwal Trivedi at 15:10:16 | Permalink | No Comments »