Feeds:
Posts
Comments

So I have been working as a software engineer for about 3 months. During this period, I got involved in 2 projects (and of course several unnamed tasks): 1 uses Enterprise Java Bean, the other uses .NET with C# and ASP.  I would say ASP, C# combination is easier to work with than Java+JSP.  One of the reasons is that the .NET framework separates the presentation and logic very well. To put it simple: ASP for presentation (or view) and  C# for business logic (or control). The other nice things I like about .NET are:
- The validation controls which can nicely replaces the lengthy validation script.
- The user control can be written and reused anywhere.
- The label control and Visibility property of controls make the interactive display of content much easier to be achieved if you compare to coding  with JavaScript.

Well, let’s extend the discussion to good programming practice in general, especially in big projects which involve many developers. What I have learnt from working in medium and big development projects is that setting and following standard is important to project scaling, transferring, maintenance and development. It worth our efforts to set the standard at early stages of the project development. Some of the standards that we need to take care of include:
- Set the naming convention for every member of project group. Be consistent in naming.
- Never mix up the presentation with business logic. In the best case, a single line of business logic in presentation page should not be allowed. A good practice is to put them in separate files and make use of include, register or import.
- Minimize using of string literals. All literals should be declared as constants.
- Common tasks for all modules should be coded separately and put in a shared folder. For example, upload file, insert into database, select from database,…
- Always logging the actions performed on database or system. It is also considered a common task and is good for diagnosis.
- Be consistent in coding style. This is pretty hard to achieve because each developer has his own style.
- Never have a long methods/functions. Divide it into smaller methods if possible.
- Reuse the code as much as possible. The code can even be reused across multiple projects.

 

 

Have you ever asked yourself this question? If yes, find the answer in this article:

http://www.readwriteweb.com/readwritestart/2009/05/are-you-really-an-entrepreneur.php

Recently I did a research on what would be a best practice in web development. This first result from “Web development process” Google search gives us good insight into a good development cycle to follow: http://www.macronimous.com/resources/web_development_life_cycle.asp. The site includes a nice picture to illustrate the whole web development life cycle. However, I would like to rewrite and elaborate the phases in my own terms here.
- Requirement analysis: In this phase, we discuss with customers, do research and brainstorm to come up with all the requirements. Basically, it helps to answer the questions: What our websites will/can do? The end product is the specification documents which may undergo multiple versions and even can be refined later on in the process.
-  Web structure design: The design can be divided into structure design, layout design and graphic design. Structure design comes first in which we decide on the site navigation flow. That is to say we design the sitemap.
- Web layout design: The general layout of the site should be mostly done before any coding. Normally, there are layouts for homepage and inner pages. Remember to save the layouts as templates for reuse.
- Graphics design: This requires us to use graphical tools like Adobe Flash or GIMP to design any animation, logo, images, flash to be included into the pages. Good graphical objects will surely make our site stand out, but do not over-use them.
- Content generation: This can be done in parallel with design phase. If you are not good at writing, then you can choose to outsource this task to a better candidate. The content should be taken a good care since it will affect the overall quality of your site (and therefore its traffic).
- Coding: Here it comes your programming skill. This step will make the site perform what it is supposed to do.
- Testing: Web based applications need intensive testing, as the applications will always function as a multi-user system with bandwidth limitations. Some of the testing which should be done are, Integration testing, Stress testing, Scalablity testing, load testing, resolution testing and cross-browser compatibility testing.
- Web promotion: Ok, now your website is ready to launch. But there are many technical tricks than can help your site to get more audience.
- Maintenance: Of course, over the time, the content of the pages must be updated.  Maintenance also includes feature addition. For example, you may want to integrate a new technology into your existing site.
Take note that we already ignored several less relevant steps (but may take a huge amount of time) like environment setup, database design,… The following image summarizes the development process:

Web Development Process

Web Development Process

I wanted to build a project using LAMP, so I had to decide which Linux distro to use with Apache, MySQL and PHP. Basically, I want a free, powerful, stable OS that is good for server. I went on trying the following systems: FreeBSD, OpenSUSE, Fedora, Ubuntu and OpenSolaris. I am going to develop my project in Virtual Environment using Virtual Box, so I tested them in that environment.

- Ubuntu: I have used the desktop version for a while (in my another machine). I would say Ubuntu is very easy to install, easy to update and download softwares. It is the most popular Linux distro, so I will get plenty of support online. Since I wanted to use the OS in my server, so I looked for the server edition. Unfortunately, there is only Ubuntu server for AMD 64 platform.
- FreeBSD: Heard that this platform is good for server. However the installation process is tedious. It is all text-based and I got lost many times. Even though I got the OS to be installed in VirtualBox eventually, I bumped into another issue: I could not get the networking work in virtual environment. After few days, I gave up on this and uninstalled FreeBSD.
- Fedora: Unlike FreeBSD, installing Fedora 11 in VirtualBox is way smoother and easier. Right after the first boot, the network is up without any configuration. I would say Fedora is comparable to Ubuntu in terms of convenience. The Yum tool is just impressive. Only one command to download Apache, mySQL and PHP and took me less than one hour more to do research and make them work together. This installation and configuration process used to take me several days on Windows. So decided to stick with Fedora.
- OpenSUSE and OpenSolaris: These two candidates are not bad actually. The only reason I single out them coz it seems that I will get less help than Ubuntu or Fedora if you encounter problems due to the popularity of the latter twos.

Ubiquity wishlists

I have been using Ubiquity for half a year.  What this application can do is amazing.  However, I would wish Ubiquity to have following features, which makes it even more complete and awesome:

- More theme and layout choices for users. Moreover, users can set Ubiquity looks and appearances by typing in the commands instead of going to the setting page. For example, when we type in theme, a list of available themes are suggested.

- The Ubiquity panel should be movable. Right now Ubiquity window always stick at the left corner of Firefox. This causes me some inconvenience: Firstly, the panel may block some important information on the web page. Secondly, when we click on the page for reference, the Ubiquity window disappear unexpectedly. Isn’t it better if we can move, resize and close the Ubiquity panel just like a normal application window.

- The current matching algorithm is not so good. For example, when I want to look for Hanoi on the map. So I intend to type  in “map Hanoi city”. However, when I type up to c (e.g: map Hanoi c), the tinyURL is the first in the suggestion list and the map command is nowhere. Can we have a smarter auto-suggestion? Even better if this auto-suggestion can have some natural language processing power to suggest a right commands when users type in using natural language.

- Regarding auto-suggestion, it could be nice if the search auto-suggestion of the search command like Google is also integrated into Ubiquity.

- You can copy and paste to Ubiquity command,  but you cannot do the reverse. In many cases, we want to make use of the command results (to paste into an email, post into blog, send to friend via IM,…).  I encounter this situation many times, especially when I use tinyURL to have a short  URL for the current page, then I want to share it with my friends via friendfeed, twitter or facebook, but i have no way to copy and paste the short URL from the Ubiquity window.

- Unix users must wish to have piping of commands ans command switches. It definitely makes Ubiquity more powerful in performing complicated tasks.

- How about Ubiquity becomes a widget and people can embed it into their own site.

- When you get used to Ubiquity and make use of some common commands, you would love to launch the application from anywhere. It will save your time of opening or switching back to Firefox.

Haven’t updated this page for some time. It has been quite busy when I started working. However, during office hours, I still try to catch up with new things, in particular. I happened to read about this experiment called Jetpack by Mozilla and tried it out when I got home. Another cool thing.

https://jetpack.mozillalabs.com/

If you are very much into command line interface, you would love to do various tasks using text instead of mouse clicking.  I am using Lauchy,  a program launcher, to quickly open applications and folders in my com.  Since Ubiquity is also command line oriented and I have Firefox on most of the time I am with my computer,  it would be good to let Ubiquity work as a program launcher.  It is not hard to create a command to launches any application in your com. All you need is to  know the path to the program executable file. I already created a command to open Yahoo Messenger (which is my main IM) and  a command to open Microsoft Word.  However, making Ubiquity work for any application and any folders (with auto-suggestion)  requires some more effort.  In the end, I want Ubiquity to totally replace Launchy.  CLI rocks!!!

The link command that I mentioned in previous post requires  me to define a noun type that includes all the accessible links in the current page.  After several unsuccessful attemps, I’m so happy that I finally made my first noun type work in Ubiquity thanks to this instruction. I can even access a hyperlink in another window, not only the currently active window. The suggestion for link name works pretty well now.  Here is the updated code.

DEBUGGING : Removing the needles from the haystack.

Interviewer: “Is studying computer science the best way to prepare to be a programmer?” Bill Gates: “No, the best way to prepare is to write programs, and to study great programs that other people have written. In my case, I went to the garbage cans at the Computer Science Center and I fished out listings of their operating system.”

If at first you don’t succeed, you must be a programmer.

Programming is a lot like sex. One mistake and you could have to support it the rest of your life.

I would say one of the most impressive Ubiquity commands is translate command. It will translate your selected text  into the language of your choice and replace the original text with translated one on the page. When I wrote a command sort to replace the selected text with the text which has the words sorted I had to look at the translate command. The task turns out to be pretty easy with powerful Ubiquity API. The key points are 2 functions from CmdUtils library: getSelection() and setSelection(). After playing around for a while, I have finally made the sort command work. So if you want to sort a list of words on the page, select that chunk of text and order Ubiquity to do it for you. I believe you will get some meaningless phrase most of the time. In that case, if you want to get back to the original text, you have no choice but refresh the page (I haven’t had a command to reverse the change yet:D). The other thing is that if the selected text spans more than 1 paragraph, the replaced text will squeeze all the words together, which seems not right.
This command is probably useful when we want to have a view of sorted data number on the web. Subscribe to it here.

Older Posts »