Entries in Java programming (7)

Sunday
Apr032011

Harakiri Game Progress

Hello, there!  As I've written last week, I am going to keep the posts about my recent project, "Harakiri", up to date.  Here's what happened.

First, I've completed writing all the texts for the game.  Not that there were too many to begin with, mostly the help instructions at the beginning, but still this is now done anyways.  This doesn't include building up vocabulary, right now it is less than 30 words, but I'll be expanding it during the week ahead.

Second, I've spent some time figuring out how my program should work.  Here's the draft I drew outlining the whole game logics:

This seemingly primitive drawing has helped me a lot while coding the "skeleton" of the game.  In fact my understanding is that it only thanks to this drawing the actual initial coding is now complete.  Yes, you are not mistaken, neither am I:  the initial code for the game is done already!  And this brings us to...

Third, the "top-to-bottom" approach has shown its advantages to me.  I've finished coding the outline (or the "skeleton") of the game, and now it's time to work on the details.  And that's the beauty and power of it:  you don't have to bury yourself under all the details right away, you can go as "deep" as you want at almost any time during the project lifespan.

There are a lot of things to be done, though.  I haven't touched any graphics yet, all I did was figuring out some very basic layout for the game screens.  I didn't record any music or sounds for the game too.  I also need to extend the dictionary.  All of that is a lot of work, but I hope to finish it all by the end of the week (I remember saying so last week!), and will surely keep the blog updated on that.

Sunday
Mar202011

Coding On-The-Go!

This week was mainly a "watching" week.  I did less coding than usual, but continued watching the lectures.  This time I got myself ready for some practice with arrays.  I've also decided to code only select exercises from the book, not all of them.  However, I will do at least half of all the tasks from the chapter.

I've also noticed that it takes up to an hour and a half each day for me to travel by train to and from my day-time job.  During that time I usually play some games or get online from my phone, or something else, not too much time-consuming.  I also carry my iPad with me quite often, and it was always tempting to find some way to do my programming on-the-go, while in traveling.  Many possible solutions came to my mind, but the only working and convenient for me became Textastic for iPad, which is a text-processor designed for typing code.  It provides decent functionality (syntax highlighting, tabulation, quick punctuation keys, etc), and it syncs to FTP, Dropbox, or via browser in clear and simple ways.  And there are lots of supported languages for syntax highlighting, including Java.  Of course there is no way to run the code right from the app, but that's not an urgent need (besides the fact that Apple won't allow something like that on the iPad).

The app currently is $9.99 on the iTunes AppStore, and I know that the price could go down, but I just wanted to support the developer in full and not to wait for some unknown time.  I am very pleased with Textastic and find it to be a very nice productivity tool for any programmer on-the-go.
Sunday
Mar132011

Graphics Mastered

One really big thing this week was not only the iPad 2 launch (which I can't get right now yet), but the fact that I am done with the graphics learning.  It looks like Java is pretty good on that part, but somewhat basic, at least in the version taught.  Anyway, I've mastered the graphics well enough to compose various pictures and even to create a simple interface.

Great tip learned from this week's programming exercises: always do sketches when working with graphics!  It does make a huge difference in understanding what will be produced eventually on screen, and thus saves lots of time!

Before I move to the final stages of CS106A course (arrays, search & sorting algorithms, working with file i/o) I only have to complete a few exercises on strings and characters, which seems like a lot of fun by itself.

On a distantly related note (in my current stage in programming):  new version of XCode is out and available at the Apple Mac Apps Store for mere $4.99!  I'm not buying it yet, though I might soon as I move to learning C and Objective-C.

Sunday
Feb272011

Learning Java Programming (almost) at Stanford

In one of the very first blog posts I've mentioned the fascinating opportunity provided by Stanford University initiative which allows anyone in the world who has Internet access to watch complete sets of lectures on various subjects including Computer Science & programming.  In fact, I believe that without such opportunity it would've been virtually impossible for me to make necessary advancements this quick.  So let me describe the courses I've chosen to 'attend'.

First, the current and the only course I am attending right now is CS106A (which is Computer Science Programming Methodology).  It is a starter course, quite basic, but challenging enough.  Professor Mehran Sahami, who conducts this course, is above and beyond any great words I might've thought to write here.  He makes it very energetic, fun, and engaging study.  Even though the series of these lectures were recorded back in 2008, the material is still relevant and it suits my 'entry' level in object-oriented programming perfectly!  I was also lucky enough to have a chance to get the textbook for the course which is called 'The Art and Science of Java' by Eric S. Roberts.  It's really well-written and provides lots of necessary details.

Second, after completing the course (which I plan to achieve somewhere in mid-March), I'll be watching CS106B course, the complimentary and highly recommended one.  This is a 'prerequisite' course for the iOS development course at Stanford, which is the third one, and presumably the last one to take.  During that last course I plan to enroll in MacOS X and iOS Developer programs to be able to code and publish the apps at both the Mac App Store and the iTunes App Store.  I've already started jotting down some thoughts and design ideas on what those first apps might be and how they'd look like, so hopefully by the time I finish my self-education there will be plenty of material to start with!

On the final note today I'd also like to mention that the color scheme of the web-site has changed, and some ideas about the header image are considered to surface during this week.

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!  :)