Archive for the ‘Language’ Category

Rails vs. Django: a Beginner’s Point of View

Posted Monday, August 4th, 2008 by Youssef Chaker

For an agile web developer two frameworks are available for quick and easy deployment of a new website: Ruby on Rails for the Ruby fans and Django for the Python fans. These two tools should provide the same functionality and as someone who’s been working on two projects for the last month, each using one the frameworks, I have had the experience of starting from scratch on both of them and trying to learn both in parallel (or at least one right after the other without acquiring more experience in one and becoming biased for one over the other). So what has this experience taught me?

Deployment
It is very easy to start an application using both Rails or Django:
rails myapp vs. django-admin.py startproject mysite
even though one is wordier than the other it is pretty simple to start the project with all the directories and files needed automatically generated.

Starting the Server
This task is as simple as the previous one:
ruby script/server vs. python manage.py runserver
in both cases there is a call to the language in use, then passing a command. In Rails’ case the command is an executable found in the “script” directory whereas in Django’s case the command is an argument passed to the Python manager.

Configuration
Both frameworks provide a place to configure the application. Rails provide an entire directory to configure the database setup and the Rails environment whereas Django provides a settings.py file where all the configurations can be present but also provides the option of having a config directory for multiple personalized configurations.

Updating the Database
Yet another simple task:
rake db:migrate vs. python manage.py syncdb
In this case we notice that with Rails the call is actually to “rake” whereas for Django it is still consistent with the previous format. But we’ll see that Rails is also consistent where “rake” is called for everything relating to the database.

Creating Models
Where some of the differences begin:
With Rails you create one application that can have multiple controllers, models and models and link to each other using ruby script/generate * (where the * differs depending on what needs to be generated).
Whereas in Django you create multiple applications which each has its own models and views using python manage.py startapp myapp

Documentation
It seems that Rails is more widely used which results in more available resources online for documentation and help. None the less, the Django documentation site is very extended and provides sufficient help.

The Dirt
In the case of Rails I started the project from scratch by first following with the example in the book Agile Web Development with Rails, Third Edition and then applying what I learned to the project I was working on. Whereas in the case of the Django project, I was put on it late in the development process and tried to learn the language and at the same time understand what was already done on the project. My experience with both has been limited and what I have found is that the Rails magic seems to be the difference maker for most people. The majority are not comfortable with that “unknown” but I have seen some magic done with other languages like Java, although it is not the same type but in either case there is something in the background that is doing some sort of work for the programmer. And I have become comfortable with such a setting and because I have seen a bit of how programming languages interpreters work I understand and appreciate the Rails magic.

Even though I was more productive using Rails than I was using Django, which may have influenced my opinion about them, I am still willing to give Django a chance. Both are great tools for developing web applications in an agile manner. My recommendation though, if I have to make one, will go for Ruby on Rails, just because I was more comfortable with it.

XUL Getting Started Guide

Posted Monday, July 7th, 2008 by RJ Bruneel

I recently was tasked with creating a Firefox add-on or extension for a client and here are some of the things I wish I had known before I began. XML User Interface Language (XUL) pronounced “zool” is the programming language created by Mozilla used to create Firefox extensions and cross platform applications. It is a language similar to DHTML allowing someone with DHTML experience to quickly learn XUL. So far my experience with XUL has been a pleasant one. Please support the XUL community and leave comments with your experience with XUL.

Tips for development

XUL files can be opened in Firefox making it much easier to quickly view the changes you make to your code. Use the Error Console in Firefox to view error messages your XUL code may produce which can be found under the Firefox Tools menu. The Extension Developer has a nice “reload all chrome” option, but it closes all the web sites you currently have open and crashed Firefox on my computer if I had Gmail open.

XUL tools

Spket IDE is the best IDE for editing XUL I was able to find and is based on the Eclipse IDE.
Extension Developer is a Firefox add-on for building extensions.
Firebug is an awesome Firefox add-on for debugging web pages.
XUL Explorer is a nice little application to help you get started with XUL development

Resources

Mozilla Developer Center is the official web site for XUL with documentation.

Born Geek contains several great tutorials.

XUL Periodic Table has a nice web page containing most of the user interface components with source code.

XUL Planet is the unofficial web site for XUL with documentation.

PHP is the new PERL, 22 reasons PHP is hard to work with

Posted Thursday, June 5th, 2008 by Michael Herndon

PHP was one of the first languages that I learned when web design was my primary focus as a career. It seemed to be simple with plenty of examples on how to use it as well as plenty of code to grab to use on the fly in order to get the job done so that I could concentrate on what I loved the most, doing design. However along the way, I somehow got sucked into the programmer paradigm and ended up being a professional code monkey.

As such, my exposure to quite a few other languages, features, and coding paradigms have drastically increased as I’m a sucker for new technology and things of the geekified nature minus star trek, dungeons & dragons, and obsessions with super models. Now PHP seems to be more of a thorn in my side as a programmer than anything. Since I do have working knowledge of the language, especially its Object Oriented Features, magic methods, its various editors, extensions, and its limitations and quirks, I tend to get drawn into PHP projects. Working on a PHP project makes me long for a good rails or asp.net project because PHP just makes me feel dirty as a programmer.

PHP has gone the way of PERL: somewhat usable, a few good features and scripts, but stagnating with its ability to push the language itself to compete with other modern languages.

So what makes PHP so bad to work with? (more…)