cft

The diversity software development offers to you when building stuff

Explore and get a grasp of the vastness of choices and options when developing algorithms


user

Edinyanga Ottoho

3 years ago | 3 min read

It's an undoubted truth that software development is a fast growing and emerging field (industry as you may call it) and a lot of trends come and go periodically and inevitably. Yes. That is certainly true. Many of us can relate with this, I guess. But one thing that cannot ever be buried all the way is the elegance and beauty of writing effective and maintainable software, having also in mind that there are many ways to achieve a thing when building software systems.

To get the entire point clear, I am trying to encourage my developers and friends in the community not to beat themselves in creating "effective" algorithms because of a "wild" or "ideal" practice laid down somewhere. There's no fixed approach of achieving a goal, be it in the tools used, syntactic pattern or algorithms. You only have to be sure that your way isn't leading to hell... 😁. PS: Nobody likes that place. As much as you use any pattern of your choice, you should note that your algorithms or coding pattern would be in favor of performance and computing resources. You wouldn't wanna burn your CPU by the way.

That is where this article is pointing to. Well, this is coming from someone you could actually trust because of the fact that I am speaking based on the little experience I have acquired over the years.

To avoid much ado, we will have to dive into the main point here, which is the diversity software development offers to you when building stuff. There are several ways to implement something. Ranging from sorting arrays, getting max values, reversing arrays and many more stuff we usually see on coding challenges. Below, I will analyse two little tasks in JavaScript made via Carbon, which are:

  1. Getting the maximum value from an array
  2. Reversing a string (Right to left)

Getting the Maximum value from an array

Speaking of JavaScript, we have an in-built sort function that takes a function as an argument with two variables which can be used to sort arrays in ascending or descending order. Thanks to JavaScript. However, for those who aren't aware, or want to do something more crude, there's still a way out, isn't there? Yes. You got that right. Below are two images handling both patterns;

Inbuilt sort function

Using loops

Hurray! As we see, there's some trick in the box, right? Oh, there's more to explore. That's #1 display of the plenty options you have. Trust me, there are many ways you can do the stuff above...

Reversing a string (Right to left)

This is another trick in our magic box. We will be talking about the popular "reversing a string" challenge, which could be done with just a line of JavaScript (if you so wish). We will be making use of the inbuilt split(), reverse() and join() functions and then we will try doing it without much of those buddies. So, it would be like below:

With split(), reverse() and join()

With just split()

In summary, if you observe critically, we developers don't need to know all the functions, methods, etc in any programming. What matters the most is being able to understand how codes work and knowing what and which practices to use. Programming languages are the tools, but algorithms are the blue-prints and guides which any developer can make use of. Geared with understanding, you can guide other programmers to build stuff, irrespective of their programming languages. PS: My algorithms above may not be the most effective. They are just a show of options you have. There are many ways you could try those challenges and with any language of your choice (Python could be a sweetie).

Build stuff with the approach or method you can. Don't forget to keep your CPU safe always 😉 Cloud and/or physical backups matter too... If you've read to this point, you deserve accolades. Drop your comments or hit me up when you like

With love,

Edinyanga Ottoho.

Your neighborhood developer.

Upvote


user
Created by

Edinyanga Ottoho

An experienced software engineer having 5+ years of development experience in both open-source and commercial systems. Ranked amongst 1% developers by Turing


people
Post

Upvote

Downvote

Comment

Bookmark

Share


Related Articles