Showing posts with label Software Development. Show all posts
Showing posts with label Software Development. Show all posts

Tuesday, May 6, 2008

Bubble Wrap, Hani Suleiman and Logging Abstraction

Let's imagine that you are in an antique shop and a beautiful vase or a statue caught your eye and you thought of buying it, either for yourself or as a gift for a friend. You look at the price tag, and you find that it has a reasonable price. You compare it with the other antiques in the shop, and you decide that this is the one that you want.

You then call for the sales person to take the antique (let's just say that it's a vase) that you chose to the cashier, where you go to pay for it, and to, more importantly, choose the box! Why a box? And why is it that important?

Well, imagine going home with this vase un-boxed. The risk of it shattering, or at least getting a part chipped off is quiet high, and you wouldn't like this to happen, would you? Boxing is very important for reducing the risk of your vase getting broken or chipped off. But there's one more thing. The vase you chose is an antique hand made vase. It did not come out of a production line that produces thousands of replicas. It is one of a kind, handcrafted by a craftsman somewhere in the world, so it does not have a box specifically made for it with an image of the vase printed on it. You'll have to choose a box that will suit your needs. You can choose a fancy looking box if this is going to be wrapped as a gift, or you can choose a cheap box if you just want to take the vase home, and don't care about the box. The box can be made out of paper, cardboard or wood. You have the freedom of choice, and you have a really large variety to choose from, because this antique shop has got everything.

So, you choose a box that suites your needs, and now everything is OK, right? No, it's not OK. If the vase does not fit the box exactly, then you'll be facing some trouble, because the vase might break inside the box after banging to the walls of it a several times. Even if it's a perfect fit, you still have a problem. What if you decide to buy a cheap ugly looking wooden box, that is a perfect fit, but after going home, you remember that your best friends birthday is next week, you didn't get him/her a gift, and this vase matches his/her taste exactly. You'll certainly need to get a new fancy box for the occasion instead of the cheap ugly one. What will you be doing then?

Cushioning is the answer. Foam peanuts, styrofoam and bubble wrap are all great ways to cushion your valuable vase in the box that suites your needs. If you'd ever need to change boxes, there will be no problem, since you can wrap your vase in bubble wrap, and you're done. After all, this is what bubble wrap is good for (even though some people think that it's good for annoying other people by popping them in public).

What does all of the above have to do with anything? Well, let the vase be a software product, the box be the logging framework and the bubble wrap be the logging abstraction framework. That simple! You buy the software solution because this is what you want, but you need logging to trace transactions and exceptions that occur in the system, so you can tell the vase manufactures, sorry, the software vendor to give you patches that fix those problems. Using a logging abstraction framework helps you changing the logging framework very easily, without the need to change anything your software. Imagine having to change the vase, simply because the fancy box you got to put it into for your friend doesn't fit. It would be insane, wouldn't it.

OK, so what about Hani Suleiman? He's the CTO of a consulting company, and the owner of the controversial BileBlog. He's also a member of the executive committee of the JCP, and on the expert group of several specification requests. In his last post before his disappearance from the blogsphere (which was 9 months ago), he was ranting about Tapestry's creator, Howard Lewis Ship, moving from ACL (that's Apache Commons Logging, not Anterior Cruciate Ligament :P), more commonly known as clogging or JCL, to SLF4J. He was referring to Howard's blog entry, which didn't give much technical details (actually no technical details) on SLF4J in my humble opinion.

Well, I have to disagree with Hani here. Even though Log4J is one of the most widely used logging framework, it's not the best. You've got Logback for example, which was created by the founder of Log4J, and has several performance enhancements. You also have a lot of other logging frameworks, and it's totally wrong to force your consumer to use one of your choice.

When you are developing a framework (like the case of tapestry), you should never tie the users with a specific logging framework. I, for instance, like to use logback instead of the de-facto log4j. Being tied to a single implementation is really frustrating. You should be able to change the box if you want. I know that what you actually want is the vase, but if you have no choice but taking it an ugly cheap looking box, and no bubble wrap, you might think of purchasing another vase from another shop, just because you can't possibly give your friend a gift in this ugly box.

He casualy flaps his michelin man arms about about how easy it’ll be for everyone to migrate, and how its no big deal to CHANGE EVERY SINGLE F****** SOURCE FILE YOU HAVE.
This is what Hani says in his blog, and again I wonder how would a man of his position imagine something like that? SLF4J is intended to be a drop-in replacement to clogging. You just have to read the manual (which is quiet small by the way). You can just drop in slf4j.jar and slf4j-jcl.jar in your class path in place commons-logging.jar, and you're done. Now you can use bubble wrap instead of foam peanuts!

Even if you're developing a product or a system, it's a bad practice to tie yourself with the concrete implementation of, well, anything. It's the ABC of design. You have to decouple yourself from everything. You have to "DESIGN TO INTERFACES", and this is why abstraction is so important.

Dear Hani, I have to totally disagree with you on that subject. Even if you are annoyed by people constantly popping up the bubbles in the bubble wrap, this doesn't mean that bubble wrap is a bad thing. Eliminating the use of the bubble wrap would make buying the vase a great risk, since it may break, or get chipped off. Not cushioning your antiques is a bad practice. Even if you get a box where the vase fits in perfectly, without the bubble wrap, you'll not be able to change the box (logging framework) without totally redesigning the vase :D.

The only exception to the above is with log4j and slf4j. Slf4j took the liberty of creating a drop-in jar that is intended to redirect the calls made to log4j to slf4j. This is done so that if you are using a library that calls log4j directly, and you want to use some other logging framework via slf4j. Anyway, I again repeat and insist that using a logging framework directly without an abstraction layer is totally wrong. It's like putting your valuable vase in a large wooden case in the back of your car while driving on a bumpy road, without any bubble wrap!

One last thing. Some people speculated that one of Hani's subjects waited for him in a dark alley and killed him, since it's been 8 months now since his last post. Actually, Hani is still alive, but he seems pretty busy to be blogging about anything these days. He is on the industry reviewers list of two tracks of this years JavaOne. He also had a couple of comments on a blog post, and was interviewed in February by InfoQ. Good to hear that he's still alive.

At the end, if you are a fan of popping up bubble wrap, you'll like this. Another thing, the bubble wrapped statue image was taken by Japh in the British Museum back in 2004. I contacted him to ask for his permission to use it. He gave me his permission to use it.

Saturday, November 17, 2007

Politics in Software Development

Politics is present in every aspect of our life, whether we realize it or not. It's present in the way you treat your family, your in-laws, and your coworker. It's even present in software development.

Ever wonder why Microsoft made Windows Mail in Vista not able to have Hotmail (now Windows Live Hotmail) accounts (unlike Outlook Express), and then months later they release Windows Live Mail which has this feature? Haven't you ever thought why when you want to download the new version of MSN Messenger (now Windows Live Messenger), you have to download an installer which has the options of downloading several other new Windows Live products that you never heard of (Mail, Writer, Photo Sharing, etc)?

Why does Microsoft's Windows Live Family Safety require that each and every member of your household should have a windows live ID so that he/she can access the internet? You say marketing? I say marketing falls under the umbrella of politics.

If the above examples don't strongly show clearly how company politics affect software development, the following ones will certainly do so.

Sun's business is mainly hardware, servers to be specific. Sun is also the company that maintains java. Now java is supposed to be platform independent, and we (java developers) claim that it runs on each and every availabal platform, right? WRONG! Sun creates JDKs and JREs for Windows, Linux and Solaris only, meaning that if you have an HP or an IBM server, you will not be able to get Sun's JVM. HP and IBM develop their own JVMs, but of course the available Java version on those machines is always behind that of Sun. Currently, HP and IBM have JVMs that run java 5, which is more than three years old.

Sun simply won't release versions of java for AIX or HP-UX since it will be releasing it for competitors in the hardware business. If it did, enterprises that have java applications and need to use the latest features may go to Sun's competitors. Sun releases versions for Windows to stop Microsoft from dominating the software development market, and if this is done, the market share of dot net will increase while that of java will decrease, and since dot net doesn't work on anything other than Windows, Sun will be losing a large part of the hardware market for windows based servers.

Sun also open sourced it's star office suite to create openoffice.org, and they open sourced Solaris, and made it compatible with desktop and laptop hardware. Why? To go another step in stopping Microsoft Windows from dominating the desktop market, so that it would slow down the growth of the dot net community, so that software in the market would be runnable on UNIX and not just Windows, so that it would increase it's the possibility of people going for Sun servers.

I believe that Sun's war with Microsoft could simply be over (or at least won't be as strong) if Microsoft made dot net platform independent, but Microsoft will never go for such a move. Microsoft wants to dominate the desktop environment with Windows, and it's very strong competition from Apple and Linux. Microsoft is using the dot net technology, with their fabulous IDE to market Windows. If suddenly dot net applications ran on Linux, for example, Microsoft may lose a huge market share.

I think that projects like WINE must make Microsoft live in fear. Maybe that's why Microsoft made a lot of changes to Vista that made a lot of programs not compatible with it. What had happened is that the software vendors made their software compatible with Vista, and everything went back to normal, except that projects like WINE and REACTOS went one step behind.

I believe that a lot of changes that were introduced to Vista were just to make it incompatible with such projects (such as changing "Documents and Settings" to "Users" and a lot of folders under the user folder like "Local Settings" for example to "AppData\Local" or something like that, and a countless more changes). I believe that such changes have no meaning other that what I assumed earlier.

Now let's go back to Sun again. Sun is THE supporter for Netbeans, which is a great IDE by the way. On the other side of the table, we have the more popular Eclipse, and guess what, IBM led the Eclipse Consortium (and it's the one that created Eclipse). Now someone would say that both are open source projects, and it doesn't make a difference to the companies what IDE developers use, right?. I again say WRONG!

IBM is in the software business, and being familiar with Eclipse makes you somewhat familiar with Websphere and Rational Tools, that are built over Eclipse. Being familiar with those IBM products may lead to you using the Websphere application server, and if you do, which operating system and hardware are the best for such a server? IBM hardware and AIX is the answer. What was Sun's response? Open source Sun application server and create project glassfish, hence you have a high end application server from Sun for free, and of course it supports the latest java technologies months (or even years) before other application servers (like servlets 2.5, JSP 2.1 and other JEE 5 features for example).

Back to Netbeans and Eclipse. Both IDEs allow developers to create custom plugins, but Eclipse recently (not very recently, actually about a year and a half ago) changed their framework to use Equinox, which is Eclipse's implementation of OSGi. OSGi is maintained by a large group of corporations, that include both IBM and Sun Microsystems, and both were founders of the OSGi Alliance. Having IBM and Sun working together is not something to be surprised from, because, as I mentioned before, it's all about politics.

Now Eclipse implemented OSGi by creating Equinox, what will Netbeans do? Well, as an active member of the Netbeans team told me once, they are waiting. They already have their pluggable framework. If they go to OSGi, they have to choose an implementation, and for sure they won't use Equinox. Even if they go for any other implementation (Apache Felix or Knopflerfish for example) or even create their own, they would still be switching to OSGi after eclipse did, hence Netbeans would be following Eclipse's steps (or as someone else would be seeing it, Sun would be following IBM's steps).

So, what's next? Well, there is a JSR (JSR 277) which was created to create Java Module System, which is very similar to OSGi, and guess what, IBM is not in the expert group. As I mentioned seconds ago, the Netbeans team is waiting to see which one will win, Java Modules or OSGi, but I reckon that they will either go for Java Modules once the JSR is finalized, or they will stay as they are. I'm quiet confident that they will never go for OSGi.

I believe that this post became much longer, than I wanted it to be, but I can still go on with the subject for much longer. I wanted to get to a point, and that is, politics between large companies have a great effect on software development. Even with open source projects, when a project becomes very popular, large companies tend to create standards similar it. Examples in java include log4j & JDK 1.4 logging, Hibernate & JPA and of course OSGi & java modules (OSGI and java modules have some differences of course). It's then up to the original creator of the open source project to implement the standard (like hibernate implementing JPA).

I'm not at all against Sun (actually I'm a huge fan), but I took it as an example. I'm also not against standardization. I just wanted to speak about the subject of why large corporations do what they do.

Edit on 12/12/2007
HP released java 6 in November and IBM release java 6 just this month, which is still two years after the release by Sun.