Programming: a trivial challenge

This is quite an interesting challenge the first time, and then gets easier as you get used to it… as with most things. It’s my own idea – it is obviously way too trivial to be in any proper exam (unless for very basic triage). Anyway…

Write a public class in C# with the following properties (public setter/getter):

Class name: composer

  • Id: int
  • FirstName: string
  • LastName: string
  • DateOfBirth: DateTime
  • DateOfDeath: DateTime
  • Gender: string: enumeration of “M”,”F”. The enumeration can be contained in the same class.

You are allowed to use intellisense/snippets, but no copy/pasting allowed.

You have 2 minutes which starts after you have opened and compiled the attached Console project. Go!

Easy to do in 2 minutes? If you do it cold you might feel a bit nervous the very first time, and your fingers turn into big fat sausages. And I don’t know what you would do about the startup application in practice. Perhaps writing it LinqPad or somesuch… and thinking about it, actually Intellisense is not such a good idea (I was thinking of a different context when I started, which is that given all the helpers / tools / frameworks we have, many of us should be way quicker than we are.) But I think it is an interesting exercise. That is not, of course, the same as useful… I make no claims 🙂

And why do we need a starter project? We should not give clues to the right answer using the compiler. Then you could have say 3 minutes?

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s