Getting started


I’m going to keep each one of these posts reasonably short as I try to get across a small subset of ideas. It also means that I can keep the frequency of posting up – I know how frustrating it can get when you start to follow a blog and the posts end up appearing at two-monthly intervals. Oh, and I also have to make a living!

Feel free to disagree with me … I’ve come at this from my experience and am not formally trained in software engineering (mathematics, physics and psychology were my thang) so there’s a good chance you may think I have my head inserted somewhere rather uncomfortable. You might even say it – don’t be surprised if I respond in kind! I’d love to hear your opinions and have people engaged with the ideas that bubble up. On the other hand, I really don’t want to have debates about how many angels you can fit on the head of a pin– this is my take on coding in COBOL in the .NET environment.

O.K. Here we go …

First off, I’ve created an empty solution and added three projects to it: one which is the meat of the solution so far: School.Data, a COBOL .NET 4.0 class library, and Test SchoolData COBOL, a COBOL console application to test School.Data and Test SchoolData cSharp, a c# console application to test School.Data.

A quick note about the naming of School.Data – it’s a good idea to break the name of a project down into parts to identify components.  The first part can be a company name or product name followed by a dot and the sub-component name.  A project will correspond to a .NET assembly (DLL or EXE) and should all have the same namespace.

If you look closely below, you’ll see I’ve created three separate files under School.Data to start: Person.cbl, Address.cbl and AddressType.cbl.  Each of these files corresponds to a .NET type or class (and, in fact AddressType is a special .NET type – an enum, which I’ll talk about in subsequent posts).  Whilst it’s possible in the Visual Studio IDE to put multiple elementary types into the one file it’s considered bad practice.  Tools like Microsoft’s StyleCop( a static code analysis tool to enforce good coding practice) enforce this as a standard.

This solution creates an abstraction of the business processes associated with a school from the lowest level. We’ll add to them and use these classes to define students, parents, teachers and support staff and go on to create other business types. They aren’t complete or even the best way of defining the data! In fact, I may have made a rod for my back in future posts as the current CTP for Entity Framework Code First doesn’t support enums. Hopefully a new CTP comes out supporting enums before I start to put a database behind our business objects!

SchoolSolution

The code can be downloaded here.  Have a look and we’ll start to discuss it soon.

Advertisements

3 responses to this post.

  1. This is cool stuff. Having had my head in JVM for the last 18 months I am a bit rusty on this “Framework Code-First (CTP5 release)” stuff. Any chance you could expand on what it does and what it offers us COBOLers? Your ‘keep it short’ approach appeals to us dyslexics!

    Reply

  2. Posted by Joe Coleman on January 14, 2011 at 7:13 am

    I hope to get a chance to work through these articles, but just to let you know that the link on this post, for the code, seems to be broken.

    Reply

    • Hi Joe,

      Sorry about that Joe, for some reason Windows Live Skydrive changed the URL for the file as I did test it. It’s fixed now!

      Michael

      Reply

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

%d bloggers like this: