Posts Tagged "General Discussion"

Random Quote Generator Using Try-With-Resources in Java

We at The Coders Lexicon thought it might be advantageous for some of you learning Java to learn how you might structure something like a basic random quote generator. To make things a little more interesting, what if we read the quotes from a file and used a "try-with-resources" statement? That way we could add additional quotes to it over time and have the program generate random quotes on demand. ...

Functions Are Half the Battle

At this point I have been programming for nearly a quarter century. I have done multiple languages and worked with multiple platforms and technologies. Some of it can become quite complex and with that complexity comes extensive testing and solutions that just don't feel elegant at times. I often find myself asking the questions "How do I simplify this?" or "There has to be a simpler way, what is it?" ...

Applying Functional Programming Ideas to OOP

The ideas of functional programming have been around for a long time. This paradigm has several key principles that, while not exactly compatible with the Object-Oriented Programming (OOP) paradigm, do have credibility and advantages in their own right. Is functional programming better than OOP? In some ways yes, but in some ways no. It really depends on the problem you are trying to solve and the best way to think ...

Creating Enumerations in PHP

If you are experienced in any of the major programming languages (.NET, Java, Python etc.) you are probably familiar with the idea of "Enums" or "Enumerations". These are used to help increase readability by assigning readable names to a collection of static values. It is much easier to read "Color.Red" than seeing "#FF0000" or "1". To expand on this idea imagine writing an if statement where you would compare a ...

Minimalism in Code

You may have heard of minimalism before in all sorts of disciplines and philosophies of life. Some of you might have heard of it as living without many possessions or perhaps in computing to refer to using as least amount of hardware and software resources as possible. I would like to take a small spin on perspective of applying this philosophy of life and apply it to writing code. While ...

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 ...