Books to learn

A huge stack of books by austinevan

A huge stack of books by austinevan

There is two kind of software developers: those who are still learning and those who stopped learning. Please do not be the later. If you want to stop learning, at least wait until you are old. Wait until you are really old. Wait until you are obviously old, like cold dead. Software development is not really for living people who do not want to learn.

Since I completed my degree, I choose to not to be the kind of developer who stop to learn. As a matter of fact, I have been buying around ten to twelve software development related books per year on average since I left the university. Not only did I buy them, but I read them all.

I have started buying the really good ones recommended by most people like Code Complete, Rapid Development and The Mythical Man-Month. Then I moved into the less but still highly recommended books. I am now starting to exhaust most obvious recommendations I can find on the web. I also have another problem which is space. I do not have much space left in my office to store them all. I will have to buy another bookshelf in a few weeks to make some room.

Books are not all made equals. Some of them are quite thick and dense while others are a few pages long with big pictures in them. Some of them gives a better chance at learning to your brain while others are not forgiving. This brings me to the Head First series.

The Head First series is designed to make you think and remember stuff you read. This is plain and simple. Let’s take the design patterns books example. In one corner, you have the official reference: Design Patterns: Elements of Reusable Object-Oriented Software. This is the book that mostly started the design patterns’ field. In the other corner, you have Head First Design Patterns. Both of these books will teach you about the same thing, but you will learn more and, most importantly, you will remember more with the Head First one. If you have only one book to buy, get the Head First one. If you have the money, I would suggest you would still buy and read them both.

How you can learn more with the Head First books? It is well explained in the book, but to summarize it, it is full of pictures, it makes you feel and it repeat the same stuff in different ways. You can check out the Head First website to learn more about it.

Since I have the money, I usually buy many different books on the same subject to have different points of view. You can do the same, but if you do not, you should have a serious look at the Head First books.

Drupal development team setup

Recently, I had to find some ways to setup a Drupal development team with many developers working in different locations.

I searched the web and I asked a few questions in the Drupal help channels, but I did not find anything or anyone with a good environment setup for how to develop a Drupal application with a team. Here is how I would setup such an environment.

First, you need a good version control system to track changes and share them in the source code. Use the one you know and focus on it. If you want a very good one, have a look at Mercurial. Than you need a good bug/issue tracker. There are plenty of them of various quality. Use the one you know and stick to it. You need it because you know there are bugs. They never miss a chance to show up at the party.

Next, you need some local hosting stack to develop and debug your application that can run Drupal. If you are on Windows, I suggest you have a look at XAMPP. It includes all you need to get Drupal up and running in no time including Apache, PHP and MySQL.

I am a big fan of the development principle that says that each developer should be able to screw up his development environment if he wants to. This means that each developer should run the whole application on his PC. No code directly shared on a server somewhere and no shared database. This way, one developer making a part of the application crash will not impact another developer.

With a good VCS, it is easy to manage code changes from one developer to another and share them. Managing database changes is a much harder task. What we have been doing is to use file that contains the full database and a virtual lock on the database. We had a ticket in our issue tracking software that was associated with the lock. Whoever was assigned to that ticket had the access to modify the database. Whenever he was done, he would put it back to unassigned and someone else could take it to do some database changes.

The database virtual lock is a good comprise in my opinion for Drupal. There are many other ways this could be done, but because of the way Drupal works with some of the common modules, a change in the database administration section of the application can have multiple impacts in different tables. Tracking those changes would be painful and error prone.

Another important point to have is a good editor with PHP support. Eclipse with the PDT pluging is a nice choice.

Finally, if you are to start any Drupal project, I suggest you have a look at Pressflow. It is a 100% compatible fork of the Drupal core that includes some of the most interesting features you could not find elsewhere.

Automating my PC maintenance tasks

Automate it by Gastev

Automate it by Gastev

Recently, I automated a few of my deployment processes. They were taking too much time to do and they were frankly boring. I managed automate everything including the database backup, putting the site in maintenance mode, creating the file package, sending the file package, extracting the file package on the server, preparing the database package and sending the database package.

Back at home, I was still doing my manual PC maintenance tasks. I finally got tired of it. I decided it was time to get productive and avoid those boring tasks.

There is two maintenance tasks I was doing regularly that needed more attention: defragmentation and backup. I started by looking for some usefull tools. For backup purposes, I did a few searches and I found that rdiff-backup suits all my needs. It is open source, built with Python, I can easy extend it if I need it and it is free. For defragmentation, I went to one of my favourite freeware site and found Auslogics Disk Defrag. It is free and includes a command line version. This is all I needed to get started.

Next comes the when. I asked myself when was it the most appropriate time to run those maintenance tasks. The best answer I could came up with was when I am not using my PC. Obviously, the PC has to be running to execute those tasks. I also wanted to run those tasks once a day.

I started to look at finding some idle time on my PC. Should I run those tasks when my screen saver starts ? When does my screen saver actually starts ? What is an idling computer ? I started to dig at that definition and I found out there is no definitive answer on that. There can be no interactive activity on my PC (i.e. the mouse is not moving and there no key strokes) but that does not mean there is no background process using all the CPU, memory, disk IO and network. I would not want my maintenance tasks to start at that time.

After that, I though about how I use my computer. I usually turn it on sometime after I come back from work and turn it off before going to sleep. A good opportunity to run those tasks would be just before it turns off. I found out Windows has a mechanism for shutdown scripts. I added my scripts there.

A few days later, I had to let my computer turned on for more than one day. It stroke me as a lightning. If I am leaving my PC turned on, my maintenance tasks will not be executed. I added a scheduled task to start my maintenance script at 4:50AM. Since I am usually not in front of my PC at that time and I do not mind the resource usage involved, I think it is a good compromise.

This sums up the process I went into to try to optimize those automated maintenance tasks. There is still one minor problem with this setup. Sometimes, I want to reboot my PC for some updates and I do not want to run the maintenance tasks. If you know a way to detect a reboot in the shutdown scripts or to add a switch somewhere in the shutdown process that I can detect with my scripts, let me know.

For your information, here are the batch scripts I am using.

set MYDEFRAGPATH=C:\Program Files\Auslogics\Auslogics Disk Defrag\cdefrag.exe
set DEFRAGLOGFILE=C:\Program Files\Auslogics\Auslogics Disk Defrag\daily-defrag-logs.txt
set DEFREGLOGHTML=C:\Program Files\Auslogics\Auslogics Disk Defrag\logs
echo ************************************* >> "%DEFRAGLOGFILE%"
echo Shutdown Daily Defrag: %DATE% %TIME% >> "%DEFRAGLOGFILE%"
echo ************************************* >> "%DEFRAGLOGFILE%"
"%MYDEFRAGPATH%" -c -log:"%DEFREGLOGHTML%" >> "%DEFRAGLOGFILE%" 2>&1
set BACKUPLOGFILE=D:\Backups\logs.txt
set RDIFFBACKUPPATH=C:\Program Files\rdiff-backup-1.2.8\rdiff-backup.exe
echo ************************************* >> "%BACKUPLOGFILE%"
echo Shutdown Backup: %DATE% %TIME% >> "%BACKUPLOGFILE%"
echo ************************************* >> "%BACKUPLOGFILE%"
"%RDIFFBACKUPPATH%" --force --remove-older-than 1M "D:/Backups/Documents and Settings"
"%RDIFFBACKUPPATH%" --exclude "C:/Documents and Settings/MyPC/Mes documents/Downloads" "C:/Documents and Settings" "D:/Backups/Documents and Settings" >> "%BACKUPLOGFILE%" 2>&1

Being lazy

Alright, so I have been lazy lately. Very lazy. I have not posted on my blog for a while. I did not do all those nice projects I wanted to do. I did not help with those open source projects I wanted to help. I feel bad. I have not put much time into making sure the only public project I have, yaCAPTCHA, is working properly with the latest stuff. I feel ashamed.

I am going to blame games for this. I got three games for my birthday. They are all long time consuming RPGs including Dragon Age Origins which is the best time sink I have had. I was mad when I made those suggestions. I should not ask for game as gift anymore. One of my friend got crazy with online poker and I felt in the trap. You shall not waste time with games is my new motto.

In order to redeem myself, I will be fixing this bug with Open Office. It makes my girlfriend go crazy and the last thing I want is having two crazy people living together like this. My real quest is set. Let me open the quest book and see how to get this thing started.

My first though was to develop this fix on Windows, but when I saw how difficult it was to setup a build environment on Windows including all the messy stuff I would need, I decided I will do it on Ubuntu. I am now setting up a virtual machine to do this.

I hope I can keep the focus and complete this.

The doomed relationship of MVC and server web development

This relation is about to end by WolfS♡ul

This relation is about to end by WolfS♡ul

Many web frameworks are structured around the MVC pattern for server web development. The relationship between the use of MVC and server web development is fatally doomed. Here is why.

MVC in itself is a wonderful pattern. In case you do not know about it, here is a quick snippet from your preferred source.

Successful use of the pattern isolates business logic from user interface considerations, resulting in an application where it is easier to modify either the visual appearance of the application or the underlying business rules without affecting the other. In MVC, the model represents the information (the data) of the application; the view corresponds to elements of the user interface such as text, checkbox items, and so forth; and the controller manages the communication of data and the business rules used to manipulate the data to and from the model.

It is a pattern that has brought success to many software projects. It is popular and used in many places.

In the traditional sense of web development, it would look close to this:

In this case, the browser is treated as a view, the application server contains the controllers and the database or any other storage mean is treated as the model. The problem with this pattern is that it is getting further and further way from the real usage. What has changed is the browser. It is less of a simple viewer today than it used to be.

In case you have not noticed, the browser is the new operating system. It can store data, manipulate and process data in multiple ways and it can shows more rich data than before. The browser is not exclusively used to show simple linked and static pages anymore. It is running full blown applications. With the explosion of Javascript, you can expect this trend to keep growing.

This is what we are going towards for web development:

This does not eliminate the MVC pattern. It could still be used for the application running in the browser, but I think it will kill the most of the MVC server web development as we know it today.

In order to develop the application generator or provider, we will need better tools than what we have now. Maintaining a bunch of CSS, HTML, Javascript and server side code files is not realistic anymore if you want to scale, develop rapidly and have a pleasant developing experience.

This is where tools like Google Web Toolkits and Pyjamas. We need more of those tools.

My rant about Rational Team Concert

Not everyone likes what IBM is doing by Looking Glass

Not everyone likes what IBM is doing by Looking Glass

I have started using Rational Team Concert (RTC), version 1 and 2, at work for my latest project. RTC is an IBM product based on the Jazz Foundation platform which integrates work item tracking, builds, source control, and agile planning. It tries to manage most of what a software development team will need to do with the same tool.

In that sense, it is similar to Team Server Foundation by Microsoft. You might remember my rant about it.

RTC is geared towards big enterprises. The initial cost for the standard edition is probably enough to justify not to use it for most small and medium teams or companies.

Like many IBM products, RTC tries to do everything from defect management, automated builds, planning to source code management. I must admit that overall, it does manage this feat to a good level.

Without any other delays, here is what I dislike about RTC.

It sends whole files on the wire instead of deltas

Imagine you have a 100 Megs file that needs to be modified and sent back in your central repository multiple times in a day. Let’s also pretend that you are simply changing 10 characters in that file each time. With RTC, whenever you send those changes are sent back in your central repository, the whole file will need to be transmitted on the network instead of the 10 characters.

This is simply unacceptable. It is a waste of network resources and a waste of my time because I need to wait for this transfer to complete. It seems like some operation depends on other ones and you cannot perform them in parallel. Whenever I tried to do too many long operations at the same time with RTC, it shows a model progress windows that completely disabled my ability to use my IDE.

A simple diff algorithm on the client side or on both side would use a few of my heavily underused CPU cycles and it would be way more efficient. This is one of the base concept of most version control system out there. Subversion has been doing this for years now.

It is centrally based

It seems like most people have not discovered the joys of distributed version control yet. During the course of my normal usage of RTC, I have had network failures and disconnects with the RTC server. As soon as I was disconnected, I was left in the cold dark state of anger because I could not do much about managing my source code. For that reason alone, it should be distributed.

It is treating me as an idiot who do not know what he is doing

Whenever I try to do something that might have some repercussions, it shows me a popup asking me if I am sure I want to do that. Here is a typical scenario:

  1. I check-in some files while keeping some files unresolved (not checked in).
  2. I associate a work item with the new changeset because it is a precondition to delivering a changeset on the project.
  3. I try to deliver the changeset.
  4. I get a popup asking me if I am sure I want to deliver those files without including the other files that are unresolved.
  5. I confirm this action by clicking on yes.
  6. There are errors in my project that triggers a precondition failure that makes me unable to complete the delivery.
  7. I override that precondition so I can complete my delivery.
  8. I click on the “Retry” button so my delivery can be retried with the precondition overridden.
  9. I get another popup asking me if I am sure I want to deliver those files without including the other files that are unresolved.
  10. I confirm this action by clicking on yes.

Those popups are everywhere within RTC. Many of them are modal ones too. I am not an idiot. I know what I am doing. Stop bugging me and provide facilities to revert my mistakes.

You cannot easily name a revision in the past

There are two named revision concepts in RTC: snapshot and baseline. In short, a baseline is for a component (a kind of project division) and a snapshot is a group of baselines. The problem is that you cannot create them for revision in the past. You can only create them for your current workspace. If you forgot to create a snapshot for your latest deployment, it is just too bad for you. If you really want to create it, you will need to update each file to the state where it was when you did your deployment and create a snapshot with the files in your current workspace. The ugly side of this is that you cannot update your workspace to look like a revision in the past easily either.

Read-only file updates make your project out of sync

For our project, we had some files that were read-only but needed to be updated once in a while. Every time we had to update those files and they were accepted on the developer’s PC, it would put the projects in the related baseline out of sync. It is a state where you cannot do any operations with RTC without having multiple popups telling you that you need to resync your projects. The read-only file updates is only one way to get your projects out of sync. We manage to reach that state in different scenarios.

In other to correct that problem, we had make the files writable and perform the resync operation. This was a real pain.

Considering the whole thing, RTC is not such a bad product. It just has many quicks that are unpleasant and difficult to bear with. If you have the money and want an enterprise product, go for it. If you do not, there are multiple free solutions out there that can do most of what RTC is doing and that can do it better.