Dear Computer Science Majors..

Summary

This blog post is directed at all those Computer Science students or recent grads who want to get a leg-up in their career.  From time to time, I talk about what resources are available for Computer Science students to get ahead of the game.  It’s been a while so I’m going to give you a few resources to hone your skills and some hints on how to get your career started early.


Practice, Practice…

First of all, there are a few sites where you can practice solving programming problems.  Companies don’t hire software developers because they know a particular language (though it’s good to know at least 3 or 4 languages in current use such as C#, Python, Ruby, Java etc.).  The reason for hiring a person is to hire a problem solver.  Remember those word problems in math class that everybody hates?  Yeah, that’s what companies need.  Only every software problem is a word problem that must be solved.  Some problems will come with very detailed specifications and you will be very lucky when something like that occurs.  Many times you’ll get somebody’s fuzzy idea of what they want to do with a computer and you’ll be required to translate that into software.  You’ll discover just how challenging that is.

One of the subjects that colleges don’t teach very well is how to solve problems.  It’s mostly due to the lack of time needed to get good at problem solving, but it also has to do with the fact that college students don’t yet have a big bag of tricks.  I obtained a big bag of tricks by reading a lot of books and writing my own programs on the side as a hobby (mostly games).  Unfortunately for me, the World Wide Web didn’t come into existence until I graduated and I didn’t have the resources that students currently have at their fingertips.  One of those resources is called Hacker Rank.

Hacker Rank is a website where software developers can sign up for free, practice programming problems of all difficulties and subjects and build up a reputation (click here and sign up).  Programmers can compete against other programmers.  Hacker Rank has many languages to choose from.  The practice problems have automated testing so you can get your program tested immediately.  Remember how you learned Algebra?  Classroom time was just an introduction, you got good at Algebra because you did the odd numbered  problems in the back of the book (or sometimes books use the even numbered problems).  The psycho students did ALL of the problems and they earned their 4.0 because it takes a lot of sweat to get good at it.  The only way to get good is through practice.  Hacker Rank is the programmer’s equivalent of the odd numbered problems.  Spend some time at this site and practice!

I have personally worked out a bunch of problems at Hacker Rank (over 50), so I know how enticing it is.  I usually use my Visual Studio to work out the basic code (in C#) and then just copy it into their on-line editor, but you can just type it in directly.  There are other sites that you might try: CoderByte, CodeChef, CodeForces, TopCoder, CodeSchool and the list goes on.  Pick a favorite site and practice!


Programming Competitions

If you’re really good at solving on-line problems and you’d like to participate in a competition you should seek out your local ACM chapter and get involved in their programming competition (assuming your college participates).  Click here for information on their programming competitions.  Click here to obtain the previous ACM competition programming problems.  Participation in the ACM programming contests is something you can put on your resume.  It makes a statement that you went beyond the normal curriculum and you are serious about software development.


Programming as a Hobby

Sometimes you have to visualize your career path as a career that is similar to an artist.  When an artist interviews for a job, they are required to show some of their best works.  As a developer it’s best if you have something you can demonstrate or show off.  Companies will not necessarily ask for a demonstration of your works.  Here’s the trick: If you have something posted on GitHub or BitBucket, you can put a link on your resume to those sites and companies will look at your work.  Trust me, when I look at a potential hire’s resume and I see a GitHub account, I usually drop the resume and go look at what they posted on GitHub.  I learn more about a programmer from what software they’ve written than all the technical words typed on their resume. 

Building a Web Presence

In addition to using GitHub and BitBucket, you might want to setup a blog or a website.   You should be able to setup a website with minimal knowledge.  You’re not expected to be an artist (or web designer), so use of a template or WordPress is more than acceptable.  You can give some bio information and talk about your school projects, or just makeup a website about a subject you are interested in (hiking, photography, programming, etc.).  Be careful about what you put on your website.  Don’t put your resume there (don’t make the mistake I made!)  Most of the head-hunter websites will scrape resumes from websites and you’ll never get your resume removed from their sites and they’ll never stop hounding you.  Also, don’t provide any personal information unless you feel comfortable with providing such information to strangers.  Don’t ever provide information such as your social security number, etc.  But, you probably already know not to provide that information.

If you want an easier method of getting a web presence, just do a blog.  You can start a blog at blogger for free.  Just sign up for a Google Plus account and start a blog.  You can create as many blogs as you think you can handle.  It’s best to keep your scope narrow at first and give your blog a subject that you can write about really easy.  If you want to attract readership, you’ll need to provide some interesting content and probably a few pictures.  Blogger has an upload button that is a lot like Facebook.  I’m sure you have albums of photos on your Facebook account.  Why not load pictures of your hobby on blogger and write something about your experience.

Why do I tell students to setup a website or blog?  Because of web presence.  It’s very important.  When I get a resume to look over, the first thing I do is type the person’s name into Google or Bing and see what pops up.  I’m amazed at how many long-time developers have zero web presence.  That’s a red flag.  Soon it will become a career killer (if it’s not already a career killer).  If you go to Google and type in Frank DeCaire, you’ll see that I have a bit of a web presence.  

Trust me, I hated English class.  To write a paper is like walking barefoot through broken glass.  My first few blog posts were scary.  After a while, I got good at it.  Now blog posts just flow from my keyboard.  Start blogging when you’re young.  I wish I started in the early 2000’s.  Fortunately, I signed up for my first domain around 2001 or so and I’ve had a website ever since.  So that has helped my web presence.

Sign up for a Stack Overflow account.  This is where you want to put your resume.  Stack Overflow is by invite only, but it’s easy to get an invite, especially if you already have a blog or website.  Stack Overflow is like the cream of the crop.  It takes a bit of effort to fill out all the information on their site and get your resume set, but take the time and get it there.  You can keep your work history on this site and over time you can just keep updating your information, in case you need to switch jobs.  Stack Overflow has controls to allow you to switch on or off you information so you can indicate if you’re looking for a job or not.  You can start filling out this information when you start college and just update it as you progress through your education.

I have a Linked-In account, and it’s probably a good idea to sign up for one, but I haven’t had much luck finding a job with Linked-In.  Linked-in is used by many recruiters.  Some recruiters are just looking to fill contract positions but some companies have hired their own recruiters and are looking to fill full-time permanent positions.  So it’s at least good to have a Linked-In account with your work history so a potential recruiter can contact you if you’re looking for a job.  It’s free, just don’t forget to update your work history information when you switch jobs.


Internships

If your college holds job fairs, spend some time at one.  Sign up for a summer internship.  Look for a small company that has a lot of technologies to work with.  If you get an interview for an internship, ask what you will be working on.  Pick the company that will throw you in with the developers and give you a project to work on.  Avoid the internships involving low-level busy work that a company wants to complete on the cheap.  You want to get some working experience in the developer world.  You need to learn the skills of version control, unit testing, handling legacy code, deploying software, etc.  All the skills that are not taught in college but are necessary for running an efficient developer shop.  If you have these skills, you’re a better candidate for a programming job because you can be up and running quickly.

Also, having an internship on your resume is like having a job on your resume.  You can do multiple internships and get away with the fact that you jump around from job to job, because nobody expects an internship to be permanent.  So if your resume has two or three internships, that’s just more hands-on experience that you can brag about.  Having a variety of real-world development knowledge is a definite plus.

Resume Workshops

If your college has resume workshops, then be sure and participate.  People like me will be at these workshops.  We have good ideas on how you can spruce up your resume.  Why?  Because we look at resumes.  A lot of resumes.  We look at these things from the perspective of an employer looking to hire someone.  Sometimes we’re the first person to look at your resume, sometimes your resume will go through a machine or a recruiter first.  We have all kinds of hints that will help your resume get through the machine and/or the recruiter.  We also have hints on how you can get past us and get an interview.  Don’t miss out on the resume workshop.


Summary

I hope I’ve helped some of you think about what you need to do to get your career ahead of the game.  My career got off to a slow start because I didn’t have the resources that are available today, but also because I had no idea about the purpose of a career fair or a resume workshop.  You want to get your career going as soon as possible so you can get through the boring “new guy/girl” aspect of your career.  You also want to make sure you are the person that a company “needs” because you have talent and skills.  If you have skills, you want to make sure that those skills are properly advertised, so you get paid what you’re worth and you get your foot in the door of the company that you want to work for.

So get busy and get your blog or website started today.  You’re only a Freshman?  Starting your first class in the upcoming semester?  Don’t let that stop you.  Get a blog started.  Blog about your college experience.  If you already know how to program, blog about your skills.  Demonstrate your skills by setting up a website.  I knew how to do double-linked lists and binary trees before I started college.  If blogging had been available, I could have blogged about that skill.  I could have blogged about my game development hobby.  Don’t let this opportunity pass you buy.

 

NHibernate Mapping Utility Update

Summary

For those who have followed my blog, I have a long-term project called the NHibernate Mapping Generator.  This application generates ORM table mapping C# code for the Fluent NHibernate ORM.  In this blog post I’m going to describe a few new features to this application.


ADO.Net Unit Testing

There is an ADO.Net Context that was created in the unit test helpers of this solution.  I have added a condition where this can be called form a unit test causing the connection to override and use the SQLLocalDB database.  If you use the ADODatabaseContext in your project, then you can connect to your normal database by passing a connection string.  If you create unit tests and include the start and end code for the SQLLocalDB database, then this context will use that database whenever your code is executed from the unit test assembly.  When using the context from a unit test, you will not need a connection string at all, but you might want to specify which database to default to.  In order to do that, you can pass a blank connection string and pass in the database name, or you can pass the database name in the connection string and the constructor will copy the database into the new unit test context (see ADODatabaseContext.cs source for more details).


Session Wrappers

I have added two session wrappers to the project.  To accommodate all the default methods and properties, I used partial classes with all the repeated code in the Wrappers directory.  A method for each table is created inside the other half of the partial class for each database that is generated.  This code is contained inside the database directory and Wrappers sub-directory.  This will allow you to change your code from:

var query = (from d in db.Query<Department>() select d);

To:

var query = (from d in db.Department select d);


Future Enhancements Planned

One enhancement that will be necessary is the ability to access databases that do not show up in the drop-down list.  The SQL Server Management Studio has the ability to type in the name of a SQL Server and I intend to mimic that feature.

Next, I need to store the SQL servers discovered in the registry so that the next time this utility is run, it just reads those entries.  If the user desires, they will be able to refresh their list just like Management Studio does.  This will cause the startup time to be quicker.

Next, I need to have the ability to use a user id and password instead of just integrated security.  Management Studio has a drop-down to select one or the other, I’ll probably mimic this and only show the database list when the user clicks a button.

Next, I would like to have check boxes for the ability to generate code for non-NHibernate scenarios.  That way the NHibernate mappings will not be created, but the views, stored procedures, table creation code and the constraint code will be created.  That will make this utility handy for people who want to setup unit tests for projects that use EF, LINQ-to-SQL or just plain ADO.Net.


Where to Find the Code

You can download the entire solution including the unit test helpers, sample unit tests, sample projects and the NHibernate mapping generator at my GitHub account here.

 

Fluent NHibernate Session Magic

Summary

If you’ve spent any time with NHibernate or Fluent NHibernate, you’ll know how annoying it is to use the .Query<Tablename>() method in every LINQ query.  It’s especially a problem for situations where you must convert Entity Framework or LINQ-to-SQL to NHibernate, since you have to convert every LINQ query in your code.  In this blog post, I’m going to show how to get rid of this construct.  In the future I’ll add this to the NHibernate mapping generator to allow this syntax to be used any time you auto-generate your table mappings.


NHibernate.ISession

I’m going to mention up-front that I was not the brains behind this discovery.  My colleague Samer Adra (Blog, Linked-In, Twitter, Stack Overflow) played around with this code to get it to work.  So I’m going to blog about it so everybody can start using this technique and get rid of the annoying .Query<Tablename>() syntax.

So the first that that needs to be changed is the ISession interface.  To do that, you need to default all the methods and properties that are used by the ISession object.  It starts like this:

public class SessionWrapper : ISession
{
  private readonly ISession innerSession;

  public SessionWrapper(ISession innerSession)
  {
    this.innerSession = innerSession;
  }

  public void Dispose()
  {
    innerSession.Dispose();
  }

  … more
}

And it goes on and on (download the sample code).

I setup the project with two tables in it.  These table mappings connect to tables in MS SQL Server.  If you’ve followed this blog you know how to get the mappings, if not, then you’ll need to download the NHibernate Mapping Generator from my GitHub account and generate the mappings automatically.  Then you can go into the data project and find the table mapping cs file and copy the code.  You can get the mapping generator here.

Anyway, I added these two lines of code to the bottom of the SessionWrapper object shown above:

// Table mappings follow
public IQueryable<DataLayer.Department> Department
{
  get { return innerSession.Query<DataLayer.Department>(); }
}

public IQueryable<DataLayer.Store> Store
{
  get { return innerSession.Query<DataLayer.Store>(); }
}


Next, I had to modify the context to handle the session wrapper.  That only required me to change the OpenSession method:

public static SessionWrapper OpenSession()
{
  return new SessionWrapper(SessionFactory.OpenSession());
}



Now for the final code inside the Program.cs file:

using (var db = MSSQLSessionFactory.OpenSession())
{
  var query = (from d in db.Department select d).ToList();

  foreach (var item in query)
  {
    Console.WriteLine(item.name);
  }

  Console.ReadKey();
}


That’s it.  Obviously, creating a method for each table inside the SessionWrapper is the most tedious aspect of this process.  That’s why I’m going to add it to the NHibernate table generator project and generate this session automatically.  Also, you’ll need to support the stateless session (IStatelessSession) if you intend to use stateless sessions in your projects.  So the same code will need to go into a stateless session wrapper as well.


Cross Database Support

One other thing to note is that the database that this table is located in is the sampledata database.  If there was a Department table in another database and we wanted to be able to access both tables in one query, then we’ll need a unique name inside the SessionWrapper object.  One solution is to create a naming convention that uses the database name with the table name.  I may use a scheme for that in the mapping generator or I might leave it to the end user to come up with a scheme of their own.  Just be aware of that possible issue.


Download the Code

You can download the code at my GitHub account here.  Don’t forget to go into the MSSQLSessionFactory.cs file and change the server instance (search for “YOURSERVERINSTANCE”).