Aug 08 2008

Somebody needs to think about the quality

Category: Programminglomaxx @ 9:20 am

Dare Obasanjo had a great blog post the other day on the second system effect. One of the points he makes is

You Can be Date Driven or Feature Driven but not Both

He goes on to say why you can’t be both, but he doesn’t really touch on the fallout of running a project which is both feature and date driven. I recently worked on a project that was both feature and date driven and when you can’t comprimise features or the deadline, you have to comprimise somewhere else. That somewhere else is Quality.

We ran into a couple of problems mid project that put us about a week behind schedule, but unfortunately we weren’t given any more time and features weren’t dropped. What we ended up doing was getting rid of the unit tests in our code, getting rid of 1 week UAT and there was no documentation.

Now there are people that read this and think "well if you have to ship, you’re going to have to comprimise somewhere", but if these are the places you comprimise you are playing a very dangerous game.

By compromising all these areas, you’re reducing the quality of the work that you produce and it means you’re taking a massive risk.

When you’re working on projects, you need to realise that setbacks are going to arise and almost always the correct course of action isn’t to cut the quality out of what you’re doing because it’s only going to burn you in the long run. You need to sit down and seriously evaluate what this setback means and look at every other area you can comprimise before you start cutting back on quality. Doing so not only increases the quality of the project but increases the chances of having a successful outcome to your project

[?]

Jul 30 2008

Do we really need comments in code?

Category: Theories, Programminglomaxx @ 10:00 am

Recently Jeff Atwood posted about Coding without Comments. Not only do I agree with Jeff’s post, I would actually like to see comments removed from code altogether. The other day I was working with the amazing FileHelpers library from Marcos Meli and needed to dig into the code to add some extra functionality. Now I’m not having a go at Marcos, or the library itself, but I’m just using this as an example because it highlights exactly the problem I have with comments in code:

#region "  © Copyright 2005-07 to Marcos Meli - http://www.devoo.net"

// Errors, suggestions, contributions, send a mail to: marcos@filehelpers.com.

#endregion

#if ! MINI
using System;
using System.Data;
using System.Data.SqlClient;

namespace FileHelpers.DataLink
{
    /// <summary>This is a base class that implements the <see cref="DataStorage"/> for Microsoft SqlServer.</summary>
    public sealed class SqlServerStorage : DatabaseStorage
    {
       
        #region "  Constructors  "

        /// <summary>Create a new instance of the SqlServerStorage based on the record type provided.</summary>
        /// <param name="recordType">The type of the record class.</param>
        public SqlServerStorage(Type recordType)
            : this(recordType, string.Empty)
        {}

        /// <summary>Create a new instance of the SqlServerStorage based on the record type provided.</summary>
        /// <param name="recordType">The type of the record class.</param>
        /// <param name="connectionStr">The full conection string used to connect to the sql server.</param>
        public SqlServerStorage(Type recordType, string connectionStr)
            : base(recordType)
        {
            ConnectionString = connectionStr;
        }

        /// <summary>Create a new instance of the SqlServerStorage based on the record type provided (uses windows auth)</summary>
        /// <param name="recordType">The type of the record class.</param>
        /// <param name="server">The server name or IP of the sqlserver</param>
        /// <param name="database">The database name into the server.</param>
        public SqlServerStorage(Type recordType, string server, string database)
            : this(recordType, server, database, string.Empty,string.Empty)
        {
        }

        /// <summary>Create a new instance of the SqlServerStorage based on the record type provided (uses SqlServer auth)</summary>
        /// <param name="recordType">The type of the record class.</param>
        /// <param name="server">The server name or IP of the sqlserver</param>
        /// <param name="database">The database name into the server.</param>
        /// <param name="user">The sql username to login into the server.</param>
        /// <param name="pass">The pass of the sql username to login into the server.</param>
        public SqlServerStorage(Type recordType, string server, string database, string user, string pass)
            : this(recordType,  DataBaseHelper.SqlConnectionString(server, database, user, pass))
        {
            mServerName = server;
            mDatabaseName = database;
            mUserName = user;
            mUserPass = pass;
        }

        #endregion

        #region "  Create Connection and Command  "

        /// <summary>Must create an abstract connection object.</summary>
        /// <returns>An Abstract Connection Object.</returns>
        protected sealed override IDbConnection CreateConnection()
        {
            string conString;
            if (ConnectionString == string.Empty)
            {
                if (mServerName == null || mServerName == string.Empty)
                    throw new BadUsageException("The ServerName can´t be null or empty.");

                if (mDatabaseName == null || mDatabaseName == string.Empty)
                    throw new BadUsageException("The DatabaseName can´t be null or empty.");

                conString = DataBaseHelper.SqlConnectionString(ServerName, DatabaseName, UserName, UserPass);
            }
            else
            {
                conString = ConnectionString;
            }

            return new SqlConnection(conString);
        }

        #endregion

        #region "  ServerName  "

        private string mServerName = string.Empty;

        /// <summary> The server name or IP of the SqlServer </summary>
        public string ServerName
        {
            get { return mServerName; }
            set
            {
                mServerName = value;
                ConnectionString = DataBaseHelper.SqlConnectionString(ServerName, DatabaseName, UserName, UserPass);
            }
        }

        #endregion

        #region "  DatabaseName  "

        private string mDatabaseName = string.Empty;
        /// <summary> The name of the database. </summary>
        public string DatabaseName
        {
            get { return mDatabaseName; }
            set
            {
                mDatabaseName = value;
                ConnectionString = DataBaseHelper.SqlConnectionString(ServerName, DatabaseName, UserName, UserPass);
            }
        }

        #endregion

        #region "  UserName  "

        private string mUserName = string.Empty;
        /// <summary> The user name used to logon into the SqlServer. (leave empty for WindowsAuth)</summary>
        public string UserName
        {
            get { return mUserName; }
            set
            {
                mUserName = value;
                ConnectionString = DataBaseHelper.SqlConnectionString(ServerName, DatabaseName, UserName, UserPass);
            }
        }

        #endregion

        #region "  UserPass  "

        private string mUserPass = string.Empty;
        /// <summary> The user pass used to logon into the SqlServer. (leave empty for WindowsAuth)</summary>
        public string UserPass
        {
            get { return mUserPass; }
            set
            {
                mUserPass = value;
                ConnectionString = DataBaseHelper.SqlConnectionString(ServerName, DatabaseName, UserName, UserPass);
            }
        }

        #endregion

        #region "  ExecuteInBatch  "

        /// <summary></summary>
        protected override bool ExecuteInBatch
        {
            get { return true; }
        }

        #endregion

    }
}

#endif

There are 167 lines of  "code" in this example

However, if you remove the comments and regions and have a quick re-organisation of the code you can reduce this file down to 110 lines of just raw code:

#region "  © Copyright 2005-07 to Marcos Meli - http://www.devoo.net"

// Errors, suggestions, contributions, send a mail to: marcos@filehelpers.com.

#endregion

#if ! MINI
using System;
using System.Data;
using System.Data.SqlClient;

namespace FileHelpers.DataLink
{
    public sealed class SqlServerStorage : DatabaseStorage
    {
        private string mServerName = string.Empty;
        private string mDatabaseName = string.Empty;
        private string mUserName = string.Empty;
        private string mUserPass = string.Empty;

        public SqlServerStorage(Type recordType)
            : this(recordType, string.Empty)
        {}

        public SqlServerStorage(Type recordType, string connectionStr)
            : base(recordType)
        {
            ConnectionString = connectionStr;
        }

        public SqlServerStorage(Type recordType, string server, string database)
            : this(recordType, server, database, string.Empty,string.Empty)
        {
        }

        public SqlServerStorage(Type recordType, string server, string database, string user, string pass)
            : this(recordType,  DataBaseHelper.SqlConnectionString(server, database, user, pass))
        {
            mServerName = server;
            mDatabaseName = database;
            mUserName = user;
            mUserPass = pass;
        }

        protected sealed override IDbConnection CreateConnection()
        {
            string conString;
            if (ConnectionString == string.Empty)
            {
                if (mServerName == null || mServerName == string.Empty)
                    throw new BadUsageException("The ServerName can´t be null or empty.");

                if (mDatabaseName == null || mDatabaseName == string.Empty)
                    throw new BadUsageException("The DatabaseName can´t be null or empty.");

                conString = DataBaseHelper.SqlConnectionString(ServerName, DatabaseName, UserName, UserPass);
            }
            else
                conString = ConnectionString;

            return new SqlConnection(conString);
        }

        public string ServerName
        {
            get { return mServerName; }
            set
            {
                mServerName = value;
                ConnectionString = DataBaseHelper.SqlConnectionString(ServerName, DatabaseName, UserName, UserPass);
            }
        }

        public string DatabaseName
        {
            get { return mDatabaseName; }
            set
            {
                mDatabaseName = value;
                ConnectionString = DataBaseHelper.SqlConnectionString(ServerName, DatabaseName, UserName, UserPass);
            }
        }

        public string UserName
        {
            get { return mUserName; }
            set
            {
                mUserName = value;
                ConnectionString = DataBaseHelper.SqlConnectionString(ServerName, DatabaseName, UserName, UserPass);
            }
        }

        public string UserPass
        {
            get { return mUserPass; }
            set
            {
                mUserPass = value;
                ConnectionString = DataBaseHelper.SqlConnectionString(ServerName, DatabaseName, UserName, UserPass);
            }
        }

        protected override bool ExecuteInBatch
        {
            get { return true; }
        }

    }
}

#endif

The thing that strikes me is that the code has been written so well that it’s perfectly clear what is happening in this class and you also have the added benefit of having a much more readable section of code.

Going back to the first sample of code, a lot of the original comments are what I would consider documentation. I agree that’s it’s important to document code, but is it really necessary to do it within the code itself?

I was discussing this with a co-worker the other day and we both agreed that a really cool feature in visual studio is to have some way of hiding comments within the IDE and placing a little token or tag in the margin of the page which would show the comments for the code when you hovered over them. Even better, would be to abstract comments out into another file, like code.comments.cs or code.comments.xml so that if people have a burning desire to comment on the code, they still can, but it just won’t be cluttering up the actual code files.

In reality, I’m still going to get beaten up in my day job for not having enough comments in my code, but I will still be pushing for less comments in code and better refactoring and documentation to support the code.

[?]

Jul 25 2008

ReSharper: Encapsulate Field Shortcut Key

Category: Programminglomaxx @ 11:01 am

To encapsulate a field in ReSharper, the keyboard short cut is

CTRL + R, E

[?]

Jul 24 2008

Instant messaging at work

Category: Programminglomaxx @ 12:04 pm
Phil B.
So I’ve been thinking about another theory
Phil B.
to do with Instant Messaging at work
Phil B.
Part of the reason they ban pretty much every messenger that lets you talk to the outside world is because they don’t want you wasting time on them
Jul 24
10:40 AM
Phil B.
but if they allow them internally, you still waste time on them talking to co-workers
Phil B.
but I was thinking, it’d be interesting if they used something like Campfire as their instant messaging protocol so people could search and view everyone else’s chat transcripts
Phil B.
It’d create a sort of instant accountability system where you know that anything you type into your instant messenger had to be work related or you run the risk of someone finding it
Phil B.
but it would also mean that the overall quality if the internal chats would be higher and people would be able to search the chats and find information that is highly relevant to work
Jul 24
11:05 AM
Co-Worker
I have a major issue with that
Co-Worker
I would prefer someone to read my email before my instant messaging
Co-Worker
instant messaging is informal and subject to opinions
Co-Worker
Email is a more formalised medium
Co-Worker
It would be like…well would you prefer someone to scan your mail at home or bug your house
Co-Worker
You can predict what is coming in the mail and you think about what is going into an email, it is direct and useful
Jul 24
11:10 AM
Co-Worker
Instant Messaging for me at least is chat time…it saves me goign to the kitchen to chat directly…which is a bigger waste of company time than sitting here pushing out the odd reply
Co-Worker
Email is used because it is an electronic paper trail…messaging is used because it is quick and personal. I think this is a good idea how you can set the topics and use that in a blog or whatever, but if you don’t change it to a topic, then I’m assuming that what I say is confidential
Co-Worker
I think most people would make the same assumption
Co-Worker
Also there is another separate issue…and that is demanding that everything at work is work related and enforcing that. I would quit before I worked under those conditions
Jul 24
11:15 AM
Co-Worker
Sure as an employer you want to make sure you are getting the most out of your employees, but that doesn’t mean draconian jail conditions
Co-Worker
In fact you will get so much more from your employees by letting them be creative, having open discussions about things…
Co-Worker
Just take google for example, the most relaxed employment circumstances in the world just about and they have some of the smartest people working for them and produce some of the world’s best most efficient systems
Co-Worker
You are better off having 10 people that are relaxed and that have a creative and inspired brain, then you are having 100 monkeys chained to a desk with spyware on their PCs
Jul 24
11:20 AM
Co-Worker
btw this isn’t a civil liberties rant…as far as I’m concerned it is business sense
Phil B.
See that’s all well and good, but if you can get past the draconian issues, surely there would be benefits to having the company as a whole reduce time wasted on messaging and used to increase productivity
Phil B.
On a side note, I think the reason google does so well isn’t because of the relaxed creative atmosphere, it’s because they create a natural "jail" in that they give you everything that you need when you are at work to encourage you to stay longer by removing your excuses to leave
Phil B.
I’m going to lunch… in the cafeteria of free food
Phil B.
I’m going to the pub to play some pool… in the lunch room
Phil B.
I’m going home to see my wife… oh actually, i don’t have one
Co-Worker
Well, I’m not a sociologist so I can’t make general statements about people…but I get bored with work because it is too easy most of the time…so if I don’t have a creative outlet (like these conversations) I will get sick of the job and leave
Jul 24
11:25 AM
Co-Worker
So what I would imagine is they will end up with a company of [witheld]’s
Co-Worker
They have no insight or understanding…but they are old school hard workers
Co-Worker
There is precious little I hate more in this world than being bored
Phil B.
true… but suppose you are bored and you don’t have IM, actually, suppose I was bored and didn’t have IM, I’d go research unit testing or dependency injection or something work related, but I woudln’t have blown the last 20 mins explaining a theory of transperancy
Phil B.
it’s like this article on lifehacker http://lifehacker.com/398483/do-you-really…
Co-Worker
Yeah salary…I think its good to have that as transparency
Co-Worker
transparent*
Co-Worker
There is a big difference
Co-Worker
Well perhaps not
Jul 24
11:30 AM
Phil B.
ok, so you’re getting annoyed at the concept that something that you enjoy on a personal level would be taken away from your professional environment
Phil B.
but how is that any different from them locking down youtube
Co-Worker
I don’t see salary as sensitive information…but my conversations I do…if I don’t feel as though I can talk openly without someone in authoty reading it I won’t talk openly, I will say whatever the person listening wants to hear
Phil B.
or facebook
Co-Worker
youtube or facebook…they are timewasters
Co-Worker
I guess my issue really is monitoring my personal conversations
Co-Worker
I am happy to have discussions with you all day rather than someone external
Co-Worker
I think my point is that this conversatoin is a creative outlet for me…organising a party on the weekend isn’t acceptable
Co-Worker
Lets be honest is facebook used for thought inspired conversation or just teenage dribble about the latest group or youtube video?
Phil B.
true
Phil B.
maybe there needs to be a comprimise then
Phil B.
some sort of middle ground where people can still have private conversations
Phil B.
but still enable the good bits to be made publicly available
Phil B.
like I was talking to [witheld] before about CGT calculations
Phil B.
it’s an online conversation
Co-Worker
Yeah see thats what I was saying about adding a topic
Phil B.
but apart from me and [witheld] and the IT admins that have access to the spark logs, once that conversation is over, it’s lost
Co-Worker
Thats what i love about this site
Co-Worker
You can go oooh…the guy just flagged this as CGT Talk…okay
Co-Worker
and start talking about whatever and then yeah it is a useful meaningful conversation
Jul 24
11:35 AM
Co-Worker
that could be referenced by anyone
Phil B.
I guess I’m willing to concede that making everything open is an extreme and there are going to also be negatives (like people will just avoid the thing and start up their own private cmapfire account) but having the ability to tag a conversation and place it in the public domain is something that businesses should really consider
Co-Worker
yep I agree 100% with that
Phil B.
perhaps you could look at making everything public tho and make it the responsibility of the conversers to take a conversation offline
Co-Worker
What exactly do you mean by ‘take it offline’?
Jul 24
11:50 AM
Phil B.
just not make it public
Phil B.
like all conversations are public unless you make it private so then you get people at least thinking about the context of their conversations
Jul 24
11:55 AM
Co-Worker
I still don’t like that
Co-Worker
but I guess I could live with it
[?]

Jul 23 2008

Developer Versatility

Category: Programminglomaxx @ 11:41 am
Phil B.
Time for another theory
Co-Worker.
lol
Co-Worker.
rant time
Phil B.
When it comes to team members I reckon developers are probably the most versitile members of the development team
Phil B.
the problem is that it also means that they can be asked to do anything from development to setting up dev environments to helpdesk support to making the boss some coffee
Phil B.
the problem is that they could potentially end up doing very little development
Co-Worker.
it all comes down to…how much is the company willing to pay for a coffee maker
Co-Worker.
See you would think –k is a bit expensive even to be sitting here doing support work
Phil B.
yeah, so the question is, should you just pay for a bunch of developers
Phil B.
of various levels
Phil B.
juniors
Phil B.
seniors
Phil B.
etc
Jul 23
11:10 AM
Phil B.
or buy people that are specialists that can’t do anything else
Phil B.
the theory is that the specialist should be able to do their job better because it’s all they do
Co-Worker.
I think you should hire for a position…and I don’t mean levels of skill…I mean needs…Development Support Officer, Developer Project Services
Phil B.
but more often than not, they just end up sucking the developers time
Co-Worker.
I think it maybe comes back to the idea of a pool…so you hgave these senior ‘experts’ and then a pool of resources..potentially just contractors
[?]

Jul 23 2008

Campfire

Category: Programminglomaxx @ 11:36 am

I started using campfire from 37 signals today and I have to say I’m thoroughly impressed. It’s fast, free (for up to 4 simultaneous chatters) and has some really cool  features like transcript recording and the ability to make different rooms for different chats.

One thing that I’m finding more and more is that my IM conversations are often about things I’d like to blog about but simply don’t have the time and I’ve often thought it’d be cool if there was a way to put the edited transcripts from my IM conversations up on my blog.

Well with campfire it’s pretty much a copy and paste operation now so I’m going to start putting the transcripts straight up on my blog when I can for things that I think are pretty interesting or relevant.

[?]

Jul 09 2008

Solving problems doesn’t make you a great coder

Category: Programminglomaxx @ 10:49 am

I came across this DotSpot site today that was advertising for coders. My first reaction was that these were interesting problems to solve but they surely could have come up with something better if they wanted to see samples of a developers code.

The problem I have with asking potential candidates this type of question is that they will spend more time figuring out the solution to the problem, than they will coding it. Once you have worked out the solution, it’s trivial to write the code to implement it.

I’m not trying to have a go at DotSpot, they’re obviously looking for people that can solve these problems, as well as code them, but it reminded me of my days of studying computer science at uni where we would be assignments that were comprised of problems to solve and then implement solutions in code. I always got frustrated at these assignments because I’d spend more time solving the problem than I did coding. I was doing a programming subject, but the programming had become a second class citizen to the problem.

I got frustrated because the concepts of programming can be hard for first timers. Pointers, memory allocation and floating point arithmetic are hard enough but throw in a couple of ridiculous maths problems and it’s no wonder our first year intake went from over 400 to just 85 after the first session.

After I finished my degree I really didn’t feel like I knew a whole lot about programming and after I started my first job, I found out I knew even less than I thought. My first six months on the job I was extremely lucky to work with some really talented guys that had plenty of software development experience and taught me about many of the key concepts of developing good OO code.

At the same time, it quickly realised and became annoyed that I had spent so much time at uni solving micky mouse puzzles and learning a myriad of unix commands, but not really learning the key concepts of programming. Since then I’ve worked with grad developers since that seem to be reasonably smart, capable guys, but have no idea about writing solid OO code.

The reality is that in a business environment, the problems are usually already solved, by the time you get to coding, you’re really just implementing a spec. You might need to do a bit of design work, but by and large, the business rules will have already solved the problems for you, you just need to translate those requirements to code. In addition, you’re not going to ever be required to solve complex maths problems using floating point arithmetic.

So why then is there this desire for universities to get students to solve problems, rather than really focus on the core concepts of programming? Sometimes places like Microsoft and Google require problem solvers to work on their R&D projcects, but for the vast majority of programmers, surely it’s more important to embed solid programming foundations into students with a strong coding focus rather than teaching them to focus on the problem first and worry about the code later. At the end of the day, the job of the programmer is not to solve the problem, but to implement it.

 

[?]

Jul 07 2008

Should anyone be allowed to write code

Category: Theories, Programminglomaxx @ 4:00 pm

In so many aspects of our lives we have come to expect, and often demand, that not only are people qualified to participate in their industry, but they are required to gain approval from a central governing body before they can participate.

In Australia there are boards and registers of people that people need to be associated before they can participate in any of the following:

Medicine
Law
Accounting
Building
Architecture
Banking

And the list goes on.

Today I came across some code in a third party application that was truly horrible. It was littered with GOTO statements, was poorly structured and clearly demonstrated that the person that wrote it had a poor grasp on the basics of software engineering.

It’s not the first time I’ve come across this level of code and I’m not the only one. Sites like TheDailyWTF are built around exposing sub standard code for the enjoyment of others.

However it annoys me that by and large, within the software development community there is no real accountability. Sites like TheDailyWTF are amusing, but it also disturbs me how much WTF style code is in current production systems. More disturbing than the existance of the code, is that it seems to be accepted that the people that write this sort of code are able to rely on ignorance, poor interview techniques are the ability to straight out lie to move from position to position without too much trouble.

We’ve all heard of contracting horror stories where the candidate passes the interviews with flying colours, but when it comes time to fire up visual studio and debug some code, they’re completely clueless. By the time anyone realises the contractor is useless, the three months is up and it’s just easier to not renew the contract, cut your losses and move on than try and seek any sort of compensation.

But what happens to the contractor? They’re free to move on to another 3 or 6 month contract with their next unsuspecting client.

Not only do other industries not tollerate this sort of behaviour, in many cases it’s illegal, yet in software development, it’s more often than not accepted.

Even if companies wanted to do something after they are burned by these renegade contractors what can they do?

In law, students need to pass a "bar exam" before they are allowed to practice and even after they pass the exam complaints can also be made to the bar about unethical or unlawfully practicing lawers which can lead to the suspension and even the expulsion of lawers from practicing. In software, there is no such system which means that companies just have to suck it up when a hire goes bad.

I would love to see a "bar exam" system for software developers that provides instant transperancy to organisations looking to hire new developers, or in fact, any IT related discipline including database design and software architecture. The developer community is often the first to cry foul when a set standard isn’t met by a piece of software, yet when it comes to applying the same metrics to an individual or group of individuals claiming to be of a particular quality, there is no yardstick by which they can be measured.

One positive we can take out of no such system existing is that it ensures that there will be plenty of content available for TheDailyWTF for many years to come.

[?]

Jul 01 2008

Local Source Control With SourceGear Vault

Category: Programminglomaxx @ 2:50 pm

After listening to the Hanselminutes podcast on distributed source control with GIT I really liked the idea of setting up a "Source Control Buffer" on my local machine. When I was explaining it to a colleague, the first thing he said was "but that doesn’t help you if your hard drive blows up" and this is true, but this isn’t the problem I want to solve by using a local source control system.

So what are the problems I was trying to solve by using local source control?

To give a bit of background, the company I work for has a fairly rigid source control implementation. They use SVN with the following structure:

  • For each new release that is planned a branch is created from the trunk.
  • For each project that is required for this release, a branch is created from the release branch.
  • All new work for a project is committed directly
  • Each project has work performed on it for the release and is eventually merged back into the trunk.

This creates a couple of problems:

  1. If we are working on something that is scheduled for release V1.0 but we don’t finish it and it gets pushed to release 2.0, we have to take all the changes that are no longer in the 1.0 release out before we can do the 2.0 release. The only way you can really do this is by manually finding all the places where you want the code to be removed.
     
  2. Sometimes I work on code that might take a couple of days to complete. If I know other people could be working on the branch, I don’t want to check in anything that could break it, but at the same time, I like to regularly version my source code so I can rollback if necessary, or just shelve the code if I need to and come back to it later. With a rigid SVN repository like the one we have, regularly checking in can be problematic for others working on the same branch.

So after giving it much thought I felt that local source control could provide me with a source control buffer that would help alleviate these problems. I originally looked at using mercurial, but it wasn’t as nice to setup and install as I would have liked. It wasn’t bad by any means, but it just created extra friction that I didn’t want.

I ended up settling on SourceGear Vault as it’s free for single developers. I didn’t really want to use vault because I had to install the server on my machine and it wasn’t a "distributed" solution like mercurial or git, but for what I want it serves the purpose really well.

So what I do each day is create a new branch off my "source" folder and label it with the date. The source folder is also the folder that is bound to the SVN repository.

I then work off each branch and commit as I see fit. At the end of the day, I then merge my changes back into the "source" as well as do an "update" from the SVN trunk to make sure I’m working off the latest version of the code.

I’ve been using this method for around a month now and it has been working really well. In particular I like the ability to check in when I want so I can have as many revisions of my code as I like without having to worry about breaking the SVN builds.

If you are working at an organisation that has fairly rigid source control. I would highly recommend looking at setting up your own local source control repository to help give you a finer level of control over your source code.

[?]

Jun 23 2008

C# 3.0 and Implicitly Typed Local Variables

Category: Programminglomaxx @ 5:13 pm

 

In Jeff Atwoods Department of Declaration Redundancy post he talks about the benefits of the ability to implcitly set the type of local variables in C#. Whilst I don’t have a problem with being able to condense

BufferedReader br = new BufferedReader (new FileReader(name));

into

var br = new BufferedReader (new FileReader(name));

Personally, if you wanted to condense that code, I would be far happier for it to be condensed on the right hand side of the assignment rather than the left. For example:

BufferedReader br = new (new FileReader(name));

It’s still clear what the type of br is and you still get the benefits of reducing duplication. The other reason I like this is that it also leaves var to be used where it probably has the most benefit - when defining anonymous types. For example:

var obj = {Prop1: "a", Prop2: 112};

I think what it boils down to is that var is being used to solve two problems. If the scope of var was left to anonymous types and the problem of duplcation in object declarations was solved implicitly through improved syntax it would provide a clearer direction on how each feature should be used. So often in the past features have been introduced with no clear scope as to the problem they are trying to solve and eventually they get used to solve problems they were never intended to solve.

I also feel that the following is just going too far:

var url = "http://tinyurl.com/5pfvvy";
var maxentries = 5;
var pi = 3.14159;
var n = new int[] {1, 2, 3};

The main problem I have with this code is that whilst it’s easy to see that url is a string, you can’t tell the type of pi or maxentries. The assumption would be that maxentries is of type int, but there’s no way to be certain without calling GetType. It’s even less obvious with pi. Is it a decimal, double or float?

At the end of the day, I guess it all comes down to personal preference but you should always research and carfully consider the use of newly introduced features into any product you use.

[?]

Next Page »