Wednesday, December 21, 2011

Coding Quality and Your University Courses

All programmers are self taught - or are they?

The basic point of that post is true, at least in my case - my courses did little to teach me the details of good coding style and practice.  Of course (ha!) I also learned 5 programming languages in undergrad, so there was not a lot of time to get beyond the basics.

However, the courses also noted the building blocks of the larger concepts - modularity was handled in the first class via the "Karel the Robot" exercises - writing programs to make a small robot trace shapes.  This covered the idea of wrapping repeated actions in functions/subroutines to allow later re-use.

Pascal covered the side-effect in procedures vs functions

But the big thing I think that the courses gave me was the space to realize that I knew the right thing to do.  I was able to see the correct way by being allowed to do it wrong.

Case in point - I was taking a course that was taught in Fortran, and was waiting to turn in my program printout when the guy ahead of me in line asked if I would look over his program to see if I could spot the error in his code that was messing him up.

He told me that he knew BASIC already, so he was writing the programs in BASIC to get the algorithm right, then translating into Fortran for the grade - an excellent idea.  Then I looked at his code.  It was bad.  The first thing that struck me was that he was jumping all over the place, instead of having blocks of code in reasonable places.  IF X THEN GOTO 130 ELSE GOTO 200, instead of having the ELSE be a fall-through.  And so on.

I worked through his code to offer advice, but I don't know if he got the big ideas out of it.

But my main point here is that  if you go into programming, you should have the mindset to see the good stuff on your own - university education is to teach the things that your can't see.




3 comments:

Brian Tkatch said...

Just thinking...

I'm self-taught, but i learn from others. To me, the main point is to admit freely what i do not know, and assume someone can do it better.

If i had gone to university (i was accepted into the CS masters program and LTU, but left while taking pre-reqs because i got a job) it would have been to "force" me to learn those advanced things i wouldn;t have bothered studying.

Perhaps that would have taken me in a new direction, but the one i'm on is just as valid.

Dixie Software Ninja said...

To be sure, there is nothing wrong with self-learning - but the point of a CS education is not to teach programming - it's to teach the tools a programmer needs to use. Heck, I learned C and UNIX during my compiler class, since the prof wanted to use a new machine for his class.

Brian Tkatch said...

"I learned C and UNIX during my compiler class, since the prof wanted to use a new machine for his class."

That's just sounds hackalicious.