A Tale of Two Code Bases ...
sandywalsh.com
sandywalsh.com
Your assumptions about the compiler/interpreter, file system and so on often break across platforms, so you have to revisit and repair that code as part of the porting process.
Finally, and most important, a portable program is a better program. The effort invested to make a program portable also makes it better designed, better constructed, and more thoroughly tested. The techniques of portable programming are closely related to the techniques of good programming in general.
Furthermore, I have observed that a lot of my co-students often struggle enough with getting stuff to work, and once they got it to work, uh, it works and no one really pulls himself together in order to get it into a nice, readable form, again, "Because it works, and I have other stuff to do.
So much to say, I had to debug a number of stuff in their code, and just by cleaning up stuff, I found bugs. sigh
But oh well. more refactoring fun for me, I guess.
Students should write assignment code as if it's their professional job to do so even if they're not majoring in CS.
They should:
- Write unit-test (doesn't matter if they want to practice TDD or not, as long as when submitted, there should be minimum X unit-tests or so)
- Be given access to source code repository, and they have to write informative logs
- Write decent comments and learn how to use a template license at the top of their code (make all code GPL or BSD, doesn't matter, it's just an assignment and it's just a way to show them the importance of code license).
Yes, it sounds silly for just an assignment, but then again, they are students. Most of them needs to be taught/told.
And yes, sometime these things could be gamed as there is no hard-fast rule especially in terms or marking (i.e. subjectives), but the TA and instructor should mark them based on their effort (for the subjective parts)... even if it's just a checklist.
At least we're forcing a bit of a good habit to them.
For example, ask them to fix bugs in a prepared project with a number of subtle errors without unit tests and comments, then another project with good tests and comments. After that, when you give them a group term project, not only will they be graded by you according to the code standards you set, but their peers will demand and expect that they write the code well.
One project I was working like this for a while, until it got to the point where it seemed I was going to be spending a lot of time on the code base. I was working around maybe 20% of the code that wasn't mine so I finally decided it would be worth the time to rewrite out the old bad practises.
What does this mean? How does a feature span four applications?
Seems excessive but....
if (permissions["whatever"]) { Do code}
instead of if (has_permission("whatever"))
And the first if was copy/pasted across the entire app. So when you have to change the logic of that permission, you don't have a central, official, way of figuring it, instead you have checks all over the app.