I have been thinking about reusability, maintainability, and scalability quite a lot these days.

Why is reusability better than Copy-Paste code?
Reusability allows multiple developers to share code or assemblies (libraries).  It improves productivity. It improves maintainability because there is a lesser code-base. Reusability can be promoted by base classes or NuGet packages.

When is maintainability better than reusability?
Some developers get obsessed with reusability to compact the number of lines of code. Reducing the  number of lines of code does not necessarily make it maintainable. Some engineers use cryptic code and make the code less readable. Another reason why the code is less maintainable is the use of Reflection to enforce generic behaviour.

Why is scalability better than reusability?
I had a discussion on scalability and reusability with my colleague. Why do we have to worry about scalability? Most popular websites receive atleast 1000 requests per second. If all the processing need to happen at the web server layer, then we need quite a few web server. Also, during peak load conditions, the web server will be down even for simple requests or critical requests like payment processing.

So, what do we do? We isolate the request intensive portions of the request processing into a separate layer. This layer can be called the business component layer or the service layer. The service layer handles the resource or processing intensive operations of the requests. The service layer can be scaled by adding more hardware. Moving some of the processing power to the service layer will free up the web server layer for simple requests like cached pages, contact pages, and critical processing like payment processing. In this way, we build a scaled architecture, the foundations of any robust web site, which serves more than a 1000 requests per second.

This is true of most ecommerce sites operating in .NET and J2EE platforms. I am sure any website operating in the new Linux Debian / Nginx platform will have reasons to worry about scalability at some point of time.  In any case, scalability is better than reusability.

Reusability, Maintainability, Scalability

Leave a Reply

Your email address will not be published. Required fields are marked *