Thursday, February 16, 2006

Separation of Roles

As a software developer, sometimes I come into situation when I have to code in all layers/tiers of the application. In the web development context using Microsoft technology (where most of my experience is in), it means writing code in Javascript, deal with divs and tables in HTML, write business logic in C# and all the way down to writing stored procedures. Working in this manner is nothing bad, since I can get the full picture of the process, from the moment the user input the data to the data being saved in the database. Quite surprisingly, this happens in most of the companies that I have worked for, regardless of the project size.

The multi-responsibility role that a developer has to bear is quite common nowadays. Take a peak at the online job posts and you can easily notice that most developer job openings always look for the all-rounder candidate who can do from A-Z and has experience working in all tiers.

I agree in a small development project, we don't have the luxury of proper design and planning. Thus work items are actually screens from a prototype, and often a single developer is assigned to code the screen from UI tier to database tier. However, when the project gets larger and more developers join in, I suggest developers are split into several distinct roles:

1. UI/Front-end developers. These people are most experienced in event-driven nature of UI programming. In the web development projects, these are the type of developers who are fluent in client side scripting, prefer to hand code HTML code, fully understand the difference between a listbox and a dropdownlist, etc.

2. Middle tier developers. These people deals with business object classes, web services, and data access layer classes.

3. Database developers. They live in different side of the world than the other two types of developers. They speak only in TSQL. Their tools is Enterprise Manager and Query Analyzer instead of Visual Studio.


Those projects who have clear separation of roles enjoy the following benefits (which are derived from my experience working in such project):

1. The right man on the right place. Almost like a cliche, but it is true. Most developers will say 'yes' they can work in every tier, but in fact they are more effective working in one tier compared to other tiers. A developer's past experience can tell much about this. Face this fact: developers who write well in object-oriented Javascript may not effectively write a business object classes in C#, or even write a sophisticated stored procedure in TSQL with proper error handling management.

2. Promote separation of responsibility on each tier, an important concept in object orientation. Alhough only by a proper design a truly separation of responsibility can be achieved, having different developers on each tier will ensure there is no code that sit in the wrong place because they are written by different developers.

3. Each tier can be planned and progressed independently. For example, after the database design is done, the database developers can start working on the stored procedures. Meanwhile, once the class diagram is done, the middle tier guys can start creating classes. Usually, the UI developers will start later and finish later as they have to work on the prototype and go through iterative release-feedback process with the client.

4. Easier to implement programming standard and convention. Take this example: Naming convention for strongly-typed C# is different from loosely-typed Javascript. Syntax in TSQL are more effective in resultset, while C# developers are more used to loops.

5. Promote communication. In my previous company, developers on the same role sit next to each other on the same corner, thus promoting communication and code reuse among them. In a 20-people team which everybody works on the stored procedures, not everybody know what other people have done.


As I mention earlier, the separation of roles may not be suitable for a small project where resource is limited. It is also not an all-good solution. The following are some disadvantages:

1. Developers may know understand the whole picture as they only work in one tier instead of all tiers.

2. Harder to track bugs and performance issues that run across tiers and other performance issues because of point no 1. If bug tracking is not manage properly, developers may start finger pointing on each other.

Wednesday, February 15, 2006

GPL vs LPGL

The company I am working on is heading for the annual audit process. Apart from the security and compliance issues that the internal auditor needs to find, the auditors will find whether we have unlicensed and underlicensed applications. Underlicense situation will rise if the current licenses we have do not adequately cover all the software installation or deployment.

In our discussion, we come across several licensing schemes and surprisingly nobody has a clear understanding about them. Two most prominent licensing schemes: GPL (General Public License) and LGPL (Lesser GPL) seems to confuse many as they look similar but actually are very different.

The GPL license allows free use and modification of the software, as long as we credited back to the original author and release the application (that utilizes the GPL'ed software) as open source. This is a major road block for commercial project to use GPL'ed software.

On the other hand, the LGPL license does not require the application to be distributed as open source and thus can be used in a commercial application. This licensing is increasingly popular among software libraries. However, there is an extra complication: any modification or addition (and even wrapper) to the LGPL'ed library must also be released under LGPL/GPL scheme. Other parts of the software which do not use the library are not affected and therefore can be released under any licensing scheme. Therefore, in practice, if we create a wrapper class of the LGPL'ed library, or create a class that inherits from the library, then our library code must be released under LGPL scheme. In the .NET project, as a class library is compiled into an assembly, then the assembly and its source code must be released under LGPL. Not a pretty situation for a commercial project!

In summary, whenever your software project needs to use a third-party library/application, make sure you understand its licensing very well and judge carefully whether it fits with the licensing of your software.

Friday, February 10, 2006

A del.icio.us way to search

A simple idea turned into a great web application, that's what I like about del.icio.us


Del.icio.us is an online bookmark repository. Instead of adding your favourite urls to the browser's bookmark, you can post them to Del.icio.us and access them from any computers on the web. Simple concept, but that's not all. You can also search what other people bookmark and see how popular those bookmarks are.


Again, the power of virtual community is used here to leverage the usefulness of the site. The more people use Del.icio.us to post their bookmarks, the bigger the bookmark repository, and more useful search result can be returned. I believe Del.icio.us is waiting for that critical mass moment to happens, before they can truly reap the profit of running this service.


Alas, Del.icio.us' infrastructure doesn't seem to cope well with the site growth. In the past few weeks, the site was down several times due to power failures in their colocation servers. These issues should be taken care seriously before people giving up and turning to alternative sites.


Infrastructure issue aside, it is a great experience to use Del.icio.us on my daily surfing activity. I use the site to:

  • Manage my bookmarks. I surf at work and home, so having a single bookmark repository is really helpful. Assigning tags also helps me to categorize the bookmarks based on the keyword, which I find is easier to remember than file system-like structure in the classic bookmark system.
  • Share my technical bookmarks to my colleagues more easily. Just point them to my Del.icio.us url. No need to cut and paste the link in the email or IM. However, privacy is a big concern here because they can also get my personal bookmarks
  • Do search on the internet. See what other people bookmarking! Think Del.icio.us as an alternative to Google search.
  • Learn about the web interface... simple but powerful. More about this in the next post.

Other that privacy issue, my other concern is if some people start to misuse the system by posting urls for advertising rather than their actual bookmarks. More and more people post the same url, the more popular the bookmark is. This will taint the usefulness of the site as an alternative way to search the Internet.

New Year, New Life, New Resolution

One of my new year's resolution is to blog more actively. Looking back at my first post in April 2005, it was 10 months ago and there is only 5 messages so far. What a shame... I should do better this year!

In 2006, I also start a new life, as a married man to a lovely wife Josepha. It has been about a month since we moved from Novena to an HDB flat in Braddell. Initially, the flat was pretty empty. Only basic furnitures like bed, L-shaped sofa, washing machines and fridges are left by the owner and previous tenant. But after a few trips to IKEA shop, we finally furnished our unit to a comfortable state.

Now, I have a place to put the laptop and YES, we have a broadband Internet connection at home. So let's start blogging :)

Saturday, June 25, 2005

Tech Ed 2005 Webcasts

Recently, Microsoft released a series of pre-recorded webcast from Tech Ed 2005 in Orlando, Florida. The pre-recorded material is more suitable for people living in a very different time zone from United States, like me in Singapore. I don't need to wake up very early in the morning to join a live webcast broadcasted from US. The available webcasts are assorted selection of hands-on preview of the upcoming VS.NET 2005. Although we can discover ourself with Beta2 products, watching the experts can give us a more complete picture of what features are available and how they link together.

I found watching webcast is a fun way to learn. It could not replace the experience of attending a live event by yourself where you have the opportunity to interact with the speakers, feel what other people are feeling (interesting, boring, sleepy, etc.) and of-course enjoy the snacks provided. :) With webcasts, you can skip the boring parts and just jump to the one you are interested. It is kind of attending a zipped-version of presentation.

Link to Tech Ed 2005 Webcasts

Tuesday, June 14, 2005

My seat is secured

My seat for Bill Gates Live conference is finally secured :) This afternoon, I received an email from the organizer, stating that my registration is confirmed. An admission pass will be mailed to me, which I need to bring on the day of conference along with my photo id. I believe the security will be beefed up on that day, considering the popularity of Bill Gates.

Wednesday, June 08, 2005

Bill Gates Live

Bill Gates will visit us in Singapore for an hour talk held at Suntec Singapore International Convention and Exhibition Centre on Friday, 1 July. I am so eager to see him in person. Everyone who wants to attend must fill a registration form online. At the very bottom of the form, there is a tough question: "If you had to ask a question to Bill Gates during the Bill Gates Live Seminar, what would the question be?"

Wow... the author must have watched 'Contact' movie the night before. In the movie, a question like this was asked: "If you had to ask a question to the alien, what would the question be?" Similar huh?

Finger crossed I can get a seat as the demand for this free seminar seem to be overwhelming :(

Tuesday, June 07, 2005

AJAX DropDownList

Just recently, I published a new article in CodeProject about implementation of AJAX (Asynchronous Javascript and XML) in a dropdownlist.

AJAX DropDownList is a custom control, inherited from System.Web.UI.WebControls.DropDownList. What differs this control from the normal DropDownList is the ability to fetch data asynchronously in the background without requiring any postbacks. Thus, an AJAX DropDownList can be dynamically populated from the client side using Javascript. Moreover, AJAX DropDownList implements Observer pattern to 'listen' to the change event of another AJAX DropDownList, and to 'broadcast' its change event to the other AJAX DropDownLists. This feature allows us to create a group of dependent dropdownlists, where a change in the first dropdownlist will trigger change on the second dropdownlist, and subsequently trigger change on the third dropdownlist, and so on...

Please read
the article in Code Project for more details.

Friday, April 29, 2005

Export to Excel bug in SQL Reporting Services

This is my first blog message. Let's me start this habit by sharing a tip I found while working with SQL Reporting Services 2000 SP1 today.

I deployed a report to a server. The report works fine when previewed in HTML and exported as PDF. But when I export to Excel, the following exception occurs:

Reporting Services Error
--------------------------------------------------------------------------------
Exception of type Microsoft.ReportingServices.ReportRendering.ReportRenderingException was thrown. (rrRenderingError) Get Online Help
Exception of type Microsoft.ReportingServices.ReportRendering.ReportRenderingException was thrown.

Stack empty.

After doing a bit of investigation by removing one by one the controls that cause the exception, finally I found the problem.

Let's say I have two textboxes: textbox1 and textbox2

textbox1 contains this expression:
=IIF(ReportItems!textbox2.value IS NOTHING, 0, ReportItems!textbox2.value)

textbox2 is located inside a table footer and contains the following expression:
=SUM(Fields!Payment.Value)

It is possible that textbox2 contains NOTHING if there is no row in the table. As a safeguard, I check for NOTHING condition when I copy the value to textbox1. This sort of situation cause exception when the report is exported to Excel.

An easy fix to this bug is by adding trivial calculation. In textbox2, I change the expression to:
=SUM(Fields!Payment.Value)-0

Adding '-0' will force the textbox to display 0 if the result of SUM(Fields!Payment.Value) is NOTHING. The same result you can achieve by adding '+0'.

Then in textbox1, I remove the safeguard as I am sure that the textbox1 will contain 'some' value. The expression is simplified to:
=ReportItems!textbox2.Value

By doing this, I can export the report to Excel without throwing any exceptions.