Programming Theory

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

NULL is Legit When Used Correctly

I was doing some research on a topic about compulsory parameters to constuctors for a project I was doing when I came across a topic about the use of NULL as a return value. Don't ask me how I stumble into these things. As you can imagine, as with everything in software engineering circles, there was a raging debate about whether or not NULL (or its equivalents like None in ...

Generating JSON Web Tokens (JWT) in Java or PHP

JSON Web Tokens (JWTs) are a mechanism for authentication that is simple to setup and easy to use. However, most of the time when you encounter this topic in a project, you get the advice to just use a JWT package. I am not quite sure why given that creating a token is relatively straight forward if you know how they are built. You can also implement such logic in ...

WordPress in the Enterprise – The Functions File

We covered the topic of linking your company's proprietary code library to WordPress in an earlier article, but those classes are generally for high level services, integrations and multi-project utility classes only. Examples of classes you might find there would be a class for making Application Programming Interface (API) calls to a customer relational management (CRM) system, a system logger or event classes for validation of data like emails and ...

WordPress in the Enterprise – Building in a Class Library

When you think of WordPress you might think of a lone blogger blogging about what they ate for lunch. But that is just not true anymore. With nearly 31% of the web under its control, WordPress has gained a lot of popularity due to its easy setup and extensibility. It has become a powerful Content Management System (CMS) that even an enterprise can build epic sites off of. But if ...

Rolling Dice in Java, C# and PHP

Some of the very first programs we are introduced to in programming is the idea of random numbers. This is often introduced using the idea of the die or dice. We have all seen them and have probably even thrown a set of dice at some point in our life. A die is pretty much a representation of a random number generator with a fixed range of values. The traditional ...

Stubbing Out Functions, Do You Do It?

If have ever taken a beginner programming class in school you were probably introduced to the idea of stubbing out functions. If not, let me quickly tell you what stubbing is. It is the process of identifying tasks in your design and setting up functions to handle those tasks. We define just the function signature (name, parameters and body) without writing the code statements in them. Once we identify all ...