Alternatives 2.0

You may know that ruby and rails hype is fading and there are lots of interesting platform that have the same good points of rails like the rapid development even if they are almost unknown. Some, like the perl catalyst, are faster, other like the new python turbogears provide everything rails gives you and overall in a cleaner, more rational shape.

Obviously you hardly heard about them or how good they are since there isn’t enough people blogging and gloating about how good they are or how many kool points your achieve by using them.

Well I’ll start some small post about it with some obviously biased comparisons, just to raise curiosity and foster discussion, let’s start with the template engines.

Catalyst suggests the use of TT by default. It is fast, quite lightweight and simplifies the perl constructs a bit.

Rails has erb as template engine with some faster implementations than the stock ones like erubis (that usually saves your day once you notice how pitiful rails is about performances).

Turbogears let you pick whatever you like, but right now suggests/bundles genshi since it’s quite fast, uses an xml compliant markup so you may edit it with your favourite xml/xhtml editor, the parser will error out if what you wrote isn’t compliant to your dtd/schema giving you a nice output pointing where it is broken like tidy does for you static content, since it is xml you may generate rich xhtml pages embedding svg and mathml with relative ease.

That’s all I hope someone will debate if is better have your template engine use a more compact markup even if then you cannot use it common tools to edit your views structure or the possibility to fully harness xml good points out weights the relative verbosity.

I will discuss ORM and models in the next post.

Liskov Substitution Principle Reflection

I have found a quite interesting shakespearean article about Liskov Substitution Principle. It is mainly about C++, but being it the core of Object Oriented paradigm I think that it might be interesting for everyone.

Most of the think is nowadays resolved with mixins and Policy Based Design, but they run away a bit from pure Objects Oriented and so is still an interesting reflection

So if you are interested take a look at this  Blog Post

FlyPDF now has C# support

FlyPDF the multi-language PDF generation library we develop in collaboration with OS3 now has C# (.Net) support bindings. Also improvements have been made to the C bindings implementing callbacks to override default header and footer generation. Also the Write method for flowing text has been made available to all the language bindings including C++ and Python.

Also Fabio Rotondo from OS3 had a speech about FlyPDF at the Italian PyCon which had quite a big success.

The misunderstood one

I’m a usual follower of C++ related blogs and newsgroups and still I’m impressed how much this language is misunderstood after 10 years of a precise standard. I’m actually starting to ponder if we are ready for C++0x while a lot of people yet misunderstand C++98 and C++03.

I often end up discussing with my colleagues about the fact that they prefer a less powerful, but more reliable and less obscure language like C. I know that C++ isn’t one of the easiest languages to master correctly and I also know that it has some problems about compilers often changing their behaviour and with slow templates compilation time. All things that C++0x is trying to make easier or faster with extern templates, move constructors, delegate constructors and type determination.

C++0x will be a quite complex and advanced language, which will give the programmer a lot of control over the compiler, but still after 10 years of existence of the standard C++ and formal STL libraries you can find posts like this which confuse good design practices and theories with runtime optimizations.

Having the stack container with the pop method returning void is exception neutrality not a runtime optimization. Strong exceptions safety means that the operation has either completed successfully or thrown an exception, leaving the program state exactly as it was before the operation started.

What would happen if we have a T pop() method returning the head after removing it? We might have the copy-constructor of T fail throwing an exception and find that after removing our head we also lost it forever. Having it just remove the item means that our code might only have success removing our item or fail to remove our item leaving the state exactly as it was before.

This is one of the first issues raised years ago, an issue discussed in depth since the article of Tom Cargil in 1994. An issues explained by Meyers and Sutter in their books and available in a lot of community blogs like the boost one. And still this isn’t clear even to long time C++ developers.

C++ is a multipurpose language, having all that freedom of movement requires more deep knowledge of the language itself. Shouldn’t we change how C++ is taught and more strictly enforce some practices before moving to a new standard? As a sporadic C++ teacher I often end up with this question…