I was making random world map information to a game of mine and I stumbled onto a problem using neooffice ( the “tuned for Mac” version of OpenOffice ). What I wanted to do was to copy a formula lets say from cell E2 to E1000. OK – so I write my formula into to cell E2 hit enter and select it again and go to Edit->Fill-> and WTF?! Fill is disabled – why??? So then I googled for 30 minutes but found no useful help. But then I went back to NeoOffice and saw “Define Range…” menu item under “Data” and realized how to fill down.

So first you have to define your range. Go to Data->Define Range… Give your range a name and type in your range for example mine was: $Sheet1.$E$2:$E$1000 and click OK. Next go to Data->Select Range… and select your newly created range and now click the cell where you have your formula and go to Edit->Fill->Down and now your formula is instantly copied down. I hope this helped you.

Notice there’s at least in version 3.1.1 patch 0 a bug in defining ranges that when you type a name for a range for example if you have earlier defined range “delta” and try to make a new one called “D” it forces the text automatically be “delta”. OK it has like syntax sense but it’s useless now and in this case harmful when you can’t type a name which is kind of like what you had before. OpenSource fans might say “but you have an ancient version… that came out like 2 weeks ago waah waah waah…”. The reason I don’t update is that every time I open the program I get an annoying dialog saying that my version is old – I don’t care – let me work!! And even if I download the new version of it every time a new comes out – it’s still going to be an outdated version the next time I open it.

My First Blog

Java Critique

In this blog I will point out why java is bad and is my least favourite language in desktop programming and in language level. I don’t go to server-side programing because I don’t have much experience about it.

What is Java

Java is not only a OOP language, it is also an entire platform with virtual machine, garbage collection, just-in-time compiler and enormous class library.

First I want to say the good things about java and then start ranting

The Good Parts

Importing other external libraries is easy with importing jar files

It easy to create documentation java in IDEs when you use the commenting features such as @param and @author when you comment your code.

Language is simple. The syntax is very simple.

Deploying built applications is easy.

The idea of code once run everywhere is great.

Threading is in best order in java at the moment.

The Bad Parts

Java is a proprietary language. Why? Because it is owned by SUN. Unlike C and C++ they are not owned by anyone. Not even Bjarne Stroustrup owns the C++, if it would be anyone then it would the ISO committee.

The Java is not platform free – it is a platform! Java byte code only runs where the Java VM runs.

When you write java you are forced to write object oriented programming. This is because the language developers have decided that “We are smarter than anyone and they must write code like we do to get benefit.”.Object oriented programming does not make everything better. There is still a lot of procedural programming in the world. OOP fanatics tend to read 1000 page books about “how to think naturally” and never read a single page about good procedural programming. And then they end up saying that this System.out.println("Hello, world!"); is more natural then printf("Hello, World!");

Somebody might say: “It’s good that java doesn’t have pointers so you don’t need to worry about them.”. That might be okay for a beginner but in the reality every object passed to a method is passed as a pointer. They are just called references . If you want to pass a copy to a method you must make a copy of your object and pass that, because you cannot write copy constructors in java.

You cannot pass a primitive types such as: ints and doubles as pointers or references

Garbage collection makes programmers sloppy. How hard is it to write delete?

Only dynamic allocation is available in java.

Because of the language design java does not decrease the total lines of code. This is just my experience – I cannot show you real statistic proof ( but then again aren’t all statistics damn lies ). This is one problem in IT: “How to measure software?”.

You can’t write destructors in java – wrong. You can, BUT you can never be sure that your object destructor is called when the object falls out of scope or when the application exits with System.exit( int );. But to enable calling of an object destructor on exit you must use something infernal like this: Runtime.addShutdownHook method Uagh… That’s horrible. Why is this so important then? Isn’t all the memory that the application has allocated released when the applications is quit? Yes, BUT! Memory is not the only resource you can reserve. For example you could reserve a printer or a file handle and you wanted those resources to be released when the object using them falls out of scope.

You can’t use function or member function pointers.

There is no macro system of what so ever guide. I must say that I don’t like if someone overuses #define macros in C. Also macros are evil 4 ways if you don’t know what you are doing or using

Nor is there any template system java like C++

No operator overloading. As a C++ fan I find of not being able to overload operators in java to be a huge pain. For example consider:

Java programs tend take a lot of memory. Just look at the memory use of NetBeans – it’s more than 400 MB.

In theory java is only 10% more slower but in practice all java programs are slow. Especially when loading.

Java has built in GUI library “swing”. OK, nice. BUT, I think it’s the worst library to write a GUI. You should always the native look to make java GUIs to at least look nice.

Java code gets old very fast. Not all companies are willing to upgrade their java VM every year and change their code to use the new methods instead of the now deprecated ones.

Almost everything in java is wrapped around in try-catch statements. This is bad for program performance even if the exception never happened, because the program has to keep a lot of book keeping in order to recover from exception.

In java a lot of casting is made and every good programmer knows that casting is a no-no or at least they should know to avoid casts.

Conclusion

Java is a really bad for P/R programming and is not very good for OOP. Code is bloat, apps are slow and memory comsuming hogs. OK, so why is java so popular when it has so many flaws? This is because java has a marketing campaign, where C and C++ don’t have one.

How Would You Make It Better then?!

Like my dad always asks me when I complain about something: “How would you have made it better?”. How should code be written then if not with java or java-style? Well, in my opinion you should write as portable code as possible and compile it on different platforms and distribute the binaries. Also testing is vital, must test test and test. Give your piece of software to be tested by “normies”. Make it clear what is wanted out of software and do those functionalities properly. Also try save as much as memory as possible and avoid dynamic memory allocation and type casting. To know what your compiler and libraries does is very important skill. There are a lot of C and C++ open source libraries to be used for making GUIs, networking and everything. The problem with the libraries is that they usually are so damn difficult to setup for your environment. But libraries like SDL and Qt are very simple and fast to setup. C/C++, SDL, Qt and OpenGL FTW!!! I also like PHP, XML techniques and AppleSript