Entries in code (3)

Sunday
Jul172011

Great Week!!

Things seem to begin coming out in consistent fashion, finally!  The week-days are for theory (reading, watching), and week-ends are for practice/coding/everything else.  At least it worked well this week and I enjoyed it very much.  :)

I was reading (mostly) throughout the week, finishing yet another chapter of the textbook, and when Friday evening I've completed my last day-work hours I jumped to keyboard immediately.  Results so far:  4 practice exercises (including a slot machine simulator), 3 Project Euler problems solved and analyzed, and I'm about to code 3 more programms today, and maybe complete one more problem on Project Euler.  Not to mention that I'm constantly refreshing my knowledge by reading and reviewing covered materials.

So, I hope to maintain such schedule of studies in the coming weeks, and make it a habit.  I wish I could write more (especially about that slot machine code and how I 'lost' 500 of thanks-God virtual bucks 'de-bugging' and 'making sure it correctly works'), but I'm too excited to continue coding, that just can't wait!

Monday
Apr182011

First C++ Program (already!)

So, I couldn't help but to brag that my C++ coding skills are much more apparent than I anticipated!  It looks like I am 'remembering' the language, it's so familiar to the look and feel!  And I also enjoy Xcode 4 a lot, which shouldn't be much of a surprise.

My productivity got another boost as well, and that's what I've come up with in the morning:

As some may guess this is source code for a simple program which spells out a number in English (the range is from 0 to 999,999).  Yesterday evening it seemed to be a very complicated task, but I did it in hour and a half before breakfast completely on my own (including debugging!).  If such pace continues on, I'll be coding in Objective-C by this summer!

Sunday
Feb202011

Building Skills in Programming and Design

It was a wonderful and intense week for me (in a good way).  Minutes after posting my last note one week ago I decided to change the design of the web-site.  Again…  So, I spent a couple of hours tweaking a completely new template to better suit my needs.  I’ve also added tags cloud, changed appearance of Twitter feed a bit, and… that’s it for now.  :)  It still is in a ‘beta’ stage though, I will definitely change the colors (I liked the previous color scheme better), and the icons, and will pay special attention to the header.  I plan to make a collage of my working environment in Eclipse and have it as the header image.  Basically, that’s my goal for the week ahead in terms of the web-site design.

My programming skills are also improving.  I’ve completed, debugged, and polished ‘BreakOut’ game.  Even though it’s a very simple game, it turned out to be a valuable experience in programming.  I’ve learned how to program mouse and keyboard events, and also how to make many things to happen all at the same time.

This was also a great experience in debugging.  I had three major bugs.  One was that the ball may get stuck inside the puddle, another — the puddle might in some cases disappear when hit by the ball, and the last one (which I got rid of very quickly) — the ball could become invisible if the initial direction of movement was to the left and not to the right.  So, the major problem for me was not to identify the bug, but to actually come up with a fix.  And to my surprise the two bugs I had no clue to fix got worked out relatively fast once I started thinking about possible solutions.  Thus, the first lesson: 

Even if you don’t seem to know how to fix a bug, keep trying, it may be easier to fix than it looks! 

Another game (it’s even less complicated than ‘BreakOut’) I’ve implemented just yesterday is ‘UFO’.  I’ve coded it from scratch in two hours, then eliminated the bugs (which took me roughly another two hours), and implemented an advanced feature:  when the bullet hits the UFO there is a little green alien falling down from it and bouncing away.  :)

I’ve implemented a separate class for the alien named… well, GAlien, which I designed to be a separate class extending GCompound class.  It allowed me to do various things with it in simple and convenient ways.  By the way, this is how the alien looks like:      and here's the code for the GAlien class:


Next week I’ll continue my study by reviewing the lectures, reading on the book, doing the exercises.  I hope to complete the course by mid March and start with the next one immediately!  And now back to work, blog-time is over!  :)