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”

Development Sandbox: My Coding Guidelines

Great programming is a balancing act between writing good, readable and organized code. Good code is fast, efficient and memory conscious. Good code is also very easy to read and to understand. But also the way the code is organized is of the utmost importance. It’s a balancing act because sometimes fast and ugly code needs to give way to readable code. A single linear function that’s optimized to the nines may be super efficient. But it’s also a maintenance nightmare. Continue reading “Development Sandbox: My Coding Guidelines”

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”

The Best Scala Programming Resources

In the last few weeks that I’ve spent learning Scala I’ve discovered several amazing online resources. So much so that it made it difficult to justify purchasing a book, even though I did buy the much-recommended Programming in Scala title. Every time I needed help in figuring out how to do something, the following websites were indispensable.

Some of these sites are no longer active, but the information they provide is still very much relevant to new and experienced Scala programmers. Continue reading “The Best Scala Programming Resources”

Four reasons to try Scala and love it

I’ve been working a lot with Scala in the last few weeks. It is an amazing programming language, to say the least. It’s terse, intuitive, unambiguous. And a real treat when you want to do stuff. It’s the programming language of the future. If only it would get more support and momentum going for it. Plus, the quantity of online resources available is just mind boggling.

Below are my N reasons why Scala is the best JVM language. Continue reading “Four reasons to try Scala and love it”

Good programmers should have great math skills

Coding exercises are one of the best ways to improve your programming skills. In recent weeks, I’ve done several exercises on a couple of online websites. Those being CodinGames and HackerRank; you can follow my progress here and here. Coding exercises are great for improving your coding skills. But it’s also a chance to spend time in minimising the code you generate.

I’ve been focusing on learning Scala, a JVM-based function programming language. It’s a magnificent language with a rich streaming library perfect for this sort of thing. But as anyone who has done any of these challenges, it often involves a lot of algebra. And sometimes trigonometry. Although I’m okay at assembling my own formulas for solving problems. But solving for x can sometimes be a tad challenging when the formula is a bit complex. Continue reading “Good programmers should have great math skills”

Edit and execute programming code online quick

Ever wish you could test a snippet of code? Online. Like now! Or focus on improving an algorithm in isolation. Or have a moment of clarity and need to write a piece of code lickety-split. Yesterday, I found this online tool to do just that. That’s good for me, as I don’t have to create a whole new project in IntelliJ IDEA or use the CLI tools.

CodePad supports several of the most used programming languages. Unfortunately, it doesn’t support Haskell, a language I’d like to tackle this year. But for Scala, it’s really good.

The tool itself is easy to use and the compiler quick enough. In my case, I was using it to optimise a piece of Scala code to submit for an online coding exercise.

codepad

Website: https://codepad.remoteinterview.io

How to become the best mad skills programmer

Learning to program in a new language can often be difficult. First, you have to learn the basics to code “Hello World”. Then comes the challenge of learning to use the advanced features. And finally, the challenge of using the language the way the creator had intended.

The challenge is finding exciting exercises and projects to tackle. Something big enough to sink your teeth in. Yet not so big that the challenge seems impossible. Continue reading “How to become the best mad skills programmer”