January 20, 2009

SQL by created on

Posted by Sudhindra Rao

Model.find(:all, :conditions => ["date(created_on) = date ( ? )", Date.today.to_s(:db) ])

January 19, 2009

Views and Boolean query methods

Posted by Sudhindra Rao

Code smell: a Boolean query method in your views like a has? Or is?
Solution : move it to a helper or better yet the model

January 16, 2009

Using github pages

Posted by Sudhindra Rao

Started using github pages for this blog. Made a couple of posts.

Find out how easy it is to blog on github


Also released accordion.js that is much simpler and completed tested. Check it out here.
accordion.js announcement

January 4, 2009

Encapsulation

Posted by Sudhindra Rao

The idea of block structure originated with the programming language Algol 60. It appears in most advanced programming languages and is an important tool for helping to organize the construction of large programs. - SICP

* Block Structuring is a way for a procedure to have internal definitions that are local to that procedure. This prevents name collision at minimal and provides simplification. Along with this it also allows the user to unclutter their minds and think in terms of details they are interested in. Splitting a program into smaller procedures and internalising a lot of details leads to good *encapsulation* and better understanding of the overall program.

Inspite of it being such an old idea why do I still come across code that has 300 lines of if_else, case_switch statements in a single big method.

Welcome