How to transfer the ownership of a code?

The agile practices are not still being embraced by many organizations or they are unaware of them and old practices(any common old practice exists in fact?) are used. Since every body does not have the chance of finding a chance to work with an agile team everywhere, we sometimes work on companies where green field development is not done. Teams are supposed to work as a whole but in reality each member of the team has his own usual way of doing something so there is no common behavior across the team. If you work in such an organization and the ownership of codes is not handled by the whole team, there are always times when you have to transfer the ownership of a project. Things that I do while transferring the ownership to another colleague are as follows:

  • Don’t give the source of your project through network sharing or email as a zip file. Share it through a version control system(VCS), so if a case occurs in future, there is always a way we can track back.
  • Prepare a small manual, that will help the new owner how to set up his machine to run the project in dev/test/prod envrimonts. It may include, VCS info of project, used database/telnet/ftp urls, commands to run, PATHS….In short, write every detail to make the code run without a problem on a new machine.
  • Have scripts to make the project build->deploy->run automatically, instead of doing things manually.
  • Be asure that your code works and don’t transfer it in a unfinished, middle stage. If your code is not working, new guy will suffer a lot to understand your work and this is is really difficult at the early stages. So fix everything first and then leave it.
  • After the installment is done, run the existing code and check if the results are as expected together.
  • Always write your own tests and show the idea of testing and how to run it so that test writing practice may be also continued after you:)

Leave a Comment

Stop Vim creating backup files

Vim creates backup files *.swp and *~. If you want to turn it off on windows, find _vimrc file in the Vim setup folder. And in it, after the lines;

source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim

add;

set nobackup
set nowritebackup

Not: Tim Ottinger from ObjectMentor wrote a Vim tutorial in his blog.

Leave a Comment

assert_equal is better than eyes for testing

Once again I understood why testing properly is important when I came up with an interesting problem yesterday night. I am writing a ruby program to download flash videos from sites like Youtube, Blip.tv, Metacafe… to watch them while I am offline. I have a text file. On its first line I wrote the path to the directory to store them and URLs of videos on the next lines. The content of it looks like:

c:/temp/download

http://www.youtube.com/watch?v=QZnyrp__CNU

http://www.youtube.com/watch?v=_x0YtFUYSvY

http://www.youtube.com/watch?v=_sM9vcAIYyc

…….

So, here is my plan: read the lines from file into an array, create the download directory and grab the videos to that folder. To read the lines and create the folder, I did:

lines = IO.readlines(‘c:/temp/config.txt’)

dir = lines[0]

FileUtils.make_p(dir)

When I ran that, it produced:

  1) Error:
test_initialize(TestYoutubexDownloader):
Errno::EINVAL: Invalid argument – c:/temp/download

    …..
    C:/ruby/lib/ruby/1.8/fileutils.rb:201:in `each’
    C:/ruby/lib/ruby/1.8/fileutils.rb:201:in `mkdir_p’
    C:/temp/Youtubex/test/TestYoutubexDownloader.rb:23:in `test_initialize

1 tests, 0 assertions, 0 failures, 1 errors

Very simple code, but FileUtils didn’t behave as expected. So I changed the code to:

lines = IO.readlines(‘c:/temp/config.txt’)

dir = lines[0]

# FileUtils.make_p(dir)

FileUtils.make_p(“c:/temp/download”)

This time it worked and folder is created. So I thought IO.readlines is not getting lines from file and dir is not correctly initiated. To see it ,I did:

lines = IO.readlines(‘c:/temp/config.txt’)

dir = lines[0]

puts “directory=” + dir

FileUtils.make_p(dir)

# FileUtils.make_p(“c:/temp/download”)

So when I executed the code, output is as follows:

Started
directory=c:/temp/download
E
Finished in 0.0 seconds.

  1) Error:
test_initialize(TestYoutubexDownloader):
Errno::EINVAL: Invalid argument – c:/temp/download

     …….
    C:/ruby/lib/ruby/1.8/fileutils.rb:201:in `each’
    C:/ruby/lib/ruby/1.8/fileutils.rb:201:in `mkdir_p’
    C:/temp/Youtubex/test/TestYoutubexDownloader.rb:25:in `test_initialize’

The directory path is correct since I see it on the debug output of my computer screen but still FileUtils.make_p is not doing the right thing. I passed the string manually it worked but when passed through a parameter with the correct value, the error occurs. So what maybe the problem??? :) Then I decided to make a check with assert_equal instead of puts statement. I knew that it will act same, since I saw the output on screen but did it:

lines = IO.readlines(‘c:/temp/config.txt’)

dir = lines[0]

assert_equal(“c:/temp/download”, dir)

And it produced:

  1) Failure:
test_initialize(TestYoutubexDownloader) [C:/temp/Youtubex/test/TestYoutubexDownloader.rb:24]:
<”c:/temp/download”> expected but was
<”c:/temp/download\n”>.

The trick is when the line is fetched by IO.readlines, newline characters at the end are also preserved. Eyes doesn’t detect newline characters so this type of testing doesn’t help. So they must be stripped if we want to clear them:

lines = IO.readlines(‘c:/temp/config.txt’).collect!{|line| line.strip}

dir = lines[0]

FileUtils.make_p(dir)

At last it worked :) I lost time by making guesses for the problem but the solution was simple, do the assertion test at the first time instead of making guesses or fighting with the debug output strings! The results of the puts, writeln, printf.. statements may lead us to a wrong way during testing and they must be avoided as becoming the first choice to use when tension is high in projects. Furthermore; not only for Ruby but xUnit testing tools are available for most of the other languages and testing with them is much more fun than the old debug methods!

Leave a Comment

Hello world again!

For the last 6 months, I was in army doing my military service. It is completed and I am back to civil life, work and writing. My blog was hosted before on JRoller. I carried it to WordPress.com with the help of zeusville. This is my first post here. Hope I will read, try, learn more and share them with you through this pages…

Comments (2)

TiddlyWiki-My personal agenda

I read about this swiss knife for some time ago. Last week, after reading about it again, I wanted to give it a chance and it became one of my favorite tools in my laptop. TiddlyWiki is a single file, personal wiki application. No setup is required, you just download the single empty html file and you start using it. Very cool to edit and use.

Before TiddlyWiki, my desktop was full of with files named like links.txt, blog.txt, todo.txt, bla ba.txt. I was taking notes related to work and things I didn’t want to forget in such files. Now TiddlyWiki is acting as my personal agenda for collecting such data into a unique place. There is no more redundant memo files on my desktop. It has a simple&powerful search facility which helps you easily access the thing you are looking for. Also since it works on browser, I add html links to the documents on my laptop, or webpages when I want to access them directly. For instance I have some ebooks in pdf, chm or html  format. Before Tiddlywiki I was navigating to the directories holding them and then open. But since they were distributed over different directories I had to first remember where they were located before navigation. Now I add links to the frequently used documents or web sites on TiddlyWiki and have just a single entry point to access them.

Leave a Comment

What to do today?

There may be mornings when you have no idea what to do next in the project during that day. On such mornings, I got help from a SCRUM practice. One of the practices of SCRUM is daily standup meetings. 3 questions are answered by the team members during these short meetings and at the end everyone has some info about the activities of other members. Those 3 questions are:

  • What did you do yesterday?
  • What will you do today?
  • What’s in your way?

I used this practice also in my projects. When there is no specific plan or task to do, I answer these questions in order to self-plan my day. If a daily record of your progress are not kept in the project, self-motivation by answering these questions will help you not to waste time and more easily plan your daily activities.

Leave a Comment

Trying Subversion

I finally setup Subversion to a windows server in our company. Apache web server is used for http-based access to source control system. I had a problem during Apache on win32, Subversion integration which says that the module mod_dav_svn can not be found when the mod_dav_svn.so file was in \Apache\modules. It was a crazy and dummy mistake. Solution was moving libdb43.dll file to \Apache\modules directory, problem has no relation with mod_dav_svn.so file. Apache error message is just misdirecting!

My Java IDE, Intellij IDEA, has tools to access Subversion, no need to search for SVN plugins. SVN is easy to set up and use. The usage of TRUNK-BRANCH-TAG pattern for release management is very easy to configure and use. From now on I can access the sources from anywhere independent of location and whether the local connection has a firewall since I have HTTP-based connection to SVN through Apache. I like open-source ideas which makes my life easier:)

Leave a Comment

When to write code comments? Comments must be written?

I saw many developers who are writing comments/copyright information while writing their codes. These innocent commments seem harmless at the first hand. But I believe that no comments must be written during development phase. Comments must be deferred until the last minute when everything is ready for production. Because:

  • Comments decrease the readibility of the source code during development phase. Developer does not need a comment in order to understand his own code. If he needs comments, that means the code is not clean and simple enough. So refactoring and cleaning must be the first action, instead of writing comments. Uncle Bob Martin wrote a good article about clean code.
  • During development phase, requirements may change. When requirement changes, the code handling the requirement also changes. If there is a comment for the code, it must also change. As a result, the chained dependency brings extra cost to project development time.

So in general, I believe clean code is more important than adding comments. If a necessity really forces for writing comment, for instance for an API, it may be written. But before adding it, everything must be tried in order to remove the comment from code.

So why most developers write comments to his code?

I believe one of the reason for this is that the developer is aware of the fact that there is something complex in the code and assumes that comments will make everything fine. So comments are mostly written as an excuse to the outcomer for the ugly code.

Another reason is the study resources. Usually developers learn new techs by going over the samples distributed with the technical writings. Most of these writings include comments in every piece of code. So a new java student learning from a book sees comments with every getter/setter method which is not necessary. As a result, he uses the same technique in his own developments and everywhere is covered with comments.

Leave a Comment

Google Techtalk Videos

Do not worry if you can’t attend the seminars of famous names from software industry. Google is sharing the videos of the tech seminars given inside the company.

Leave a Comment

BuildMonitor-Watch CruiseControl from your Firefox status bar

We use CruiseControl at work for managing the build operations. Whenever a build fails, an email is sent to the project owners by CruiseControl for the notification of problem. Since this email is sent to the relevant parties, others, monitoring CruiseControl for their projects is mostly unaware of these build problems.

While I was surfing, I come up with an extension to my Firefox browser, BuildMonitor, which stays on your browser’s status bar and gives information about the overall status of CruiseControl’s continuous build process results. My browser is mostly open and with BuildMonitor I have the updated info about all CruiseControl builds. The only pitfall is it only works on Gecko-based browsers and doesn’t support IE.

Comments (1)

Older Posts »
Follow

Get every new post delivered to your Inbox.