Tuesday, January 22, 2013

The Memory System: "Technically" Done!

I was really worried about this system. So I decided not to touch it until I'm fully prepared. I refused to look at any posts on the forums related to this system until I start working on it, so that I won't feel influenced or demotivated. I spent this whole Saturday studying for it. I read all the slides and took notes, and then read the sections related to Win32 Heap creations and allocations from the Windows System Programming book, and also took notes.

At that moment only, I felt a little ready to start coding. I dedicated the whole Sunday night for that. The first hour though wasn't the happiest. It was just a tour of all the stubs and the unit tests already written there. I was trying to get the big picture of how the individual components of the system interact. It was so demotivating at first, to the point I didn't want continue working on it and leave it till another time. But I knew if I had done so, I would have felt extremely guilty about it, so I kept working.

To raise my moral a bit, I followed the 'baby steps' rule. I just wanted one test out of the 40 unit tests to pass in order to feel like I have done something. So I tackled the easiest one at all, the one that test the initialize() method that initializes the Mem object. And there it was, 1 success - 39 failures. Shortly, the 1 success became 3, and then 7. And after that, in order to move from there, I had to work on the whole system at once. So I kept banging my head against it, sometimes dealing with failed assertions and sometimes illegal memory access, all of that for about 4 continuous hours. 4 hours of debugging and stepping through the code and experimenting here and there. And suddenly, to my surprise, 40 SUCCESSES!

I was extremely happy, but that didn't mean I'm done. I'm not really satisfied with the code at all. It was all about passing those 40 unit tests and get it "Technically" done, but it's not the most elegant code in the world.

So the refactoring process started today, and two change lists were submitted already so far. The examples that Prof. Keenan gave in class today helped a lot clearing some of the stuff up. The best part about today's lecture was the revision of how to do software design. This is so important and extremely helpful, specially that it is transferable to any software development area, whether it's game development, web development, mobile development ... etc. It is so relevant to this assignment since now I have to iterate over my code again and again trying to enhance it and refine it.

No comments:

Post a Comment