Monday, April 27, 2009

Good practices vs Bad practices

If you are software developer, or designer, or photographer, or engineer, &c, you may have heard following:
– there are good practices and bad practices, and you should always - i said ALWAYS - use good practices.
That's wrong. You should use good practices in 90% only. Not more. And also you should apply your head when deciding if to use that cool design pattern in this place.

Have a look around, and you'll find tons of the examples.
  • You may have heard of database normalization. Basically, this is the way of developing DB schema powered by straight mathematic researches form relation theory. Idea is that if you follow that theory you'll never get data inconsistency. Opposed to this, there is denormalization, which is used 10 times more rarely than normalization, but brings beatiful performance shifts.
  • Rule of thirds in photography - split the frame into 9 common parts and situate the object in the crosses of the splitting lines. You'll concentrate viewers' attention on the object.
    - yes, that's true. And now go to any more or less interesting photo museum, and look how frames are organized. Basically, this is the second level of harmony ;)
  • You know - you should never use magic numbers. NEEEEVER! If i see something in your css code saying offsetWidth = (width - 16) + "px" I would not be happy with that.
    But nature owns all of us :) Following picture describes that very well.
  • Google uses different stylesheets for different browsers.
  • Internet explorer handles 100% widths awfully. If you embed some element with paddings and margins into other element, it will take more than 100%, because IE does not use padding and margin values when calculating 100%
  • Width of the scrollbar in IE is 17px
  • There is a way of doing correct 100% width with IE. It utilizes IE css "expression" facility, and recalculates the width on each page event (even mouse move). This would be canonical way.
  • Although, Google decided to use -17px right margin just to stop loosing performance. It's easier, and better for both user and developer.
Don't you think it is beautiful?

P.S. There's no attempt to reverse-engineer Google code - just attempt to learn how big guys work. No IP violated :) Google is a registered trademark of Google Inc.

No comments: