Setiembre 2009

State of the art (of the Twitter client)

This is what my Twitter client looks like today.

Current look of CheepCheep

It is displaying my "home timeline"; that is, the list of tweets I see when I log in to Twitter. The timeline is rendered in an embedded Internet Explorer control (and I need to apply some more CSS styles). I have also implemented the preferences dialog, and it works, but I cannot save the preferences yet (I have to enter the credentials every time I restart the application).

Not implemented yet: automatic updates, entering new tweets, deleting your tweets, viewing single tweets/conversations, viewing a single user.

Yes, I'm learning quite a bit writing this program. One of the things I have learnt is that Windows programming is not as horrible as I remember it — but then, it was about 15 years ago :)

More impressions on Windows Programming

I'm still learning how to program for Windows in C++ using the Win32 API, and I'm writing more of my impressions — remember that I've worked with Linux for the past 12 years, and this all is practically new for me.

  • Visual Studio is not a bad IDE, but it is not excellent either (at least for C++). That, or I have been spoilt by Eclipse and IntelliJ IDEA and their excellent support for refactoring (at least for Java). IDEA has such a powerful autocompletion, I have written complete modules without writing a method or variable name in full. In Visual Studio, OTOH, IntelliSense stops working all the time. Are you initializing a variable in the definition? It stops working. Have you got a syntax error 50 lines up? It stops working. Are you using C++ templates? It stops working. I don't know why it stops working so much, when it doesn't even try to figure out whether you want to input a type or a method or a variable name.
  • It is hard work embedding Internet Explorer in an application when you aren't using MFC or Visual Basic or C# or one of those frameworks that give you a "WebBrowser" class in which all the work is already done. Not knowing anything about OLE/COM/ActiveX didn't help, of course. I have to thank Jeff Glatt for his article, “Embed an HTML control in your own window using plain C” (and his “COM in plain C” series), and the authors of wxCode's IEHtmlWin component (once again, Free Software comes to the rescue!). Reading them helped me to understand how it works. Now when I go read the documentation on MSDN, it makes sense!.
  • Talking about MSDN, the quality of the documentation varies. At some points it is very comprehensive and includes tutorials and guides and everything, and can be read as an introductory book. However, at other points it already assumes you know how to do what you want to learn, and only includes a very broad overview and reference information. Not that the documentation in most Linux or free/open source projects is much better in general, mind you...
  • Update: I also want to correct my previous assertion that there was few documentation and my assumption that they kept it scarce on purpose for book publishers' sakes. It turns out there is plenty of documentation (see the point above), only that I didn't know how to find it, as it wasn't in the Express Edition help files. I think. Anyway, it's all online on MSDN.

Dúas semanas despois

O 15 de agosto publicara unha historia aquí dicindo que ía empregar Windows máis a miudo, e incluso ía a aprender a programar para Windows. Vexamos como me vai:

De tódalas diferencias entre Windows e Linux, a que máis noto é que en Windows non existe a “selección primaria”. Iso é o nome técnico da característica de X-Window pola que, se seleccionas texto co rato, despois podes pegalo en calquera sitio premendo a roda do rato. Como estou afeito a usalo continuamente en Linux, en Windows sempre esquezo premer Control-C e Control-V para copiar e pegar.

Tamén, coma dixen antes, estou a aprender a programar para Windows. Ao principio descargara o Visual Studio C++ Express Edition (por iso de que é gratuito), pero resulta que ten tantas limitacións que incluso me impedía traballar. Por sorte, na web de Microsoft hai dispoñible unha versión de avaliación do Visual Studio Professional Edition, que ten todas as características pero está limitado a 90 días, así que a descarguei (3 GB) e estou a empregala agora.

O programa que estou a facer é un cliente de Twitter. Ao facer este programa poderei traballar en moitas partes de Windows distintas, coma a interface de usuario, as comunicacións pola rede, APIs para interpretar XML e traballar con gráficos, etc. Hame dar bastante traballo porque teño que aprendelo todo segundo avanzo, pero xa conseguín facer un programa que amosa unha fiestra e pode descargar datos de Twitter e amosalos en formato XML tal como os recibiu do servidor:

Unha imaxe da fiestra do programa.

Ah, e tamén xoguei e acabei o World of Goo. Ese é un xogo que consiste en unir bólas pegañentas formando estructuras para acadar un obxectivo. Fixérono entre catro persoas cun presuposto de 10.000 dólares, e tivo moito éxito. A verdade é que é un xogo precioso, e paga a pena. Ah, e funciona en Windows, Mac e Linux (e hai versións de demostración para as tres arquitecturas).