Friday, March 13, 2009

Your code works - but could it be better?

This is a must read for every Object Oriented programmer.

Refactoring: Improving the Design of Existing Code
by Martin Fowler; Kent Beck; John Brant; William Opdyke; Don Roberts


Amazon.com Review

Your class library works, but could it be better? Refactoring: Improving the Design of Existing Code shows how refactoring can make object-oriented code simpler and easier to maintain. Today refactoring requires considerable design know-how, but once tools become available, all programmers should be able to improve their code using refactoring techniques.

Besides an introduction to refactoring, this handbook provides a catalog of dozens of tips for improving code. The best thing about Refactoring is its remarkably clear presentation, along with excellent nuts-and-bolts advice, from object expert Martin Fowler. The author is also an authority on software patterns and UML, and this experience helps make this a better book, one that should be immediately accessible to any intermediate or advanced object-oriented developer. (Just like patterns, each refactoring tip is presented with a simple name, a "motivation," and examples using Java and UML.)

...

.”

A catalog of summaries of refactorings mentioned in the book, Refactoring:
http://www.refactoring.com/catalog/index.html


Review by Matt Stephens at:
http://www.softwarereality.com/reviews/refactoring.jsp

If you're a programmer, it's almost a dead-cert that at some point you have had to make a change to someone else's code. It's also likely that your reaction when trawling through the code was one of abject horror: "What was he thinking when he wrote this 700-line function?"

Whatever the cowboy coder was thinking about, it would have had little to do with maintainability. Attempting to change the code in that state will almost certainly introduce new bugs. It's likely that the cowboy coder was thinking about getting his code working - hacking it to the point where it works - so that he could move on to his next grand masterpiece.

It's this kind of scenario where refactoring can prove to be very useful. It's a fairly safe bet that if you spend a little time carefully tidying up the cowboy code before you start adding to it, you'll save a lot of time bug-fixing later on.

Refactoring is the practice of improving code without changing its meaning. It's the cornerstone (okay, one of the cornerstones) of Extreme Programming (XP). That's not to say that you have to be doing XP to do refactoring. The refactorings described in Martin Fowler's book are equally useful in a non-XP context.

Rest of the review at: http://www.softwarereality.com/reviews/refactoring.jsp

Scaling in Games & Virtual Worlds by Jim Waldo, Sun Microsystems Laboratories

"Online games and virtual worlds have familiar scaling requirements, but don’t be fooled: everything you know is wrong."

"What makes online games and virtual worlds interestingly different are the very different requirements they bring to the table compared with these other domains. The interactive, low-latency environment is very different from grids, Web services, or search. The growth from the entertainment industry makes the engineering disciplines far different from those others, as well. Solving these problems in this new environment is challenging, and adds to our general knowledge of how to write software on the emerging class of multithreaded, multicore, distributed systems."

- Jim Waldo, Sun Microsystems Laboratories

Read more at:
http://queue.acm.org/detail.cfm?id=1483105

Friday, March 06, 2009

Over 100 million video views per day -- Ever wondered about How You Tube architecture scales?

YouTube grew incredibly fast, to over 100 million video views per day, with only a handful of people responsible for scaling the site.

How did they manage to deliver all that video to all those users? And how have they evolved since being acquired by Google?

More at:
http://highscalability.com/youtube-architecture

Some amazing stats I learnt:
  • Supports the delivery of over 100 million videos per day.
  • Founded 2/2005
  • 3/2006 30 million video views/day
  • 7/2006 100 million video views/day
  • 2 sysadmins, 2 scalability software architects
  • 2 feature developers, 2 network engineers, 1 DBA

Couple of Key points:

Keep it simple!
Simplicity allows you to re-architect more quickly so you can respond to problems. It's true that nobody really knows what simplicity is, but if you aren't afraid to make changes then that's a good sign simplicity is happening.

Shard! ( http://en.wikipedia.org/wiki/Shard_(database_architecture) )
Sharding helps to isolate and constrain storage, CPU, memory, and IO. It's not just about getting more writes performance.

For the ORM/Hibernate enthusiasts

Hibernate uses various cache implementation to optimize data read/write performance. This can lead to substantial performance gains. If used the wrong way it can however result in serious performance problems.

As seen in many real world use cases, Hibernate caches are often used inappropriately due to missing understanding of their inner workings and dynamic behavior.

A current series on the dynaTrace Performance and Architecture Blog discusses this topic and provides deep insight into Hibernate Cache behavior.

http://www.theserverside.com/news/thread.tss?track=NL-461&ad=689530&thread_id=53716&asrc=EM_NLN_5941652&uid=2966464

The eBay Architecture - Lessons from history

Architectural evolution to handle the present load of 26billion SQL executions a day.

It’s a complex engineering problem to address requirements of: Availability, Reliability, Massive scale, security and flexibility..

http://www.addsimplicity.com/downloads/eBaySDForum2006-11-29.pdf

Food For thought

Most of the stuff listed below is learnt by many of us after going through some painful experiences.

Good - someone collected them!

Following are a few that resonate with many of us for sure:

· If there is only one solution, get a second opinion

· Take responsibility for your decisions

· Record your rationale

· Dont Be Clever

· For the end-user, the interface is the system

· Great software is not built, it is grown

· Shortcuts now are paid back with interest later

· Control the data, not just the code

I would say, these are food for thought for every one of us – not just software architects.

http://97-things.near-time.net/wiki/97-things-every-software-architect-should-know-the-book

Egoless Programming

Most of us heard of it -- Good to remind ourselves.

If you haven’t – Welcome to the world of Peer Reviews!

http://www.mikebernat.com/blog/Egoless_Programming_-_Developing_Without_the_Attitude