Posts belonging to Category Rant



The Next Big Language will have to wait

Steve Yegge talks about The Next Big Language in his classic blog. The blog is already three years old, and there has not been that many changes in the world of programming languages in recent years.

According to TIOBE, the ten most popular programming languages have stayed the same in the last four years, and no language in the top ten has moved more than two positions in either direction.

In the last 12 moths, Objective-C has jumped from 32. to 12. on the list. There is an obvious reason for this; any software submitted to Apple’s App Store must be written in Objective-C. The popularity of iPhone and iPod touch has made Objective-C main stream language in a year, but it is still not even close to being a big language.

Another site that collects information about the programming language popularity, is lang.pop. Their results are collected from different web sites, and are very similar to TIOBE’s findings.

In his blog, Steve says that the NBL should arrive in 18-24 months. It has already been 37 months and nothing significant has happened. Instead, almost every one of the top 10 programming languages have found their niche and solidified their position in their respective areas. Let’s take a look.

  • Java : Dominating enterprise server business
  • C : Dominating low-level and embedded software
  • C++ : Strong in many different fields, especially games
  • PHP : Unfortunately still really popular on the web
  • Visual Basic and C# : Strong in Windows software
  • Python and Perl : Most popular scripting languages and doing well on the web
  • Javascript : The language for web applications

If we consider C, C++ and Java to be the biggest languages, I don’t see any language currently in the top 20 taking their place. C++ might be the one that could lose the most popularity in the near future, because it is not really strong in any particular area, except maybe gaming, but I don’t see a single language taking its place. Most probably, different languages get some parts of its popularity in different areas.

PHP is a mess, Visual Basic and C# are too Windows oriented, Python is too slow, Perl is Perl, Javascript is stuck to its niche, Ruby is slow as hell. Honestly from a technical point of view, Go could be the next big language. It would require some serious brainwashing from Google. If Google starts shipping computers and mobile phones to people all over the world, and the only language you can use to develop software for those platforms is Go, then it might become the Next Big Language.

Usually when a new programming language had gained some popularity, it’s because there was a new opportunity and a big company behind it. The current market is taken. At the moment, I don’t see any holes where a new language could go and overtake the segment, because the other languages could not fill the hole.

It will require new type of hardware or a completely new need for software before the Next Big Language will have a chance to appear from nowhere. There must be huge financial support for the language, because companies will not want to waste their money experimenting with new and unproven programming languages.

The Next Big Language must be advanced, but I don’t think that it is the deciding factor. I would like that the Next Big Language would do everything that Steve has listed, but I think we will have to settle for less. There will be languages that will fulfill all Steve’s requirements for NBL, but the actual NBL won’t probably be chosen on technical merits.

People talk a lot about high-level languages like Haskell, Erlang, and OCaml, but not very many people actually get to write code for living in those languages. Young people need to decide what languages they need to learn to get a job in programming, and unfortunately, they start learning Java and PHP to get a job. I can’t blame them that most programming positions require Java, PHP, C# or Visual Basic skills.

I hope that before I retire I could see a new language rise and take over most of the programming world. Currently there are too many programming languages that I don’t want to write for living. I would like to see C++, Java, PHP, and Visual Basic disappear from this planet and be replaced by something awesome, but I don’t know, if that will happen in the next 30 years. Let’s hope Steve is right, and the Next Big Language is right around the corner.

  • Share/Bookmark

Better looking code has fewer bugs in it

The most important thing for me about code is its looks. I might sound crazy, but bad looking code makes me cringe. Whitespace is the single biggest factor defining the looks for the code. Variable naming is also important, but as long as it is consistent, it doesn’t matter nearly as much as whitespace usage.

There is actually a reason why I rave about the importance of looks in code. Better looking code has fewer bugs. Let me say it again with all caps: BETTER LOOKING CODE HAS FEWER BUGS.

There are many reasons for it and I will try to prove it to the best of my abilities.

Whitespace should be used to separate things. By writing

    variable_x+variable_y-variable_z*variable_y

it takes a while to see what is actually happening in the code. If the whole thing is written without any whitespace, it is hard to know where a variable begins or ends. By writing

    variable_x + variable_y - variable_z * variable_y

it is immediately clear what is happening. It takes less time for the brain to visually gather all the needed information from the line above. All of this was achieved by pressing the biggest key on the keyboard six times. The space key is so huge that I don’t understand, why many programmers have hard time finding it.

Because the second example is more clear, the bugs in it are more obvious. Let’s say that instead of using a ‘-’, there should be a ‘+’. This might go unnoticed in the first example, but the operators are more visible in the second one, and the problem can be caught more easily.

Whitespace doesn’t only limit to space characters; newlines are also really important. Code should be structured by modules, functions and blocks of code inside the function. If the function is one big block of code without any newlines, it is impossible to quickly get a clear picture of what is happening in the function. The return key is also quite big, but still many programmers are able to avoid touching it for long periods of time. Some programmers claim that if code has too many empty lines, enough information cannot fit one screen. I have one advice for you: Buy a bigger monitor. If you still want more lines, turn it 90 degrees. Now you have so many lines visible that even the most verbose Java code with plenty of empty lines manages to provide a lot information in your Eclipse.

Example 1:

    lines_of_code;
    another_line_of_longer_coder=xyz;
    for(i=0;i<12;i++)
    {
        print("ILIKEDENSECODEBECAUSEIAMARETARD")
        another_print("NOTHING");
    }
    long_calculation=1262+3222-3423^32424>>1233?1:0;
    //comment hidden here so you won't see it
    another_useless_line_of_code_that_does_absolutely_nothing();
    move_along_nothing_to_see_here();

Example 2:

    lines_of_code;
    another_line_of_longer_coder = xyz;

    for (i = 0; i < 12; i++)
    {
        print("I DON'T LIKE DENSE CODE BECAUSE I AM NOT A RETARD")
        another_print("NOTHING");
    }

    long_calculation = 1262 + 3222 - 3423 ^ 32424 >> 1233 ? 1 : 0;

    // comment not hidden anymore
    another_useless_line_of_code_that_does_absolutely_nothing();
    move_along_nothing_to_see_here();

Who can honestly say that the first example is better than the second one in any aspect?

Not only does elegant code make the bugs more visible when looking at the code, but bugs are also more visible when looking somewhere else. There have been many situations where I have found bugs in code, when doing something completely else. Beautiful code leaves an imprint in my mind, and sometimes I know exactly where the bug is. I cannot do that with ugly code. I cannot bend my mind around ugly code and walk through it with my eyes closed.

Too long lines and too long functions also prevent me from seeing the code in my head. If the function is short enough, you know everything that is happening in the function and in what order, but if the function is too long, you get lost and don’t know what is happening in the function without looking at it. Long lines, which I already complained in another blog, also hide bugs and prevent me from visualizing the code in my head.

There is never a good reason to write bad looking code or deviate from coding standards. It takes only about 2% more time to write proper code, but most the time should already be spent on thinking. If the 2% is too big for you, maybe you should switch your editor to a proper one or get a new profession, because I don’t want to work with people, who cannot follow simple agreements.

  • Share/Bookmark

What happened in Vegas '08

I am sorry to disappoint you, dear reader, but nothing that you might expect, happened. I was there to attend a programming competition. The venue was the Mirage Hotel and I was there to take part in TopCoder Open ’08 Marathon Match finals. But first, let’s see how I actually got there.

I started participating in TopCoder competitions in the summer of 2007. The first two competitions were a learning experience for me, but in the third competition I was doing pretty well, but my final submission had a bug in it, which dropped me from sixth place to 79. I was really pissed, and started testing my solutions more thoroughly after that.

2008 TopCoder Open started in February and had three qualification rounds, before the 12 best competitors would meet in Las Vegas for the final round. 617 competitors participated in round 1. 300 best made it to the second round, and I actually had the best solution in the first round. 100 best from the second round made it to the third round, and I placed 20. in the second. Third round was probably the most grueling two weeks of my life. My usual day looked like this: 8 hours or work, 2 hours of basketball practice and 8 hours of coding at home. I didn’t sleep much, but in the end, I placed 5. in the third round and made it to Las Vegas.

TopCoder paid for my trip to Las Vegas, and they also paid the five nights I stayed at the Mirage. My competition was on the first day. It started at 9 am and lasted for 8 hours. In the beginning, I was struggling a bit, but after lunch I started rolling and went to the top of the leader board. However, I didn’t stay there for very long, because Psyho overtook me by a clear margin, and I kind of new that I had given everything that I had. Fortunately nobody else scored more points that I did, so I placed second in the competition.

The prize money for second place was $5000, which was kind of nice considering that I got a completely free trip to Las Vegas to do some coding. It was a really nice reward for months of hard work in the qualification rounds.

I spent the rest of the week mostly at the hotel watching NBA playoffs, because I got a fever and a cold. It was bit disappointing to go all the way to Las Vegas and become ill, but at least I saved some money that I probably would have spent at the famous Las Vegas activities.

Last year I didn’t quite make it to Las Vegas; I was 21. in the final qualification round and 10 best made it to Las Vegas, but this year I will go for it again. I haven’t participated in that many TopCoder competitions anymore, because they are really time-consuming, especially when working normal hours.

I am currently ranked #3 in the Marathon Match competitions, but there are some competitors that are not currently ranked, because they have not participated in any competitions for a while. I bet that all the top competitors will come out from hiding for TopCoder Open 2010, and the final qualification round will drain everything out of everyone, who tries to make it to Las Vegas.

Source code for my solution

Problem description (Must be a TopCoder member to see the description)

  • Share/Bookmark

My short visit to video game industry

Ever since I got my first computer, a Commodore 64, I decided that I want a job as a guy who writes computer games. Well, I got a job in video game industry when I was 28 years old. By that time, I had a Master’s degree in computer science and seven years of experience in traditional software industry.

It was like dream coming true. Finally I could live my dream and program cool games for the rest of my life. I was so excited about the opportunity that I did not even care about the open office. There were no doors. Not even cubicles. Programmers in one area, graphic designers in one, and game designers had their own area. You could easily hear the game designers talk from the programmers’ corner. Obviously the managers of that company had never heard of the book Peopleware, which should be mandatory reading for every single manager and programmer in every company that does software.

My title was Generalist Programmer, because I did not have any special game programming skills like graphics or AI. I thought I would write code for the game the company was developing, and pick up graphics and AI skills a long the way. What I did not know that a really big part of Generalist Programmer’s duties were related to version management. I would spend a week every month merging our changes to the latest version of the 3D engine. I probably should have asked what my tasks were going to be, but I was so excited about the job that I did not do that.

Actually my only interesting task during my time there was creating a plugin for 3D Max, but I could not really focus on the task, because of the environment; People were having loud design sessions 20 inches from my desk, which made concentrating a bit difficult. Of course, I could have used headphones and listen to music to block out the noise, but listening to music actually prevents people from coming up with creative solutions, because the brain is already occupied with the music. I read this in Peopleware, and I think it might actually be true for me.

The other, more experienced, game programmers were not doing that much coding either. They were mostly using the editor that came with 3D engine and putting pieces of the game together. No-one actually did heavy programming full-time in that company. I knew that if the other guys were not programming that much, I would never be able to just program all day long, which was the only thing I wanted to do.

The situation was not as bad as it might sound, but it was such a big shock for me, because I had created these illusions in my head that game programming would be the coolest job ever. I came crashing down from my dreams. It was not at all what I imagined it to be. The pay was also pretty bad compared to regular programming jobs. After three weeks I felt so bad that I had to leave. One evening I came back to work after everybody had left and left my key on my desk. My boss and his boss were out of town, so I just sent an email explaining the situation. My boss called me the next day and I explained the reasons why I left.

Looking back at situation, I probably should have talked about these things immediately with my boss, but I didn’t. I just wanted out. My dream was crushed. I just wanted to write software. I am really happy that I tried to pursuit my dream. It did not work out for me, but at least I gave it a shot, albeit a short one.

  • Share/Bookmark

Dieting is not rocket science

Seriously. It is not that difficult. You eat less and exercise more. Let me say it again: You eat less and exercise more. That is it. No need for fancy and expensive methods. You do not need a personal trainer to lose weight. You do not need to understand everything about nutrition to lose weight. It might help, but is not required.

There is huge amounts of money in dieting. A lot of Top 50 books at amazon.com are about losing weight. All the home exercise machine infomercials fool people paying a lot of money for stuff that is not actually needed.

You do not need to know how much calories are in the food you eat. If you are putting on weight, you know that you eat too many calories. If you are losing weight, you consume more that you eat. Common sense also helps a lot. If the food is covered with fat, it probably contains a lot of calories. Buy a scale and eat same type of food the same amount every day for a week. You should know after the week, if you are eating too much.

However, people might know what they need to do to lose weight, but they are incapable of doing that and they try to find easier ways of losing weight without the hard work.

It is all about mental toughness. If you want to lose weight and decide to lose weight, just do it. After Christmas I decided that I will lose weight, because of all the chocolate, Christmas food, hamburgers, etc. January 1st I weighed 85 kg, two months later I weighed 79 kg.

All I did to lose weight was stop eating chocolate, French fries and dinner at Mickey D. I still eat four times a day, including a lot protein on every meal so that my muscles do not completely vaporise. I also do 20 minutes on the treadmill when I am at the gym. That’s it. No fancy tricks, no books, no personal trainers, no pills, nothing special. I even eat pizza for lunch once a week.

However, first part of losing the weight is dieting and the second part is keeping your weight down. If you go back to your old habits of putting on weight, the benefits of the diet will disappear pretty soon. To make the weight loss permanent, you should change something in your life for good. For example, switch to diet Coke, stop eating candy, or anything that will make you eat less calories or consume more.

  • Share/Bookmark