Friday, August 6. 2010
It might take days for justifying "why not" when making technical decisions, the right way should be just explaining "why". For a simple website like this, PHP pops up to my mind instantly, without even considering about any other second choice. Therefore I don't know why not Java. For some developers, Java is not only a programming platform but also a religion.. They tend to think that Java serves all purposes. Indeed, almost everything can be done in Java, and I love it. I used to love Java simply because I was one of the believers of the religion, but now I love it entirely due to the fact that it has enabled me to make a living for the past 10 years. I am glad that finally I am open enough to accept best solutions for all kinds of problems regardless of the technologies. For example, if you want a website and all you have is a Windows machine, go ahead and code in ASP.NET.
Friday, July 10. 2009
API Design guideline by Jakob Jenkov.
Almost every application I have built in my career has had a "utility" class or package. This utility package contains small methods that are used from different components inside the application. Often utility methods are so small that they are just gathered inside the same utility class as static methods.
Indeed I've seen that kind of "utility classes" in every project I worked on or which I got chance looking into the source code. The class name usually ends with "Util", for example, DateUtil, StringUtil or simply CommonUtil.
Such utility libraries have a tendency to end up as "garbage cans" of all kinds of unrelated utility methods. As the utility library grows, your applications each tends to only use a small percentage of the total utility methods. Don't forget that as soon as any one of those small method is called, the whole class will be loaded into memory.
Wednesday, April 22. 2009
Not really mine. Almost all the code is written by the project lead, Dickson.
It is bascially a Java-based reminder software that allows us to create as many reminders as we want, and makes use of the latest Java Desktop feature like system tray notification and so on.
We just decided to open-source it right after we've got the first version done and we are now looking for Java programmers out there to add features as well as fix bugs. The source code are under Subversion control, so if you want to checkout the source code, just do:
svn co http://jvege-reminder.googlecode.com/svn/trunk/ jvege-reminder-read-only
No write access for non-member for the moment, however, highly appreciate if you send patches, please do.
For those who are only interested in using the software, just one click and you are there.
Friday, November 7. 2008
So lastime I wrote about how to modify constant data using reflection in Java, now I'm going to try to modify constant data in C, using pointer. Consider code below: int i = 0; const int ci = 0; printf("ci initial value %d\n", ci); /* print 0 */
int* pi = &i; /* a pointer to int */ const int* pci = &ci; /* a pointer to const int */
//ci = 1; /* try to assign new value to const, compile error */ //*pci = 1; /* try to assign new value to const, compile error */
pi = (int*)pci; /* cast pointer to const to pointer, success */ *pi = 1; /* no compile error, weird */
printf("ci value %d\n", ci); /* result? */ What result? Answer is undefined and compiler-dependant. On GCC C compiler, constant data gets modified, but on Visual C++ compiler, constant value remains and no runtime error, that means the line *pi = 1 has no effect at all.
Wednesday, November 5. 2008
There are at least 3 basic ways to assign value to array element in C. Say we have an integer array defined like this: int an_array[3] = {1,2,3};We can change the value of each element using following three ways (there might me more ways). 1) Most common one, using array index. an_array[0] = 10; an_array[1] = 20; an_array[2] = 30; 2) Using pointer, since array is implemented by pointer anyway. *an_array = 10; *(an_array+1) = 20; *(an_array+2) = 30; 3) Using address casting, assuming integer type use 4 bytes on your machine. This method cast the pointer integer value to integer pointer and goes from there. int addr = an_array; *(int*)addr = 10; *(int*)(addr+4) = 20; (change to addr+8 if your int is 8 bytes long) *(int*)(addr+8) = 30; (change to addr+16 if your int is 8 bytes long)
Wednesday, October 8. 2008
Lastime I talked about the command for checking out source code with CVS and Subversion. Now I'd like write about the command of Mercurial and Git. Mercurial is a source code management system currently used by many famous open source projects like NetBeans and Firefox web browser. To check out source codes from respository, follow this: hg clone <repo url> <destination> e.g.: hg clone http://hg.mozilla.org/mozilla-central/ src While concept like check out and check in is famous for CVS, Subversion and SourceSafe, Mercurial and Git use different terms for similar concept, which are pull and push. Pull is retrieving bits from repository and push is putting back updates to the repository. To pull latest copy from server: hg pull -u Git, not as famous, but the software codes that managed by it can be considered as one of the leaders of open source, which is, Linux kernel (Ruby on Rails also one of them). This thing is first created by Linus Torvalds written purely in C, and it stands for Fast Version Control System. To check out code using git, do this: git clone <repo url> e.g.: git clone git://git.videolan.org/vlc.git (getting VLC Player source code) And to get latest copy: git pull --rebase
Thursday, September 25. 2008
This article really clears my confusion on the .NET stuff. Now that I know even we are running a .NET application written with .NET Framework 3.5 (the latest as of today), underlying there is still the CLR in .NET Framework 2.0 which is actually running the app. In short, for .NET Framework version higher than 2.0, there are just some additional libraries being added, the runtime engine (CLR) is still the original version 2.0.
Tuesday, September 23. 2008
Philip Zembrod tells us that how could we improve coding productivity by writing test first. Writing unit test does make sense for things like class interface (though I've never tried this apporach), but what about the testing for UI code and component integration? For functionality and integration test, I think running test first can also bring high value. Although we are not going to write test code for that, we still run tests based on our functional specification. Few months back when the software I'm doing wasn't even half completed, we've started testing the software. When we see a total missing feature, we file a bug, then the programmer in-charge would have to implement it. When we able to access a feature which we are not supposed to, we file a bug, then the programmer would have to add the security checking. If we still able to login to the system even we'd just suspended ourselves, we file a bug, then there will be another check added. Actually all these are stated very clear in the spec, but as you know, nobody read spec. But surprisingly, they do care about their number of bugs, thanks to the weekly meeting, which discusses about defects. Everything works fine, except that now the responsibilty of reading spec has been transferred to the poor testers.
|