Sunday, March 24, 2013

Java can get annoying

There are times when Java is wonderful, such as its cross platform-ness and its garbage collection. Then there are times when I feel that there could be some ways to improve Java.

Before I go about talking about all of Java's shortcommings, I just want to say that Java is pretty well done. Compared to languages that came before it, Java is a lifesaver. It's also the reason we have C# (for all the people in Microsoftland) and the reason we have all of those strange languages that decided to run in the JVM (for all of the people who put up with Scala and JRuby). Overall, it is the language that people like to ask about, since it is the one that people know about. The syntax is clear, and it doesn't have 3 trillion ways to print out a single line of text. Even so, there are times I wish Java was better.

  • Consistency. String and array use length when you want to determine their length. On the other hand, the List interface uses Size. Please choose one or the other, I don't like to have the compiler spew errors about such pointless subtleties.
  • JRE. If you make a application with Java (and you are mainly developing for windows), its a pain to make sure that the user can run your application. Hopefully, they will have the same version JRE as you did when you compiled it. If not, the application might not start. So you decide to bundle the JRE with your application, but that seems like a strange extra step for a language that you "write once, use anywhere"
  • Parsing JSON. Regardless of the parser that you choose to use, you will either get a zillion warnings or cast everything until the apocalypse. The compiler has no faith in the programmer that they got the type right, and is determined to save humanity by refusing to compile until every last 'error' is addressed. What a nightmare.
  • Generics. I understand Java's reasoning with generics, but I still wish it was done better (like in Scala) Due to the way java separates primitives and objects, some classes contain one method for all objects as a parameter, and then a zillion different methods for int, float, double, long etc. Wrapper classes are also necessary if you want to place an int into a List. While they have made substantial improvements regarding how they wrap and unwrap the primitive, it's still rather inconsistent to type List rather than just List. Sure, it tells the coder that the List is actually storing Integer wrapper objects rather than ints, but I don't think that will cause anyone to reconsider how they write their code. It would be a nice note to make in the docs, but not something that anyone really cares for.
  • Security. You've read the articles. I don't need to say anymore.
I've always been curious as to why Sun never bothered to give the option of compiling to JVM or native. In the early days, Java was turtleneck slow and it would have been a much more compelling alternative to C++ if the performance gap was smaller. That isn't such a big deal now, with better computers and a more mature JVM, but it is still something that I will never understand.

Friday, March 8, 2013

Power

In the physics world, power is simply the energy divided by the change in time. Sadly the rest of the world isn't really interested in this idea.

There's something alluring about power to people. Maybe its the shiny bars of gold that sit around in some of the world's largest gold reserves. Maybe they just like seeing other people miserable. The odd thing about power is that we all think it would make our lives better but we have neither empirical nor scientific evidence of that ever happening.

It's strange.

Sunday, March 3, 2013

Native Apps, Web Apps, and Whatever's left

Having the wonderful opportunity to create and use mobile apps has been sheer fun for me. I find it fairly amusing to see how other people make their apps and some of the pros and cons that are associated with each decision. In general, I like to categorize apps into three different categories: Native, Web, and Whatever's Left. Let's begin

Native.
These are the apps that are written in the language that the SDK is written in. Performance is generally fast and developers get access to hardware on the device such as the camera or the accelerometer. The GUI is built directly on View elements provided in the SDK. Since they are stored on the local device, much of the app is ready to go and has relatively little waiting.

Web.
These are apps that run in the browser. People have to type a web address into the URL bar and wait for the thing to load. They can be updated at any time since they are stored on a server rather than the local device. Can be extremely flexible since layout and design are done in HTML, which are easier to handle than the view objects provided by the SDKs for native apps. The browser in which these apps are run in often have optimizations which make the apps load somewhat faster.

Whatever's left
The worst of both worlds. Hybrid apps. Slow loading times and fairly rigid. Load times can be much slower than Native or even Web. Easier to bring interesting interface designs due to the broad range of things available to use for the app. Developer has no control over the web view, which may or may not adhere to standards extremely well.

Saturday, March 2, 2013

The blink tag

In my past decade or so of dealing with HTML and inconsistently applied web standards, my favorite HTML tag by far is BLINK. Even though it was never supported by IE and one of those strange things that Netscape cooked up in the 90's, I felt that the blink tag showed that the web browser should be capable of generating dynamic client side content without the need of a lot of javascript (remember, old browsers were slow at javascript)

Now, the W3C has blink as part of CSS text-decoration, the past still shows. Netscape's successor, Firefox, will happily blink text for you while Mammon still refuses to do so. It really is a shame. The only way to blink text with cross browser support is to use javascript.

Should you use the blink tag? Of course not. Unless you are trying to give your enemies (who do not use IE) seizures.