Wednesday, January 30, 2008

Basic Form/UI Object

Object Oriented Programming(OOP) is common in todays programming language, such as .Net, Java and C++. Therefore, it is common to use OOP to solve business logic problem via creating business object(BO). On top of that, database design also cater for OO in order to easily interact between data object and BO. Mapping BO to UI/form somehow has not been taking too much consideration. Here, I would like to share the basics(I think) form object, which I learn from my senior (Danny Lim) in my working experience and I find it worth sharing.

First, business process are stored in methods instead under events. E.g. Click on save button and insert a new record inside that event method. The appropriate way should be click on save button and call the save record method. This way the save record method can be shared by others and the UI is only for interaction, not for operation. Therefor, the UI only capture the user input and pass/read value to/from the BO. Below is the list of methods and properties of the form object

1.Public Property FormState as enum
After the form object is created, the FormState will be assigned with enum value of Add, Edit or View(or more if you want to). The FormState is for set up the UI control. With Add state, all controls on the form are cleared. Edit, value are load to the control. View, controls are disabled for reading. This also mean one form is used for 3 different operation. (Delete does not require a form, usually)

2.Method SetControl
Based on the FormState, the controls will be set accordingly. Example: Add state, all controls are enabled. Edit, partial controls enabled. View, all disabled.

3.Function ShowForm (business object) return boolean
When the form object is created and called, BO is passed into for process. The return boolean is to confirm the process is successful.

4.Method ObjToUi
Object value is mapped and passed to UI controls.

5.Method UiToObj
UI control value is passed back to BO.

6.Function Validate return boolean
After user click on save, value on controls will be validated and business object validation logic stored in the object will be called and verified.

Update: Sample file has been re-uploaded to http://www.mediafire.com/?lxy9bmmnnsz


Thursday, January 17, 2008

End of Window XP

The date fall on June 30, 2008. Microsoft will stop selling Window XP as according to Windows Life-Cycle Policy. Support will end on April 14, 2009. This mean no further security updates or hotfixes will be automatically download to you computer on April 2009 onwards.

Sad but it's a fact that somehow people have to cope with it. Below is a list of what would happen after the support ends.
  1. Continue using window xp: There might be a risk of having your data getting lost or stolen due security vulnerabilities and computer bugs in the future. Or use window xp in offline environment. That would cut down the risk factor by half.
  2. Upgrade to Windows Vista: There are good feedbacks from some of the user but mostly I heard are the bad ones. Therefore, try it before upgrade.
  3. Move to Linux or Macs: Install Linux OS in your current machines and start to get familiar with it. Or buy a Apple Mac machine on your next computer machine, if point 2 is not your option.
  4. Finally, sign up a petition: Go to Save Windows XP, sign up the petition so that the people in Microsoft would reconsider to prolong the support. However, I would doubt it since they not earning money.
As for me, I will go for option 3 because I'm quite happy with my Ubuntu.

Update 2011: Support ends at 2014
http://www.myce.com/news/microsoft-were-pulling-the-plug-on-windows-xp-in-3-years-48249/

Refererence: 12,500 sign 'Save XP' petition, How-to get Windows XP past the June 30th cutoff (or not)

Sunday, January 13, 2008

IIS for Windows XP Home

When I found out there's no IIS for Window XP Home, I was kinda regret for not getting the Window XP Professional. This has lead me hard to pick up ASP.Net (just for fun) as there is no way to host my asp page in my laptop. I even went all the way to check out apache and hope there is a module for it to support ASP.Net 2.0 but it seems the community has dropped the project.

Fortunately, as I was browsing thru this book Build Your Own ASP.NET 2.0 Web Site Using C# & VB by Cristian Darie and Zak Ruvalcaba, there is an IIS for Windows XP Home called the Cassini. That's good news for me because I always wanted to try out ASP.net.

Paper card system

On todays evening family dinner, we went to one of the famous Chinese restaurant in SS2 area. The business of this restaurant is so good that it occupied 3 shop houses, span across 3 floors and each floor can served around 100 customer. By the time we reached there around 8 PM, all 3 floors were almost fully occupied. My mom-in-law point towards the kitchen, which is a open concept and separate by a glass window, said, “Look at those staffs, there are like 20 of them”. Yup, she was right and all them were busy preparing and cooking the meals.

On the main entrance, a receptionist greeted us and asked how many person will be dinning. Then, he gave me a card with 2 numbers. One on the upper right corner stated a 10 with circle around it and a number at the center of the card. The center number was table no. 325 and the circled number was the size of the table. A waiter showed us to our 10 seated table and the card was taken away. I was shocked. For a business with this size, their internal system are not run by computer but by paper card.

So what's the big deal?

The first thing came into my mind is: How do they keep track the vacant tables of each floor? How do they know they assign the right size of table to the right amount of people? The receptionist can't look through walls and tell which size and tables are vacant. The workers or waiters just can't go and tell the receptionist every time there's a vacant table because they might forget and time consuming. The receptionist can't count on the bill that has been paid to check the tables because people might paid the bill but stay for chatting for couple of minutes.

Therefore, the card holds a valuable information, which is the 'table status'(on my guess). As long the card (I guess they are stored at each floor) is not in the receptionist's hand the table is then assume as occupied (assume no card missing as well). The card is pass back to the receptionist once the table is ready and he will flip through the cards and give the correct table size to the right group of customer.

When I first saw the size of this restaurant, I was so tempted to jump onto the conclusion how much this restaurant needed to operate using a computer system. But I was wrong, after seeing it operate so efficiently just using 3 x 2 inch paper.