Programming Theory

Best practices, structuring of code, dissecting algorithms and talking about the “Why?”

5 Quick and Easy Refactoring Tips

You wouldn't believe how many programming questions I run across, on a daily basis, asking for help with programs that contain repetition, duplication and enough spaghetti code to feed half of Italy. Often times the person asking the question has a particular problem but they don't know exactly where the problem originates. So they plop down a bunch of code and say "It is somewhere in there... I think". Usually ...

Function Pointer Basics in C++

Beginners to C++ programming find the concept of pointers foreign to them. Pointers, and code that manipulates pointers (aka pointer arithmetic), can even be daunting to some of the most seasoned programmers. Pointers in C++ account for a fair share of bugs in programs due to the lack of understanding. So why even use them? Well, besides being the most problematic, they are also some of the most powerful features ...

Greatest Advice, Start Small and Think Small!

Every programmer comes across a point in their career where they think nothing will surprise them or fundamentally change the way they think about code. Every programmer would be wrong. Many programmers often run into these "inflection points" multiple times over the years. One such point came to me while reading the book Clean Code: A Handbook of Agile Software Craftsmanship. The book discussed a few topics involving function ...

Applying Enchantments for PHP RPG Games – One Approach

So you want to build a PHP game and are just now learning how to do it. You fired up your browser and began searching for various game articles and perhaps you have found very little. What you did find might not explain a flexible way to apply magical spells to units you create. After all, what is an RPG game without enchantments you can cast on your (or enemy's) ...

Linear Search for Sorted Lists: My Take

Today I give my take on a blog article I stumbled across today called "Computer Algorithms: Linear Search in Sorted Lists" which gives a look at applying the linear search model to something sorted. I will offer a suggestion to perhaps make this a bit better for implementation and perhaps performance reasons. So buckle up and we will take another spin around the Programming Underground! Ok, so if you are a ...

Barriers of Validation

Hello once again! Today I want to talk to you about a design decision which involves validating data. Often times newbies build error prone code. This is because they are just learning and lack the experience of proper validation... and lack the experience of being smacked in the face when the code fails on the input of "a" when an integer is expected. As we become more experienced we learn ...