Archives for : April2009

My thoughts on Oracle, Sun and Java

Over at Oren’s Blog there was the following comment:
Alberto:

So what. I don’t care much what the writer says. Java is open source, so Oracle can’t “own” it in the sense they can’t control it.

to which I responded:

@Alberto,
Java itself is not opensource only the JDK. This means if you want to help to make changes to the core libraries you can but if you got a wild hair for some reason and wanted to figure out how to add LINQ to Java you couldn’t. See http://www.sun.com/software/opensource/java/faq.jsp#b8

This is an important distinction. The JDK is opensource, not Java. This means the future of Java is in the hands of Oracle and it scares me. Development on the Oracle DB itself has been rather stagnant. I’m not saying that there haven’t been new features added, just that Oracle hasn’t been making any big leaps forward.

I’ve had the unique opportunity for the last 6 years to develop professionally in Java and the last 5 years in C#, a man of both worlds. When C# first came out I was thinking, so what? I can do that in Java and do it easier and cleaner. C# had a lot of catching up to do. Fast forward 5 years and Java is so far behind the curve now. Development of the Java language has become stagnant. Like the Oracle DB, new features are added sure, but there haven’t been any significant leaps forward. Java has simply fallen behind. I just hope Oracle doesn’t do to Java what it has done to it’s DB and let it die a slow death. As pointed out by Andrew nearly all of Oracle’s business is with the government, and having worked on some government contracts I can tell you that is starting to slip.

As a new generation of IT moves into places of power they simply are not as enamored with Oracle as the old guard were and they are willing to look to other solutions.

So what does this mean? C, C++ and Perl haven’t had any new features for a long time. Does a language need to make leaps forward? C, C++ and Perl live in different worlds with different purposes then Java and .Net. Sure there are some cross purposes but for the most part they are separate. Java has to continue to innovate if it wants to stay a viable mainstream language. I hope that Oracle can bring innovation back to Java and yet worry that it doesn’t really care.

Brian

In thinking back, the only part of my comment I disagree with is:

having worked on some government contracts I can tell you that is starting to slip.

The reason I disagree with it is because, at this moment, the federal government and the DOD are still firmly entrenched in the idea that Oracle is the only way to go. So basically I’m saying that things aren’t starting to slip, at least not right now.

But I do firmly believe the next part of my comment:

As a new generation of IT moves into places of power they simply are not as enamored with Oracle as the old guard were and they are willing to look to other solutions.

My point here is that I think Oracle cares about Java because their tools are written in Java. But that is it’s only extent. Now that the JDK is opensourced I’m sure we’ll see some movement in the JDK but very little, if not nothing, in the Java language itself. This is really a shame.

There is no doubt that Java rules in the web application market against .Net and ASP.Net, just as there is no doubt that Apache rules in the web server market against IIS. Maybe that is fine for Java. Maybe Sun wants it to be consigned to a subset of the development market. But there are some heavy hitters in that market, Ruby, PHP, and Perl to name a few.

So why not try and carve out a significant share in all markets? Java has never truly had a significant share in the desktop application market. I feel it was held back by how bad AWT and then Swing were. In Java 6 it seems like they’ve tried to make some steps forward with the new desktop APIs but it doesn’t seem like that is enough.

6 years ago Java was an innovation. Now it’s merely stagnant. It’s APIs can’t keep up, it’s language features can’t keep up. With every new release of .Net I find it easier and easier to do everything. With every new release of Java I think, “That’s kind of cool but that doesn’t help me.”

There is a definite flaw there. I hope Oracle dumps a bunch of money into Java and really gets the development platform, from both the JDK and the language features perspective, kicked into high gear. It’s just that it seems that Oracle actually likes stagnation. If it ain’t broke, don’t fix it is their attitude. The problem is that, while that may work for the Oracle DB with their heavy paying government projects, it doesn’t work for Java.

Later,
Brian

Book Review: Code Complete

I suppose for any serious software engineer one must read Code Complete. Last week I finished it and have been trying to think of how to write a review of it. I’ve decided to do so briefly.

Let me start off by saying I’m excited that I finished it. There is a lot of good information and there is no doubt that it is the standard for sound software developement principles. That being said, remember when you try to tackle this bood that it is a text book. Sure there are some interesting anecdotes about this and that. I suppose I should have been more thrilled about reading it but couldn’t drag myself to pour through it like I have some of my other software books. It took me a year to read Code Complete. During that time I re-read The Belgariad series, The Malloreon series, most of the Song of Ice and Fire series, and read for the first time Pro WPF in C# 2008, Effective C# and I’m almost done with More Effective C#.

So what am I saying? I know there are those of you out there that love Code Complete and read it voraciously like a good fiction novel. I couldn’t even read it like a good code book. Pro WPF in C# 2008 I read like a good fiction novel. I drank it in and loved it. Code Complete I just couldn’t do that with. As I said, it’s sound, solid developement principles I try to apply every day on the job. I learned a lot and will continue to try and apply the princibles of Code Complete. Simply because of that it is a reason to read the book.

If you’re like me and are struggling to get through Code Complete, spread it out, read a chapter and then take a break and read something else. There are 35 chapters in Code Complete. Read a chapter every two weeks, in between other books and it will take you just a bit over a year to read it.

What else can I say? 99% of the book makes perfect sense. Some of the code formatting seemed a bit off but I just let visual studio format my code for me. Ctrl-K + Ctrl-D, Baby!

Read it, grok it, follow it and your code will be better, cleaner and easier to maintain.
That’s all there it to it.

Brian

Often Unused Operators: Curly Braces {}

Okay, I know you think I’ve seriously hit the crack pipe here. Curly Braces, as I’m sure we all know, are fundamental to programming in most languages. This is true no more so then here in C#. We use them for if, for, using, do, while, namespace scope, class scope, method scope and getters and setters for parameters.

So how could I dare to say the {} is an often unused operator? Well, I’m specifically talking about a use of the operators in this case, not the operators themselves.

Did you know you can use curly braces by themselves? Take a look at this:

public Window1()
{
    InitializeComponent();

    {
        int [] intList = { 1, 2, 3, 4, 5, 6 };
        var evens = intList.Where(x => x % 2 == 0);
    }

    {
        int[] intList = { 1, 2, 3, 4, 5, 6 };
        var odds = intList.Where(x => x % 2 == 1);
    }
}

Yes! That there are curly braces by themselves!

Why the hell would anyone want to do this? I find myself using them all the time when writing up samples where at http://www.formatexception.com. The reason is that I test all the sample code I post up here that I write. This has been a big help especially since it seems like a lot of the linq code here derives from msdn samples and, believe it or not, not all of them work.

What this means is that if I want to do a write-up on linq where I’m using the where method on IEnumerables (like above) I write the code surrounded by curly braces. Because each is it’s own scope, call it internal method scope if you will, there won’t be any name collisions. It’s like doing an if(true){} without the if(true), or like using the using keyword as in:

using(Stream ImageStream = new MemoryStream(File.ReadAllBytes(ImagePath)))
{
    BitmapImage bi = new BitmapImage();
    bi.BeginInit();
    bi.StreamSource = ImageStream;
    bi.EndInit();
    
    Image imageFromFile = new Image() { Source = bi };
    //dump image into wrap panel in form
    imagePanel.Children.Add(imageFromFile);
}

except you don’t have to have a class the implements IDisposable.

So, where would you use this? If you’re real paticular (i.e. anal) about the your variable names. For instace the following code is not valid:

{
    int [] intList = { 1, 2, 3, 4, 5, 6 };
    var evens = intList.Where(x => x % 2 == 0);
}


int[] intList = { 7, 8, 9, 10, 11, 12 };
var odds = intList.Where(x => x % 2 == 1);

The reason is that the set of curly braces define a child scope but the second intlist exists in the parent scope. Sibling scopes can have variables of the same name but not parent/child scopes. If I really wanted my intList to be named “intList” and assuming it would only be needed within the child scope I could put a second set of curly braces around the other code and be free to name my intList to, um, “intList”.

I have never really found a use for this in production code to be honest. I use it a lot when writing up samples for my posts, but not in production code. I suppose if I was adamant about my variable names I would use it more and I think a few of you out there are. I, however, have no problem simply naming my second int list to intListForOdds.

So that is the curly braces and their often unused purpose.

Later,
Brian