Programming Theory

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

Create an Email Activation and Unsubscribe Script in PHP

If you weren't lucky enough to get a job with Google or Facebook, or even if you did, one of the first tasks you might be asked to do in your new career as a web developer is to create a subscription form. As part of creating this form will want to collect user information up front and then sending the user an email to have them activate their account. ...

Solving a Null Value When Posting a Simple String to a .NET Web API

The Problem: Many programmers, when creating a .NET Web API project, typically run into a situation where they want to post a simple x-www-form-urlencoded string datatype to an endpoint. They create the POST endpoint and attempt to post a string body to it only to find out that the value passed from the body is null. It can certainly be a frustrating endeavor to find a solution to this. After ...

8 Tips to a Better API Design

We have all seen the numerous articles and tutorials related to great REST API design on the web. They usually talk about proper coding techniques and how to expose the endpoints in some given language. While useful, and definitely needed, they often miss some of the fundamental high level ideas that make great APIs work. In this article we will cover 8 tips which I have learned consuming and providing ...

The Main Method Is a Conductor, Not a Member of the Orchestra

As many of you already know, I am a regular mentor on Dream.In.Code. With that I see common mistakes and design issues more than most people will probably ever seen in their full career. One design issue I would like to talk about today is the role of the main method and why it should be treated more like the conductor of an orchestra than 10 different band members. The ...

Really Simple PHP Login / Logout Script Example

One of the first scripts people new to PHP (or any server-side scripting really) create is a login and logout form for their site. Often times beginners get a little confused as to all the parts necessary to creating such a thing. So I thought it would be helpful if I showed a really basic and easy to use PHP login / logout script. The script uses an existing database ...

Batch Renaming of Files Using Recursion in Python

Someone came into the Dream.In.Code forums the other day asking about batch renaming of files using Python. I thought I would work out the example for everyone to see and create something that they could add to their own personal libraries of code. Python makes this pretty easy to do using "os" and "os.path" but one tricky part I found was dealing with the method isdir() and similar functions which ...