Sucky

As you may have heard I'm working on this website idea for a ratings site. I started the project in Java/J2EE last year and never finished it, tried Spring, gave up on Java completely and I'm now using Python and Django. I've already made more progress this way than I ever did in Java, and so far I'm quite happy with the switch. There are, however, some things that annoyed me to no end this week.

Starting from (near) scratch is a great feeling. You get to design all the cool stuff and make huge leaps of progress. But then there comes a time when the crude work is done and you need to do the finer points. That's pretty much where my frustrations began. Django is an absolutely joy to work with especially because it lets you make great leaps in the beginning. Then, once the rough sketch is complete, you have to fill it in, and for that you need knowledge of Python.

Frustration number one: Python documentation. I haven't worked with Python a lot, so I was looking for a quick cheat sheet on string operations. The official documentation is overcomplete and confusing, in my obviously humble opinion. The official Javadoc is great and even if you can't find the right info in the official documents you'll soon find a very properly maintained home page of some Java fanboy who has written down exactly the code example you needed. Not so for Python. Admittedly I made the mistake of going about it from a Java perspective first, which meant that I was using the wrong way of thinking. After 'fixing' that I came across several helpful pages with examples, none of which worked. Then I came across a page that worked, but only with a version of Python that my hoster does not use. Frustration. Were I of mischievous mind I'd say that it's a little bit like going to a third-world country and finding out that they use donkeys instead of cars. But that would be trolling. I'm just kidding though, and despite my starter troubles I'm still quite happy to use Python. It's always worth it to expand your way of thinking by learning a new language.

Second frustration: IMDB noooooooo. Why is there not a more elegant way of scraping the movie ID (the tt9395359 part in the URL) and getting the name and year of the movie? There's an unofficial API which only has name and year lookup, whereas I want to look up the movie information by using the ID. Geh. There's also data files but they don't have the ids. Oh well, I guess I'll have to do it the hard way.

Which leads to my third frustration: regular expressions.. Regexes are so quick to tempt you to make the perfect regex, making you believe that you're on the path of righteousness whereas you're really drowning in a swamp. I spent half an hour trying to think of the bestest regex that could accomplish everything I wanted in one line of code. Finally I gave up and wrote five lines of code in five minutes that did the same thing.

Posted in Tech | Tagged , ,