How to Build Good Software? Lay Off Quickly.

If you have to lay off in your job, do it quickly. I don’t understand companies that want to keep someone as long as legally possible when this someone wants to leave. First the employee won’t be as motivated, but more importantly, you will continue to train that person to your company’s software and ways of work. This would be much better used on another person, that will stay in the company. Time for layoffs should exclusively be used for knowledge transfer.

How to Build Good Software? Talk to people, especially the ones you don't know well.

Someone modified a simple launch script on a integration machine. This pissed off the author of the script. Why?

Just because the guy who modified the script never worked before with the author of the script. If only the author had been notified verbally or by mail of the modification, he would have been happy. Furthermore this would increase the quality of the change since the new guy might have made a change that has other impacts, that the author will best evaluate quickly.

Find Grep And Vi Keys Small Memo

I tend to forget this now and then to grep on a specific list of files:

find . -name "*.xml" | xargs grep "iwantthis"

And I also tend to forget the vi keys. Small extract:

h - move left one character
j - move down one line
k - move up
l - move right
$ - go to the end of the current line
0 - go to the beginning of the current line
G - go to the last line in the file
15G - go to line 15
control-F - forward one page
control-B - backwards one page
n (N) - next (previous) in search mode (/ or ? forward or backward)
s/OLD/NEW/g - replace on current line
%s/OLD/NEW/g - replace every occurence in file (or use 0,$ instead of %)

x - delete one character

Update I have to add the standard replace in multiple files via sed command. Here is an example of how to move your eclipse workspace to another directory:
  • find . -name "*.xml" | xargs sed -i "s,c:[/\\]java[/\\]eclipse,d:/eclipse302,gi"

How to Build Good Software? MS Press Code Complete says Measure twice, cut once

I am starting a series of posts about software construction, based on good and bad experiences while working for my many employers.

“Software construction (a.k.a. architecture), is the only activity that’s guaranteed to happen on every project”. It is not rare that projects or new features are abandoned either because they are too costly, or because they are not needed anymore, or because they are other more important priorities.

In the same vein: “Measure twice, cut once”. “Measure twice, cut once” is highly relevant to the construction part of software development, which can account for as much as 65 percent of the total project costs. The worst software projects end up doing construction two or three times or more. Doing the most expensive part of the project twice is as bad an idea in software as it is in any other line of work.

When you see Software that change versions (major versions) while not really having been used much, this is a sign there is something wrong in the construction part.

Java Concurrency In Practice Book Review

My reference book on Java concurrency is Doug Lea's Concurrent Programming in Java: Design Principles and Patterns. He is one of the authors of this new book, Java Concurrency In Practice. There is also Joshua Bloch, author of Effective Java, that many people love (but I am less a fan of it, even if I would recommend it to Java newbies), and author of Java Puzzlers, that I found more fun.

With such authors, I had relatively high expectations. I was surprised that there is not much material in common between Doug Lea's book and this one, which is a good thing. It's a different presentation, that focuses on different problems.

There is some very interesting material, I especially enjoyed chapter 16 on the Java Memory Model. There are not many  books with information on it. I did not know that initializing a final member in the constructor was providing thread safety for the accessor method of the corresponding field if there is no other modifying method, no synchronization needed. And not having the member declared as final was breaking the safety.

I also had not heard of Amdahl's law before. It seems quite intuitive, but then the example in the book about processing parallel tasks using a synchronized LinkedList (improvement up to 3 threads, no more later due to time spent on synchronization) shows that the reality is not that intuitive.

I enjoyed how the book is written, and how information is presented. There is for example their concept of publication and escape (in chapter 3) which tells you important things, like not starting a Thread in a constructor (and if you still want to do it they present a nice way to do it).

I think this book is a simpler read that Doug Lea original book, and probably a better introduction (that still goes very deep) to Java concurrency programming.

Why are you not using Entity EJB 1.1?

I am currently quite busy learning about Websphere Commerce. I was surprised to notice that they still use Entity EJBs 1.1. My experience was that many companies turned away from Entity EJBs, sometimes from the beginning, preferring TopLink or Hibernate (later).

I know that Entity EJBs are more heavy to use than Hibernate, but with the proper tooling support, it’s not really a big issue. Are there more fundamental reasons? There are probably some mapping limitations, but IBM implementation is apparently quite good in term of features.

I will write a complete post about my own analysis of EJB 1.1 vs IBM EJB 1.1 vs EJB 3.0 vs Hibernate, but I was wondering first what was your feedback on EJB 1.1.

Switching to Windows

That’s it, I have done it, the unthinkable. I have switched from MacOs X to Windows XP. My idea was first to install Ubuntu on the Mac Mini, but if you want to keep the Mac Os X install, the methods I have read on the web required to use bootcamp. At around the same time I was annoyed by problems I had with bluetooth and Skype in MacOs.

So, with bootcamp installed I decided to give a try to Windows. And it works quite well on the Mac. As I use it mostly as a media box (movies, photos, jukebox, browser and tablature reader) and not really as a developer, I find Windows quite convenient. I have always preferred Picasa to iPhoto. And moving back to Picasa for my photos is a joy. I can’t believe the speed difference between the two apps, and it’s not a matter of memory, I have 2gb. The crappy ways iPhotos deals with my folders is over. I am also happy to use again foobar2000 instead of bloated (and limited (only MP3s and MP4s)) iTunes. In my quest to look for a convenient setup, I discovered ProjectM visualisation, also available for MacOs X (with iTunes) and Linux. I am quite impressed with the animations. I have the impression that graphics are much faster under Windows than under MacOs, it’s probably due to much better optimized drivers.

Today I gave a try to Netbeans 6.0. It’s not a dev machine, but I find convenient to sometimes be able modify quickly an existing program, or test some java stuff. It’s still in beta, and it shows, I found it so slow! Plus functionality is really not on par with Eclipse when it comes to code analysis. It reports some errors way too long after I corrected them, and it does not report other important errors, for example when a library requires another library. With Netbeans, you see the library problem only at runtime. Under Eclipse, you have an alert in your project, before running it.

What’s not working very well is the broken Apple keyboard, I really don’t understand why they changed all the non alphanumeric keys in the French keyboard layout. But it’s broken in MacOs as well, Another thing is the bluetooth headset. Apple bluetooth drivers don’t do that. Anyway Apple bluetooth range in the Mac Mini is a joke. My thinkpad offers a much wider bluetooth range. Overall I am quite happy with the current setup, being able to use Picasa, foobar2000, Open Office,.and latest software like Skype 3 or Photoshop 9. And I don’t have to lose any more time with the freaking Finder backward interface.

Social (Web) Revelation: Tags Are Lame

I had a revelation yesterday while thinking about del.icio.us, the most well known social bookmarks site. I find out that I almost never use my tags, and I am often not satisfied by results when I search using tags. What use can you make of 100s of tags? in the end only less than 10 are usable to classify very different stuff. And even then compared to a search it’s not a much useful classification.

If del.icio.us search engine was decent then I am sure I would never use tags. But their search engine is slow, and does not search much (it sometimes fails to find results on words in titles).

What is needed is really a social search engine, where you could look things up by user as criteria, and possibly by dates. I googled for it and immediately saw that my “revelation” was quite common. There are several social search engines. There is cranky, where you can see eventual reviews by some users, added to search results. There is eurekster, where you can search in any user bookmarks, but you can’t search everybody (how silly). There is Yahoo MyWeb, quite decent if you ignore the presentation and if they added descriptions on results.

A friend of mine told me that furl, another social bookmarks site, is more search oriented, but unfortunately a bit slower to use since it keeps a copy of the page you bookmark.

But still I feel like none of the sites do the right thing, some have too many features, others bad presentation, focusing on useless crap. I actually think that google should have that feature integrated with the common search. I am sure it will in the future, but they seem to be late on the social side of the web.

1 year of mac mini - the deception point

I am less enthusiastic about the Apple experience than I was one year ago. I am quite enthusiastic with the hardware in general, except the keyboard. The computer is small and quiet, and there are not many competitors at this price on the market.

Experience as a developer

I feel frustrated with MacOs X as a development environment, when compared with Ubuntu Linux. I always miss the multiple desktop, despite expose magnificient look. The standard behaviour for the terminal, bash, vim, etc. are more convenient in Linux. Installing software and updates is much more convenient on Linux thanks to the open source repositories. The key bindings for special characters is awful for a programmer on the Apple keyboard, because non standard, and not even written on the keyboard. Installing linux on a mac mini intel is not trivial, but I am considering it seriously.

Experience as audio/web user

No particular complaint about the web, but I use Firefox instead of Safari, because of Firefox Adblock extension. Chat works well, Skype is ok. There are sometimes problems with bluetooth audio for Skype that, I think, are related to MacOs.

Audio is good too, I end up finding iTunes ok to use, it is fast enough to manipulate 100GB of songs. But I don’t use any fancy feature, except cd-burning. It makes a good jukebox, and the remote is handy, but not terrific (any wireless keyboard would do in the PC world, for 90% of the cases).

Photo is not great, I don’t like iPhoto that much (especially when compared to Picasa). iPhoto is quite slow for me (and I have 2gb of RAM). I found it a pain to install TheGimp on MacOs, not knowing which X server to use. Photoshop is still not compiled for intel, and dog slow on my mac mini.

Page is not great either. It does render beautiful letters, but overall I don’t find it very usable compared to more standard software like OpenOffice, and it’s time limited!

Conclusion

Overall I think I would not buy a Mac again if comparable PC hardware exists. MacOs is not a bad OS, but I prefer Ubuntu Linux. If you don’t use or like Linux then is really Vista worse? I don’t think so.

Tired Of Bad Singletons

While looking through some code for a project, I saw that:

  public static final ProductYP instance = new ProductYP();
 
  public ProductYP()
  {
    if (instance != null)
      throw new RuntimeException("Only one instance allowed");

    prods = new HashMap();
  }

  public static ProductYP getInstance()
  {
    return instance;
  }

And I don't think it was done by a newbie... It's actually not far from being correct, it's just that the guy obviously does not know about private constructors. I have seen several broken singleton implementations in previous projects and had several debates on the double-checked locking pattern (it works since JDK1.5 with volatiles but is useless). I am upset to see another half broken implementation. Everybody should have read at least this.

What have you seen as broken singletons?

Previous

Next