Development Sandbox: Building A Better Math.pow() Function

I remember a long time ago I had read an article comparing two keys on a classic calculator. Someone had asked why the [Xy] key where y is equal to 2 is slower than the [X2] key. So I thought I’d have a look at the JVM’s equivalent function, Math.pow(). But also I wanted to see if I could create a better version of that function. Continue reading “Development Sandbox: Building A Better Math.pow() Function”

Ways to Learn a New Programming Language

Every programmer should be learning a new programming language on a regular basis. That’s every three, six or twelve months. For me, I like to vary my languages by paradigm. Object Oriented Programming. Functional Programming. Declarative versus Imperative Programming. Compiled Languages versus Scripting Languages. Dynamic versus Static Programming languages. There are two reasons I want to learn new languages. One, I like to apply what I’ve learned from one paradigm and apply it to my current situation. Second, I like to stay up to date on the needs of the industry and be ready for whatever may come. Continue reading “Ways to Learn a New Programming Language”

Development Sandbox: Coding Patterns

Java is a habit-forming programming language. After a few years, good programmers find efficient ways to code. They’ll accept the programming language’s shortcomings. And they’ll make the best of a not-so-good situation. Pair programming and code reviews have provided a means for programmers to share ideas. They learn from each other to write better and cleaner code. It’s a social experiment of sorts. The more you are exposed to other developers and their code, the more your skills improve. It’s an evolution. Continue reading “Development Sandbox: Coding Patterns”

Development Sandbox: Int to String Conversion

Recently, while reviewing some legacy code I discovered a trick a developer had used to convert an integer to a string. The developer did this because the function only accepted a string as a parameter. As developers, often we look for succinct ways to code thinking that less code is faster. The interesting thing about the code is that it was the slowest of all the tests I had done. In all my efforts, I found five different ways to code to a conversion of an integer to a string. Continue reading “Development Sandbox: Int to String Conversion”

Development Sandbox: String Concatenation

When you review and work with other people’s code you sometimes find some tricks to optimize your own code. Most of the time the tricks look impressive in their succinctness and streamlined approach. And so you’d assume that the performance behind the scenes would be mind-blowing. So I decided to have a look at string concatenation. I have seen a number of ways to concatenate strings. Usually, the ones that do everything within scope will do it properly. And there are concatenations done other ways for appropriate reasons. But I thought I’d still have a look at the many ways one can concatenate a string.

Continue reading “Development Sandbox: String Concatenation”

Development Sandbox: Java code inlining

Once in a while, it’s fun to take out the Java development tools and experiment. So I did just that. I went online and found a bytecode editor that does a quick job of parsing Java class files. I wanted to see what my code looked like in bytecode form. I wanted to test if a complicated if condition would get inlined. You know what I’m talking about. You’ve written that complicated condition fairly often. You need to validate that the variable you’re testing against is not null and is accessible. Continue reading “Development Sandbox: Java code inlining”

Taking on Machine Learning

About two months ago I took steps to get into the Machine Learning bandwaggon. It was tough to take that first step for many reasons. The first was the tough decision of choosing the right programming language to learn. Did I want to stick to the JVM and Java or chose another JVM language? Take up Python. Or learn something else. This article from KDnuggets made that decision much harder. Luckily, due to circumstances from a recent project, I decided to turn to Scala. And so far, I haven’t been disappointed. Continue reading “Taking on Machine Learning”