Monthly Archives: July 2006

Python

Finally I made it to Python!

Now, there is a great language. What I like about this language is that it maketh sources look really nice. Syntax is clean and simple, mandatory indentation is something awesome, especially to somebody who tired of C/C++ sources with no slightest sign of coding style, like this:

In Python, thou hast to indent thy code properly, because this determineth how it will work. On the other hand, braces become unneeded–less to type, all the better!

What I like not about Python is abscence of private/protected class members. It just looketh not safe! Well, it is a kind of resembleth GLib with its outstanding way of declaring private members. Knowest thou how to do it in C? If not, just take a look:

Now I guess in Python we just need to make similar “implementation” by ourselves, since language giveth us not one. And of course, proper naming conditions will help us too. But that looketh rather adhoc anyway. No ideal language in the world, eh?

Nonetheless, Python is just wonderful. Something as high-level as Perl, with syntax as clean as in Java, but as simple as PHP. Availability of Qt for it maketh it only better.

It took me half a day to learn Python. I quickly made an example using Qt in it, looking like this:
Example

Qt Jambi

People often say that I like Java not. It is not strictly true. Java would be a wonderful language, if… if what? I usually say it not, because people would not listen anyway ^_^ There are a lot of ifs actually, and all of them combined make java almost useless. Not in sense that it is not suited to any task, but in sense that there is always a better way. Graphics in Java is too slow, so everything that hath GUI should be developed with something like Qt (that means, C++ or Python). Long-running applications are vulnerable to memory leaks in Java VM, so it is also a bad task for Java. Various text-processing tasks would be wonderful job for Java, if there was no Perl nor Bison and Flex. High-level network applications require an elegant API, so Java may rest, Qt will do a job here. Low-level require high performance which also meaneth Qt or C for lower-level tasks.

Now there are a lot of Java applications but they just make no sense. Azureus, for example, which I had to replace with poor analog in Python because Azureus was overloading my X server (a network application, not a video player or 3D game!). Azureus would be better implemented in Qt/C++ or Qt/Python (GUI part) and Qt/C++ or plain C (network part). There are much more examples of improper uses of Java. I know of no proper one.

But now something happened what really made me feel slightly more better for Java. Trolltech released Technology Preview of Qt Jambi – a Qt variant for Java. Now a lot of things became better.

First of all, it is finally possible to create efficient GUI applications in Java. Unfortunately, I still know Python not, so I am unable to say whether there are any cases when Qt Jambi would be somehow better than PyQt, but the very fact that it is now possible to write something in Java that will have a GUI but will not make everything slow as hell is rather nice.

Another thing, Qt seemeth to become not only cross-platform, but also cross-language toolkit. On top of all, it is now possible to create applications consisting of parts in C++ and Java. Of course, there is JNI, but it is something like black magic compared to Qt Jambi in terms of clarity ^_^

What I like not is that they released it in binary form. And they are telling us something about feedback from open source community! How the hell can they hope for it without releasing source code?! Hope they will dual-license Qt Jambi with its official release.

Nonetheless, it is something unbelievably wonderful. Just the feeling of using Qt Designer for Java application is something.

Unix is for thee, if…

Just for fun. Note that it is mostly about Unix philosophy, not about technical side. Nothing preventeth one to apply Unix philosophy in non-Unix systems, and it is often done with great results. It is just that Unix is the best place to apply Unix philosophy, so if thou findest out that applying Unix philosophy doth great things, maybe it is time to switch to Unix and to use its full power. So…

Unix is for thee, if…

Thou wantest to fully control everything thou dost even if that meaneth that thou sometimes must control something that seemeth not necessary to control.
Thou likest to learn.
Thou preferrest to spend a lot of time learning some powerful tool and then save much more time using this tool, rather than wasting thy time using less powerful tools.
Thou wantest a system that breaketh without a reason not.
Thou wantest to be able to see anything that happeneth inside the system.
Thou art a programmer or just likest programming.
Thou likest freedom and hatest the very idea of deceiving and controlling others.
Thou believest that reinventing the wheel is a very stupid thing to do.
Thou likest to play with software, configure it, plug different things together.
Thou wantest simple tasks to be simple to do, and wantest to automate everything that is possible to automate.
Thou likest free and open source software.
Thou likest small but powerful programs.
Thou likest portable software.

Unix is not for thee, if…

Thou wantest not to control anything that is not necessary to control, even if thou loose a lot of power.
Thou likest to learn not.
Thou wantest tools to be as simple to use as possible, even if that meaneth that they will be slow and somewhat defective.
Thou wantest not to know about anything that happeneth inside the system, except when thou really must know about it.
Somebody tried to explain basics of programming to thee, but thou couldst not even begin to understand it. Neither thou wanted to.
Thou carest not about taking away somebody’s freedom.
Thou seest nothing bad in having only one way to do something.
Thou hatest to configure something, thou wantest everything to work right away.
Thou mindest not to spend a lot of time doing some stupid simple work like typing a lot of similar text fragments.
Thou likest big powerful programs and mindest not them being commercial ones.
Thou mindest not if the program is not portable as long as it runneth everywhere thou wantest it to.
Thou wantest everything in thy system to be in thy native language, even debugging messages in English annoy thee.

Note that it is not exhaustive list, neither it is some logically selected sub-list – just random thoughts.