Fun with Visual Studio

Sometimes I love the error messages visual studio produces!

The Productive Developer

This post lists useful tools and habits for developers in order to become more productive. It is based on my experience and some information I extracted from the book “The Productive Programmer“. I try to keep the list short and because I am a .NET guy it will be coined a little bit more to the .NET platform. Still most of the information will be useful for other developers too.

The command line is where we come from …

  • Typing things and using keyboard shortcuts is faster than using the mouse, because you can keep your hands on the keyboard. Therefore: Learn your shortcuts!
  • Have a decent command line at hand. The *nix guys have their bash and other consoles to use.  I really like GUAKE which integrates the shell right into your desktop environment. By hitting F12 it comes down like the in-game console of a FPS (such as Quake for example), another F12 and it is gone again. For windows I have found something similar: Windows Quake Console. I configured it to use Windows Powershell.

IDE

Visual Studio 2010 supports extensions, use them! Most useful extensions and add-ins:

  • Productivity Tools
  • VS Commands
  • Power Commands
  • DevExpress Tools
  • Nuget Package Manager
  • Test-Driven .NET

Clipboard

How often do you find yourself copying over some stuff from one program to the other. While copy pasting code in general might be considered as a code smell, you might want to copy other things than code from one document to the other. The regular clipboard is highly ineffective especially if you need to copy more than one passage but not all. Normally you end up switching between the documents, pressing CTRL+C and CTRL+V. A better way of doing it is to install a multi-clipboard utility such as Ditto. You can first copy all the passages from the source document and go to the target document and insert the content where you need it.

Libraries

Use existing frameworks and libraries where it makes sense. Do not reinvent the wheel. Do no use a framework just for the sake of using a new technology.

Communication Channels

  • Try to maximize the focus and minimize all possible sources of disturbance. Put your instant messengers to “Do not disturb”.
  • Try to check E-Mails at specific times ( e.g. in the morning + after lunch)
  • Get some noise reduction head phones if you work in a loud office :)
  • Less disturbance means that it is easier to get into the “Flow” and hence more productivity
  • Be responsive on those few communication channels you have left

Multi-Tasking

Multi-Tasking is a myth. I would actually call it “Rapid Task-Switching”. Minimizing those switches most certainly results in a productivity gain: “Stop starting, start finishing”.

This list is rather incomplete, I will update it from time to time …

Acceptance testing with FitNesse and .NET

FitNesse is an open source software testing tool which can be used to do acceptance testing in a lot of different scenarios. It was originally developed to test java applications but can also be used with some modifications with the .NET framework. Since the documentation for using it in .NET is widely spread across the web I decided to write down some of the information that I have found useful in a few posts. Another useful resource of information is Gojko Adzic’s book about Fitnesse. This post sums up briefly what you need to do in order to

  • … install and run FitNesse
  • … develop the integration layer
  • … create a test page

Read more

Pages: 1 2

How to use ZFS and Encryption on a ubuntu home server

Recently I set up a home file server out of old hardware and installed ubuntu server edition. The idea was to make use of my old hard disks (which range from 80 GB to 500 GB capacity) and the next time I replace a hard disk it should be easy to integrate the old disk into my home file server. ZFS is perfect for this purpose because it allows to add disks later on to a pool and we do not need to use LVM and extend file systems and so on. Unfortunately the linux port of  ZFS can only be run in user space currently (ZFS FUSE). Anyhow this is good enough for my home server!

Installing ZFS is straight forward:

sudo apt-get install zfs-fuse

In order to setup your ZPool you can check out this article. For my special purpose – I simply wanted to stripe the data across all my hard disks – I used this command:

sudo zpool create storage /dev/sdb /dev/sdc

Remember to replace sdb and sdc with your hard disks you want to use.  To destroy the zpool again you can use:

sudo zpool destroy storage

But what about encryption?

There is a  project to build in encryption for ZFS on OpenSolaris (I think they have integrated that already). I am not sure that the ZFS fuse port is supporting that, so I went for another solution (make sure that you destroy again the zpool before continuing):

First create a partition on each hard disk drive you want to use.

sudo fdisk /dev/sdb
...
sudo fdisk /dev/sdc
...

Next install LUKS:

sudo apt-get install cryptsetup

Now it is possible to encrypt the partitions. I am assuming that the disks are new (and therefore empty), otherwise you want to wipe out the content first. This can be done for example with this command:

sudo dd if=/dev/zero of=/dev/sdb1 bs=512

To encrypt the partitions, you can use for example this:

sudo cryptsetup --verify-passphrase luksFormat /dev/sdb1 -c aes -s 256 -h sha256
sudo cryptsetup --verify-passphrase luksFormat /dev/sdc1 -c aes -s 256 -h sha256

In order to unlock and map the partition use (/dev/mapper/encrypted1 and /dev/mapper/encrypted2):

sudo cryptsetup luksOpen /dev/sdb1 encrypted1
sudo cryptsetup luksOpen /dev/sdc1 encrypted2

Now it is possible to use the encrypted partitions as the base for our zpool:

sudo zpool create storage /dev/mapper/encrypted1 /dev/mapper/encrypted2

The result is an encrypted ZPool. You simply need to repeat the process of creating an encrypted partition for each hard drive you want to add. If you do not enter the password and map the encrypted partitions ZFS will report “Faulted” as the state. After entering the password it will report “Healthy”. Remember restarting zfs-fuse after unlocking the drives.

Improvements

Instead of using a password it makes sense to use a key file on a USB stick, so that you can put that in while booting your home server and everything is loaded automatically (like the keys for a car).

Entity Framework 4.0 Code-First vs NHibernate

Microsoft’s .NET Framework Version 4 includes a version of the Entity Framework, which allows two ways of creating your model: Database First and Model First. Database First was already available for the previous version of Entity Framework. It means that Visual Studio’s Wizard is used to point to a database and Entity Framework generates the model classes and mappings out of the database tables. Very often the domain model looks different than the data model, which means either developing another mapping layer between the generated classes of Entity Framework or a lot of customization on the generated classes themselves. For this reason it is also possible to use the Model-First approach, which allows you to use the graphical designer and design your model first and then let entity framework generate the database schema and mappings.  Lately another approach has been introduced as a CTP: Code-First.  Instead of using the designer,  Code-First allows you to code your domain with POCOs and persist this plain model using Entity Framework. This article compares Entity Framework 4 Code-First CTP with NHibernate in terms of usability (not performance-wise) using examples of domain driven design concepts.

Read more

Pages: 1 2 3

Impressions of Lean and Kanban 2010 Europe

This post is short summary as well as a collection of ideas and impressions of the Lean and Kanban gathering in Antwerp organized by Agile Minds. According to David Anderson (one of the speakers) it has been the biggest conference on this topic so far: agilility is spreading in software development ( let it be Scrum, Kanban or any other agile methodology) and it is also growing on enterprise level.

Read more

How software architecture can support agility

Software architecture and design has a major impact on success or failure of software projects. How can a good architecture be classified? Which are the architectural key features that decide if a project succeeds or fails? How can architecture support an agile development process such as Scrum?

This post explores attributes of software designs that are required by agile development processes. Furthermore it discusses the differences between classical big up-front designs and the agile way of doing it.

Read more

Inversion Of Control

Introducing inversion of control into your enterprise application improves flexibility and maintainability. In this article I want to explain the concepts of inversion of control and dependency injection using an illustrating example based on unity. Read more

Useful development tools

Steps to achieve even more code quality

In the last post I described methods and practices to achieve higher code quality by improving the development environment in which a team works as well as by using different testing approaches which can be used by individual developers or independent tester groups. One additional method is to improve the quality of the code by doing code reviews on a regular base.

How can code reviews help to achieve better code quality?

  • If another developer looks over code he/she can find architectural flaws or defects.
  • Developers produce cleaner code if they know that somebody else will have a look at it.
  • Design and coding guide lines can be validated
  • Two pairs of eyes see more than one

Formal Code Reviews

Code reviews should be done on a regular base. This can be before mile stones in a project, before delivering code (cleaning up the code of a component), during prototyping in order to approve a design, etc. In this case the code reviews must be planned and should be part of the planning of an iteration (in scrum as a backlog item). Those type of reviews have a formal character and the results should be captured in a report or document which can than be distributed to the participants.

Peer Reviews

Peer reviews is are informal code reviews initiated by the developer which developed some code or a component. Another developer sits together with the initiator of the code review and they look together over the new code. The initiator can explain his code and work in ideas or directly correct found bugs. By doing so it is very important that the developer which is reviewing, does provide ideas and constructive criticism, but never destructive comments.

Pair Programming

Pairing up for programming is method which comes from Extreme Programming. It means that two developers pair up to develop a component at one workstation. This a consequent advancement of peer reviews. The person who is typing is called the driver whereas the other developer is called the observer or navigator. While the driver is programming the observer can already think ahead and find solutions for upcoming problems. This helps the driver to focus on the current task. The roles are switched frequently (e.g. every 30 minutes). This is important because otherwise the observer can loose the focus or is bored. Also the time of pair programming should be limited since it is very strenuous and developers have single tasks to do as well (e.g. answering e-mails).