Saturday, January 22, 2011

How Important the Software Architecture Is

There is a famous saying that if the base is strong the whole building is strong. The same concept applies to the software too. In my opinion, the architecture of the software is the most important building block. Architecture should be designed before the actual coding begins. The software architect should decide which pattern they should follow to build the software. There are many patterns out there we can adopt to follow in the software construction. But we should be careful that the application is not over-engineered. This can happen that you try to apply some pattern, as soon as you know about it, but that is not suitable for the subject problem. So, you should be very careful while selecting a particular pattern in your software architecture.

You should divide the whole problem into different layers. Each layer should be self contained and should the ability to communicate with other layers in order. That does not mean that the every layer should capable of communicating with non-adjacent layer. For instance, the presentation layer should not directly communicate with the data access layer. It should talk to the database layer via the business layer, in 3-tier architecture.

If the application blocks are tightly coupled, we may face some difficulty while doing unit tests. The loosely coupled classes have a major advantage over tighly coupled when the testing comes into action. The Dependency Injection is a good pattern to decouple the dependent classes. This way, your software will be maintainable and scalable and you will definitely realize after sometime.

Saturday, January 15, 2011

Selenium - Software Testing Framework

Selenium is a software testing framework primarily built for testing the web applications. It records and can create the tests for you in few clicks.

Check details here http://seleniumhq.org/

Interactive JavaScript Reference

I found this reference a very useful resource.

http://superexpert.com/JavaScriptReference/

jQuery 1.5 Beta Relased

The beta version of jQuery 1.5 has been released.

You can get details here http://blog.jquery.com/2011/01/14/jquery-1-5-beta-1-released/

Should We Refactor Old Code

Technology is growing so fast that if we do not keep us upgraded, we may stand far behind in the techno race. Every developer will agree with this that he can code a better solution whenever he looks back at his code after few months. Someone may disagree by saying that why should he touch the stable code. Let me explain this with an example.
Suppose, you have coded the following script in your SQL Server stored procedure.
DECLARE @unitPrice int
DECLARE @qty int
DECLARE @total int
DECLARE @grandTotal int

SET @grandTotal = 0

DECLARE cursorTxn CURSOR FOR
SELECT unitPrice, qty
FROM Transactions

OPEN cursorTxn
FETCH NEXT FROM cursorTxn INTO @unitPrice, @qty

WHILE @@FETCH_STATUS = 0
BEGIN
       SET @total = (@unitPrice * @qty)
       SET @grandTotal = @grandTotal + @total

       FETCH NEXT FROM cursorTxn INTO @unitPrice, @qty
END

CLOSE cursorTxn
DEALLOCATE cursorTxn

This snippet works fine, calculates the correct grand total of all the transactions and return the result to the caller. One can say that it is a stable procedure and does the job well. However, if he checks his code after few months and he has already polished his skillsets, he may call this piece of code a crap. He can easily upgrade this piece of code by using the following alternative.
DECLARE @grandTotal int

SELECT @grandTotal = SUM(unitPrice * qty)
FROM Transactions

The above code will return the same result but in a much optimized way.

So, instead of rewriting your code, do refactor your code.

Thursday, January 13, 2011

Issues with Disqus Commenting System

Disqus is a commenting system which is being used by different sites. The usage of this system is very very easy. You just need to create a site/forum thru their Admin panel, specify the website URL where you need to use the Disqus system. You can put a universal code which simply declares a couple of Javascript variables and creates and adds a javascript file reference to the DOM - head tag. I tried but faced a couple of issues:

1. The Facebook Connect login does not work properly. Although it gets you authenticated to the Facebook but somehow the Disqus page does not consider you as a logged on user.
2. The Twitter login does not work as expected, especially on IE 8.

The reason could be some deprecated APIs still being used by the Disqus. I hope the Disqus team would be able to fix these critical issues as soon as possible so we can make the Disqus commenting system on our website.

For further readings, visit disqus.com

MVC Pattern

MVC stands for Model-View-Controller. MVC is very famous software architecture which splits the whole software structure into three main domains, i.e. Model, View, & Controller. Model is related to the data model, View is basically the UI to interact with model and Controller is the supervisor which bridges the gap between Model and View. Model can be as simple as a POCO. View can be a simple HTML with placeholders to plug the data from model. Controller can receive the user's request and call proper mechanism to send the view with the model data.
In the current version of MVC3, we have a couple of view engines which are ASPX view engine and the Razor view engine. One of the major benefits to use MVC is test driven development. You can create mocks to test different areas of the whole solution.

For further details, you can visit www.asp.net/mvc

Holy Quran (Flash version)

This Flash based Quran looks awesome. Have a look on this URL http://www.quranflash.com/en/quranflash.html.

The user experience is really great.