Why small mistakes are disastrous?

I made a stupid mistake. very stupid one!


Do you see the problem?
Yes, only one character ruined the whole process.

It should be like this:

if(IsOK()) // if(!IsOK())

If the function containing this problem is rarely called, it’s a time bomb inside a briefcase. Even after you recognize something is wrong, it’s very hard to find this kind of mistakes because it’s such a small one like off-by-one error. almost invisible. That’s why small mistakes can be much more disastrous than big ones which are obviously more visible.

Since code like the above is usually written very quickly and unconsciously without thinking, if you don’t have right habits, you will make a mistake. It brings me the idea I loved but, apparently, forgot.

Good programmers have good programming habits.

I will never use ! in if statement. ever.

One more thing to remember.

Test every changes you made. Every single line.

Of course, I tested my changes before I checked in it. However, there were many changes and I just quickly checked a normal flow without checking all the changes I made. I was focusing on bigger and more complicated changes. I should have kept my changes small and checked in them more frequently.

Anyway, it’s absolutely my fault and I will never forget it.

I really don’t think anything I do is a mistake. It could be if I didn’t learn from it. – Fiona Apple

Posted in Uncategorized | 1 Comment

Did you know you can change wingdi.h ?

I was having a weird problem with compiling files for a few days.

I couldn’t remember when it started but the compiler kept saying it could not find “ERROR” identifier. “ERROR” is supposed to be in wingdi.h like this.

#define ERROR 0

So I checked my wingdi.h file and it was like it.

#define LOG 0

It didn’t take too much time to realize that wingdi.h was modified recently and all the other header files in the same folder had not been changed at all ever since the visual studio was installed.

I thought it was because I installed some other SDK or programs and I tried to figure out what made this situation. I had never imagined that I changed it. But, yes, I DID IT. OOPS!

I did “replace all” ERROR with LOG for my own project and wingdi.h was open at that moment. Visual Studio modified it and did not say anything when I saved and compiled it. There was no single error because I did not use ERROR in that project.

First of all, wingdi.h is NOT read-only! so if you accidentally modify and save it, you won’t see any warning dialogs. Second, Visual Studio applies “replace all” for all opened files. It doesn’t matter if a file is in your solution or not, even though you choose “Entire solution”. Like the below picture.

So be careful otherwise you could waste hours even days like someone. =+=

Posted in Uncategorized | Leave a comment

Games for Windows Live.

Okay, I’m not going to tell you how bad it is since there are many articles about it. If you have nerver heard about its notorious features, check it out.

This was meant to be a Fallout 3 DLC review. or
Fallout 3 New Content, Adventures In GFWL

From those articles, I can easily imagine that user expereicens from GFWL are horrilbe, shameful and pity.

Actually, as a developer, I was okay with GFWL until I needed to deal with bugs from its newly updated 3.0 version. It’s okay since debugging is just one of daily tasks we are doing.

However, I’d like to remember the lesson I learned from this experience.

Don’t use an outside technology if its provider just distributes a new version and forces users to use it wihtout telling a single word to partner developers.

That’s it.

Posted in Uncategorized | Leave a comment

Network Programming with IOCP and Thread Pool – Intro

These days, I’m playing with network programming with IOCP and Thread Pool just for pure fun. 🙂 After several days of reading MSDN, articles and writing experimental codes, I’ve realized that there are pretty big changes I need to catch up.

If you still use IOCP with GetQueuedCompletionStatus() and your custom threads (like me before), you might want to follow this series of postings I will update. I will provide sample code to clarify the right way to use them.

Also, I will benchmark techniques to each other so that hopefully I can give you some guidelines about When we need to use Which technique, or, at least, help you to avoid making the same mistakes I would make while I write this series.

First of all, let’s see how many ways we can choose for using IOCP.

If we use custom threads to get I/O completion notification,

1. CreateIoCompletionPort() and GetQueuedCompletionStatus()
– Windows 2000 (Pro, Server) or later.

2. CreateIoCompletionPort() and GetQueuedCompletionStatusEx()
– Windows Vista and Server 2008 or later.

If we use Windows Thread Pool to get I/O completion notification,

3. BindIoCompletionCallback()
– Windows 2000 (Pro, Server) or later.

4. CreateThreadpoolIo(), StartThreadpoolIo() and etc
– Windows Vista and Server 2008 or later.

There also some APIs related to Thread Pool like QueueUserWorkItem(). Unfortunately, but in a good way, Thread Pool system has been completely re-written for Windows Vista and we need to use those new and richer APIs to maximize our server performance.

If it’s not confusing enough, I can tell you that there are also special socket functions which are Microsoft-specific extensions to the Windows Sockets specification. For example, ConnectEx(), AcceptEx() and etc. These functions are to fully utilize IOCP power for all IO operations including receive (read) and send (write).

Yes, it’s gonna be a long journey but it must be fun! So excited! LOL

Posted in Uncategorized | 3 Comments

Getting into the Game Industry.

There are many articles saying how hard getting into the video game industry is for recent grads. I thought it was not my case since I already worked for over 4 years in Korea as a game programmer.

I know most of Korean game companies are “nobody” here in America but I was lucky to have work experience at a company which is globally famous for its micro-transaction model. Also, I was confident of my programming skills by seeing the other students in my graduate school. All those things made me think like “It shouldn’t be a problem to get a job from one of my favorite game companies in America even before I graduate”.

Well, it turned out that I was not an exception. It took me over one year to get an offer from one of the game companies I want to work for. I applied for over 40 programmer postions, had about 12 phone interviews, took 8 programming tests and had 1 onsite interview. Finally, I got 2 full time offers and accepted one from Canada, today morning. I’m not going to write all the details about how I got the offers but I’d like to tell you a few things which might be helpful.

1. Have a Long Term Plan

You should have a long term plan. a very long one. It is mainly because of a global recession in these days. I just saw the news that Crystal Dynamics (one of companies I applied to) is reducing 25 more staffers. In a bad economy, this kind of news is not surprising at all. I was very lucky since I was in a school while I was looking for a job. Getting a job would take much (very much) longer time than your estimation.

Find a part time job or volunteer positions. If you are an international student like me, you should do work to keep your OPT status. Do some independent projects by yourself or with your friends. Some of my friends are planning to start a startup for developing IPhone games. You can also consider about attending an education program. The bottom line is that it’s important to have a clear answer to the question : “So, what have you been up to after you graduate?”

2. Keep Practicing and Studying

Most questions asked during a phone or an interview are NOT random. You can easily google them, prepare answers and practice by yourself. I found one great article in Gamasutra and it was very helpful for the onsite interview I had. If you were a programmer, you also need to check this article from Joel. Surprisingly, two interviewers actually asked the question from the article: “How many gas stations are in Los Angeles?”. Prepare for it.

Don’t forget to study basic things of your field. For programmers, some academic questions (yes, Computer Science) are very popular even they are not directly related to how good your programming skills are. Math problems are also frequently asked if you are applying for a gameplay or graphics programmer. I had to solve two math problems on a white board in front of interviewers. This book was very useful for me to study math for game programming.

3. Never Stop Applying.

You don’t need to rush but you shouldn’t stop applying. Make a list of companies you’d like to work for and keep updating it. Check Gamasutra and CreativeHeads everyday and ask your friends about open positions at their work place. That’s how I found over 40 positions.

Don’t wait for a result of the interview you already had. Instead you should search more positions and apply for them. Don’t stop until you actually sign on an offer letter. One of the companies told me that I passed all the tests & interviews and they were willing to hire me. But they just kept delaying giving me an official offer letter. Don’t think you’re hired before you really are.

That’s all. It was a long and hard time but all of difficulties I’ve faced improved me a lot. Don’t give up. Never stop.

Posted in Uncategorized | Leave a comment

A call to action.

There was one time when I was hooked by all kinds of Software Development Methodology books. I was looking for “answers” to escape my stressful daily life as a programmer in Korea. Ironically (and obviously), the answer I found and liked was

“No silver bullet” – Fred Brooks

Well, it’s very easy to misread the line so please check the full article. By the way, the important thing was not the answer I found. I got it from the book “Professional Software Development” – Steve McConnell and there was the other article whose title was

“Programmer Writing”

Simply, it blew my mind. I had never thought about that I was one of those who were supposed to write “answers” which I had been searching for. This drove me to start my Korean blog. It’s not very often updated but it seems some of articles helped other programmers and myself as well.

I’ve been thinking of starting my English blog since I came over here in the U.S. Finally, I have a bit long break time to do my personal stuff. This is my first post and I will try to fill this blog with articles “braced by labor and invention”. Yes, I’m the programmer writing. Are you? 🙂

Posted in Uncategorized | Leave a comment