Monday, May 15, 2006

Design Patterns

Patterns are just capture of the common behavior of designs. One of the good things about patterns is that once identified and given a terminology then it will be easy to for developers to communicate. Another advantage is that if you cannot think of any good way for improving the design then you can start by going through the patterns that might be relevant. Of course in the good days you will be creative and come up with great ideas - some of these could be just a variation of a pattern - or maybe some could constitute a new pattern if you could identify it out in the first place.
I don't believe we should use patterns for the sake of using patterns (i.e. leave by pattern which I think some developers are being - bindly just using patterns), patterns should be something we go back to (like the rule of thumb) when we have trouble with finding a good solution.

At the end of Kent Beck's TDD book, Martin Fowler have a comment that says that patterns are half -baked, and the rest needs to be customized to your use - thus don't use patterns blindly.

Test Driven Development

Read this book from Kent Beck recently, called Test Driven Development (TDD). There has been a lot of interest in the so called Unit Testing, where the developer are responsible for creating the test for the "unit" they are implementing. What a unit is is arguable but the general rule seems to be per class object for OOP development. TDD is an approach for developers to implement such unit test based on a "test first" philosophy. Create the test, get the test to work, then refactor to generalize the software and the test itself. Thus the programmer will be interleaving between development of the software and the test.
Kent's TDD approach is red bar, green bar, refactor. Red bar is when the test is not passing through thus the programmer should do whatever (dirty fix) to get the test to pass - that is getting to the green bar. Once the test is working then you have to refactor your code to work for the generalize cases (removing "duplication" is his term). I was amazed that this approach resembles my own natural approach to programming. The difference is that Kent is formalizing it into a discipline (habit) while I do this informally and without reusable test cases. Thus my testing effort during my programming was wasted. The hardest thing abut TDD is that you have to spend a lot of time thinking about the testes and also the need to refactor it as the program is refactored. I still have not tried the TDD but I have plans to try it out to see for myself how whether the effort to create the test is high and whether it is worth the effort.
Another of Kent's arguement is that TDD can help drive the design of your software (Object classes in particular) -- this is because you are getting your hands dirty and playing around with the object -- trial and error like style. Sometimes that is very true as there are times when you just cannot think of a good way to start thus the best way is just to start whatever - even if it is a bad design. This helps you to start thinking and find out the details of the problem. If the result happens to be bad then throw the code away - at least now you know what is better!
Software engineer is a discipline so it makes sense to discipline your habit of development - only if it suits your approach to programming. Everyone is different so do what you will but just make sure it improves the quality of your software.

Sunday, May 14, 2006

Web Technologies - AJAX

To date I am pretty outdated with what is going on in the web programming world where there are just a mixed of too many languages doing the same thing......same thing? Well, that was the wrong perception I have and reading up on AJAX gave me an insight of where the current direction of web technologies are heading.
The old world of web technology (web 1.0) I lived in was more about thin client - fat server approach where every change requires rendering a new page from the server. To improve on the features of websites, java applets or javascripts, was introduced that provided more work to be done on the client side (browser). All these technologies was to make the page feel more fancy and a better GUI. The current advance in web technology is to using the client-side script as a proxy that communicates with the server. This proxy will retrieve/send data from/to the server and minimize the effect of the change of data from the client's perspective i.e. client will not see a new page when only some data on the page needs to be changed. The objective is to make the page more like a desktop application - more responsive and smoother.
This all makes a lot of sense considering that there are huge computation power on the client's machine and that most of the time a web-page only need minor modifications to display a small change in data resulting from client activities. A great example is the popular Google maps where the page is pretty much the same except the maps change from user interaction.

If web service companies are to provide more diverse and powerful application services in the future, they will need more flexibilities and bridge the gap between desktop applications and web service applications. With Internet speed getting faster and faster, it is highly possible that server will only become a source of data and all the extra work done on the client side scripts.

I wonder if there will be a time when Internet is so fast and reliable that the browser will do nothing but redirect mouse activities and display images from the server. Thus the whole page is just an image that the server will understand. This is an extreme of thin-client and super fat-servers. This might be the way to go for mobile devices where the processing compatibility is limited. I don't think the responsiveness will ever be as good as client-side processing though.

Prepaid VS Contract

Looking now for a new cell phone number. The choices are either a new contract plan or a prepaid account. The good thing about contract is that you get a new phone and good amount of calls per month ($40 ~ 300 minutes) - but you might not use that much at all AND you are tied up for 24 months. Prepaid on the other hand gives you flexibility as you can average out your use over months + you paid only as much as you call. But the disadv of course is that you will need your own phone + the call costs are higher (~25c per minute).

I am not a big cell phone user and don't talk much over the cell, so I guess I might be better off with a prepaid account and using my existing cell phone. The new phones that are out at the moment is not terribly attractive so I am quite happy with the current phone I have. I can always jump to a contract when my cell calls increase or I see a nice phone I really want.

The new Samsung from T-mobile is pretty good - thinner than motorola's but it doesn't have any cool features that interest me. Razor is always a good phone, it reminds me of the Startec X that I used to have (my very first mobile phone). That X phone was just great in terms of built quality but the interface sux as well as the features. At the moment there are too many people holding a razor........I see so many people holding one in HK, London, and even in Seattle. Looking for something that is less common......Sony's W600i has wonderful features but it is a bit too thick for my pocket......still looking.

Friday, May 12, 2006

Decisions

Decisions Decisions Decisions. What differentiates people are the decisions they make and how they come to making the decisions. Lately I am forced to make some much decisions, big and small, simple and complex, easy and hard. Even small things like shopping for food can take a toll unless you know exactly what to buy and at what price. But if you narrow your choice to make a decision easy then you are missing out the world of things (e.g. the different type of food and the specials). To make a good decision, you need to gather information, compare the choices, and determine what is best at the point (e.g. what you feel like eating, the price of the items). Taking decisions to another scope, when you look for a new apartment, how will you decide? First gather information - suburbs, quality of apa, price, proximity to shops/buses/downtown/water etc. Then you fix your price range and preference list. Then you go around looking and comparing. Next you making the final choice -- IF it is still available. All this takes a lot of effort and time. I guess if your requirement is low and will just do with anything to avoid the hassle then yes EVERYTHING can be easy. But if you have requirements and want a optimial choice (well realistically a good choice) then there is a price to pay - especially when you don't want to regret on your decisions - regret is a mental toll in itself.
Even when you settled on the apartment, then you have to think about whether to get a land line, what internet package to get, what furniture or houseware do you need? And so on...........
What about decisions you have to make at work? Decision about your career? Decision about your financial investments? Decision about your 401k?

Everyday we have to make decisions, the more we have to make the more mental effort that goes into it. Sometimes I just come home and not what to "think" or use my brain -- turn on the TV and away the brain goes.

Decisions are just all around us, especially when you start growing up and become more independent. That is why childhood can be so sweet, my decisions to make, and no regrets!

Perl and Object-Oriented

Lately at work I have been doing quite a lot of Perl coding (and reading other people's code). One thing I find is that Perl is a very expressive language, there is a lot of ways of doing the same thing, and rightly so because Perl is a scripting language design to be just that. Now when OO design has started to heat up (years ago) people have started to incorporate OO into the language. All these advantages of OO (encapulation, inheritance) require a lot of constrains which is kind of contradiction with Perl which is designed with very few contraint on the programmer and things are allowed to fail in run-time (a lot do!).
My current conclusion is that Perl should be left as a powerful scripting language and leave the OO stuff out to other languages which are much better at it. I feel that OO is best at the lower level than where Perl is at -- trying to pull OO up will just pull Perl down.

There are probably a lot of people that will go against me on this but at the moment, I am just not convinced of OO Perl.

Fedex weird tracking messages

Having blogged for a while lately, was busy at work and my intended move to a new apartment. The topic of this post is about Fedex tracking system. I managed to get a good deal for an external HDD from compUSA, they regularly have some manufacturer rebate and discounts that make an item very cheap for its spec. Anyway, the first round I forgot to put in my apartment number on the address so it got bounced back to the near by Fedex facility (another city). Now after I told them the apa# yesterday, they were suppose to deliver it today and the status on the tracking system indicated: Delivered - signature not requested. But I didn't get any notice from my apartment's management so it is starting to get scary. I called my apa's management and they told me that this message could have meant that the parcel is with the driver (or city's local storage) but might be delivered to us yet.
I am not sure what Fedex is doing but I think this status message is plain misleading and creates a lot of concerns about your package going missing. If I find that a package is missing I don't wait a few days to see what happens, I ACT NOW, straightaway as the earlier you act the more chance you have of finding out what happened (the trial is still warm!).

I really hoped that the parcel will come by tomorrow, it will ease my concern and also ease my storage problem............coincidentally my other external HDD (2.5in) case's USB connector fell apart, guess you get what you pay for (cheap case)!

Thursday, April 20, 2006

H1-Bs

Was having a chat with my manager recently about H1-Bs and fast they are being used up. I was in US in December and found that the quota for the new year (starting October) has been exhausted already! That's only two months! It seems that it is easier for larger companies hire with H1-B since they are allocated a batch of them which is also used as soon as they recieved them (they normally accumulated a backlog of new hires waiting for the visa). Considering that the quota is only 65,000 for 2005 and that H1-B are used across all tech industries, it is very easily reached by the appetite of the US economy. Big companies like Microsoft, and Amazon really need the visas to fill up their new positions or refill turnover positions. Alternatives are to hire Canadians, Mexicans, and recently Australians where special work visas are available.
For small companies or startup, they are more reluctant to hire people that require visa sponsorship as there is a overhead cost for applications, and the high delay before the new hire can start work. Also small companies are less likely to sponsor green cards as it is also quite high in cost ($5000 application fee + lawyer cost).

It was lucky for me as the E-3 visa for Australians have just taken effect when I wanted to work in US. The cost for the visa is just a normal visa application fee (~$100-200) compared to the cost for H1-B ($500-1000). The speed for the application and paperwork is also quite fast - took me only about 1 month from getting an offer to starting work. However, I think your company's name, lawyers, and your qualifications will take a difference in how fast you can get the visa stamped.

Some people will argue against giving out visa to protect local jobs, but the problem is that there are limited local talents compared to large number of demand for them -- and there are limited talented people who are willing to relocate. The result is that you either rocket up the salaries (increasing turnovers), or you hire mediocre people - compromise your competitiveness, or you satisfy some demand from foreign talents. If you look at the salaries, and the cost companies are willing to endure to relocate them to US ($10k+ easily for the visa applicatons, lawyers, rentals etc), they are serious about getting in talented people. For jobs that does not need talented people, they are outsourced to India!

Auto Insurance

Was looking around for auto insurance at the moment and it seems like my choices are quite restricited considering that some insurance company requires US licence or Social Security#. At the moment I have niether of both. Companies such as AAA and Progressive were willing to insure me but the premium is quite high, that is, nearly $900-1000 for 6 months with no collision coverage (for a 10+ year old car). Even though I have an Australian license for over 3 years and also over 25 years old, the premium is high as they don't recognize foreign licenses and that you have no previous insurance. They told me that it will take a year after you get a US license to get lower premiums. But I think it is possible to get a bit lower premium by first getting an insurance policy somewhere then get a quote with the situation that you are already on insurance -- they normally only provide competitive quotes this way!

Auto Insurance

Was looking around for auto insurance at the moment and it seems like my choices are quite restricited considering that some insurance company requires US licence or Social Security#. At the moment I have niether of both. Companies such as AAA and Progressive were willing to insure me but the premium is quite high, that is, nearly $900-1000 for 6 months with no collision coverage (for a 10+ year old car). Even though I have an Australian license for over 3 years and also over 25 years old, the premium is high as they don't recognize foreign licenses and that you have no previous insurance. They told me that it will take a year after you get a US license to get lower premiums. But I think it is possible to get a bit lower premium by first getting an insurance policy somewhere then get a quote with the situation that you are already on insurance -- they normally only provide competitive quotes this way!

Thursday, April 13, 2006

Best Job in America

A friend forwarded me an article from CNN about the best job in America. Guess what? The top place is Software Engineer which was considered based on salary level, stress level, Ease of entry, and Interest. Somehow they seem to think that you get to do a lot of creativity stuff in software eng but in reality, most don't have much room to do creative things. But one comment they got right, it is not a job for everyone, especially if you do not like programming.
It is quite amazing how good the pay is for fresh graduate software engineers are compared to other engineering jobs. Software engineers get a head start in pay level but eventually they will lead to about the same level of pay for the top jobs.

On the flip side, CNN ranks job like Architect and Computer Scientist very low since they start with low pay, and takes a long time to get the pre-requisite for the higher earning roles (Architecture license and PhD respectively). The latter one I totally agree. Since the .com burst the research side of computing is not what it used to be anymore. There are still a high supply of PhD graduates compare to the limited opportunities in the industry. The academic positions (assoc professor) are the hardest to get into as the turnovers are very low and new positions are very limited. Competition is very fierce and even if you get in, it will take you quite a long time to get tenture. But for those with the passion for research, the hurdles will be enjoyable.

What is not on the top ten list seems to be well respected jobs like Doctors, and Lawyers. I guess the stress level and the "creativity" components pull them down. The perception of the best job would probably depend on what you properities are important to you. If you want respect, status, power, then software engineers should not be anywhere near the first place. For those with interest in software development and a good salary, it is indeed a great place to be.

Wednesday, April 12, 2006

Bad Documentation a Norm?

Was talking with people from other software companies and it seems that bad documentation is basically the norm in the industry. It is either very outdated, or it is spread out in bits and pieces, or it is non-existent (close to anyway). However, it is good to know that I am not the only one frustrated about the situation. Amazon is using wiki quite a bit for "informal" documentations, and I heard that some parts of Microsoft is also starting to use it "informally". The wiki model is pretty good in terms of "informal" information that are contributed by the community. Wiki is written and updated mostly by the developers or the people with a direct interest on the topic, so it can be quite a useful tool. It should only be an "informal" tool, one that complements the formal documentation. The problem comes in when wiki's documentation becomes more relevant and update, and developers start to "depend" on it more than the formal documents. Wiki is a good tool but when used in the wrong way, it can cause bad habits across the development community.

Should Wiki replace formal docs? No! I hope not anyway. Trust developers to write documentations on their free will, is like trusting your kids to do their homework by themselves.

This raises another problem, the existents of too many documentation points where information is not consistently updated in either. That is, bits and pieces are updated here and there, and at the end it just becomes a nightmare. Putting the same piece of information on two places are just duplicate effort, and how many are willing to do that? This point is the missing link between formal documentation system and the informal documentation system. How can you cross organize information when it is updated on either one of the system? Maybe in the future some startup will come up with a great solution to the problem!

US Banking System

Had a few run-ins with the US bank system lately and I am very impress by their system at all. Maybe I am just spoiled by the good systems in place in Australia and Hong Kong?
First issue I am having is with credit cards. It seems impossible to get a full credit card if you do not have any credit history. On the other hand, college students could easily get one (low limit) without prove of any capability to pay back.....maybe they are betting on their parents to pay back? Compared to someone with a job and decent salary but without credit history, are college students less risky? For someone a decent job, would a line of $500 credit be that risky to the banks? I just don't understand the logic, maybe the statistics is defying logic or maybe it is just the beaurcracy that is defying logic. Either way, I will have to be stuck on a "secure" credit card for a year at least (the ones where you have to place deposit).
The second issue is with their inter-bank electronic transfer system. Seems to me that they only offer two solutions: write a check or wire transfer. Wire transfer is immediate but cost a lot (someone transfer me an amount and I get charge quite a lot for it!) while check is a manual process that takes ages to liquidate. Why isn't there an electronic solution that takes a few business days but cost considerably less? Combining this feature with online banking, that's what I call synergy and improvement to money movement within the economy. Maybe I should look for a bank with *free* wire transfer.......but I feel sorry for the person on the other end that does not have *free* transfer receipt.
The final issue is how bad foreign American Express traveller's cheques are treated in US. It is fine if you go to an American Express branch but if you try to cash some from a bank, you will have problems. Especially if it is not written in US currency. I had quite a lot of bad experience with AMEX cheques at US Banks.......just got a few bounced lately.....don't recommend buying the cheques when they come over to US. Better to use ATM or credit card.

Sunday, April 09, 2006

Rental Prices

Did some more serious search for apartment (1-bed) prices in the Seattle area. It seems like a decent one in a good neighbourhood will cost about $600-700 dollars at least. The cost within 20-30 minutes normal traffic drive is quite consistent in this range. I guess it is realistic to try find one at about $650, preferrably one with a nice bathroom and decent facilities.

It was of a friend to drive me around the lake washington area this afternoon to check out the area. It seems that the Fremont, U-district, and lower Capital Hill area are a good choice. I personally like Fremont more as it has several good properties. One is that it seems like a relaxed but not "empty" neighbourhood. Second is that it is next to Greenlakes and also near the canal, two nice places to hang out in the weekends. Third is that it is there is a Burke Gilman bicycle trial that provides a dedicated road-space for cyclers from east to west - seems like a great exercise option, even would be good for jogging. Fourth is that there is quite a good number of buses to the downtown area. And finally, it is easy driving distance to the U-district or broadway which seems to be good places to hang-out at night.
U-district is also a good choice but it is just crowded with students, not something that you want unless you are still into the college life-style. Capital Hill seems to be the happening place for the young and the single. I prefer hanging out in the area rather than living there, similar to working in downtown but not living there. To an extent, Fremont seem to resemble more of my lifestyle in Sydney so I guess that is another reason I like it so much. Lets see if I could find a good deal in that neighbourhood.

Miss Call

Saw an ad of a Miata that sells at $5.5k. It is a 94 model with about 75k mileage with a clean title. Was planning to check out the car this weekend, but they sold it just on the friday. I guess that car was just not meant to be mine. The problem now is to look for another one that will look like a good deal..........the seconds market in Seattle is quiet at best.

Cost of Healtcare

Was asking around before and not many people knows about the cost of visiting a doctor around here. The problem is that most people are still on the traditional coverage where the cost structure are not transparent to the patient. After doing a bit more homework, I found (via some healthcare provider website) that the cost of seeing a doctor typically cost between $50-$90 for a "mid-level" diagnostic or $60-120 for the "high level" ones - that is in the Seattle area (don't think it includes tax). But also found that they seem to charge more (150-20%) if you are new to the physician. So my previous guess about the cost was quite realistic.

The coverage of the in-network system for the HRA seems to be pretty good for both doctors and hospitals. Looks like there is nothing to hold me back from taking on this plan.