The art of problem-solving

Programming for almost 3 years now, I've stumbled upon many people just asking me why exactly did I choose this path? Why is the job of a computer programmer so hyped, as some might say? πŸ€” People who haven't try real coding before may not understand what's special about just typing different mathematical, logical and other kinds of expressions into your computer. Learning the syntax (programming language's grammar) of the language is not that hard really. The basic logic is not that hard too. So, what's the deal?

Every programmer, whether it's a web developer, software engineer or ML programmer, knows that programming is not just a combination of syntax, logic, and algorithms. There's more to that than a non-coder can see. The idea of problem-solving 🀯 - the real backbone of programming in general. The thing that's so demanded on the programming market and also one of the hardest skills to learn, or should I say practice...

Overview

With this little introduction, I think it might be worth it to take a while and explore what does the problem-solving term means.

The well-established skill of solving problems can be really useful even in real life. It allows you to calmly approach and break down your difficulties with ease. Instead of choosing the not-always-working brute-force method, you can take a different way. Just split your problem into smaller chunks and solve them one by one instead. What I trying to say here is that problem-solving is the ability to choose the right method for the right difficulty. By doing this you can later solve it much easier. Also, the way that you solve your problems is important too. You can do it well, or... a bit less well. πŸ˜… Every step matters!

In programming, it becomes even more visible. Here, you have to use different structures, tools, techniques, and concepts to achieve the desired outcome. Take a website for example - your end result. The problem? - creating it. And here the whole process starts...

Achieving the result

Brainstorming

With our task of creating a website, we first have to do a little brainstorming. First, creating a website definitely isn't the best way to describe our problem. We should break it into smaller, more meaningful parts. For the simplicity of this example, let's assume that our website is static - no need for backend (server-side code) here. Without much thinking we can diverse two way of doing this:

  • By pages - we split our website problem into smaller, page-specific ones. In this scenario we'll build our website page by page, finishing one and continuing with the next one. Also, if we have pages that have similar layouts, e.g. blog posts, we can also divide our website by so-called page templates.
  • By code - we can also divide our problem from the code-side. Here, we list our tasks as different parts of our code, instead of pages. For example, first, we create the basic layout of every page with HTML and CSS. Next, we include the correct JS logic into each of these pages. Finally, we can finish with handling events - clicks, touch etc.

Here you have a very general, not-detailed descriptions of possible approaches. Of course, there are many more ways in which you could solve this particular problem/smaller problems. Naturally, these smaller chunks of our problem are still too generic. You need to break it down even further. Only in this way you can achieve the perfect checklist. 😁

Solving

At this point, it's far from over. Now comes the real solving part. Here, you first have to utilize your programming knowledge to know how to solve your problem. Then, quite frankly, you have to find multiple other, even better ways to do that. You see, in programming the way you do things matters greatly, just like in actual life. Your work needs to be done well, in the best possible way, to achieve the best possible results. Only then you can be better than your competition, innovate and just be on top. πŸ₯‡

There are several parts that combined form a good end product. All of them combined, create the way you solve your problems. These include:

  • Design - very important when it comes to visual products. You must provide the best possible experience for the user, better than others. The design also has a great impact on the user's first impressions. Naturally, if something is pleasing to the eye, the more you want to look at it. πŸ‘€
  • Performance - another aspect of user's experience. It's tightly related to the programming-side-of-things and greatly determines your success. Your product should meet users' demands with comparable or better performance than the competition. You should remember one thing tho - over-optimization is the root of all evil! 😈
  • Architecture - the code-side of your product should be well-executed as well. Good architecture can be really helpful when it comes to later managing and extending your product. But achieving such result can be difficult and complex - especially in today's world with thousands of lines of code being a bare minimum. 🀨
  • Code style - closely related to the software architecture, code style plays a significant role when it comes to readability. The code you write must be easy to understand not just to you and potential co-workers, but also to all other programmers. Only then you can say that you've written truly readable code. As a side note, this is really, really important when it comes to OSS. There having strictly defined code style rules can truly be a blessing. πŸ˜‚
  • API - particularly important when developing a programming tool e.g. library or framework. Adding good ordering and structure to your API can make it easier and more enjoyable for its end users to use it. Here, again the architecture is important, as API mainly will most likely resemble it outside of your product.

With this quick, general summary of most important things a programmer (in this example - web developer) needs to take care of and this little case-study of ours, I hope that those who doubted in the importance of that job will get at least a bit of understanding of what's going on here.

After every problem has been solved, the corresponding code must be written. And, following the prolonged phase of testing, you can mark the solving part as done. πŸŽ‰

The end product

If you think that by this time our problem-solving problem is over, you're not that far from being right. So, when we'd look deeper, you can see one more problem-solving pattern in our development cycle. One not so obvious and you can even argue that it's just made up. It's the problem that your product solves. And, before you start questioning that statement, let's investigate it a little bit further.

Every new product that comes to the market solves some kind of a problem people had and makes their life easier. In technology, whether it was a computer introducing us to the wonderful era we live in, a smartphone solving the problem of user-device interaction, or smartwatch helping you to stay up-to-date, each new product category has its own problem to solve aka purpose. A product without purpose wouldn't have any kind of impressive amount of possible users, or maybe wouldn't even exist at all. We can also go as far as saying that all the life on this planet has its purpose too, but let's not philosophize here. πŸ˜‚

So, yup, your end product most likely solves a problem by itself too! Not really surprised, aren't you? 🀨

Learning problem-solving

Now we're getting to the fun part! As complex as problem-solving might look like, how hard, in reality, is the learning process for this skill? Well, I could just say - it depends, but let's do a bit better than that. πŸ˜‰

First, let's investigate the part known as theoretical knowledge. Like we discussed earlier the solving part of a general problem-solving cycle is very much dependent on the quality of your work. Here, your knowledge definitely plays a huge role. The more you know about different tools, techniques etc., the faster, easier and better you can do your job. In this part, your learning process never ends. It's not something that you couldn't do without infinity+ time spent on studying, but you can surely do this better when you know more. That's just a rule of thumb. Β πŸ‘

Next, we have the part of what can be called thinking... I don't really know how to call it. Anyway, it's a combination of all these experiences that taught you how to approach and solve these problems. Like when you have our earlier mentioned website, you know what you have to do. You break down your problem into smaller parts and try to solve each of them individually. You know that everything a computer does must be programmed. You know how to make your dreams come true with simple variables and functions... alright maybe I over-saturated a bit. πŸ˜…

In general, you must know how to utilize all programming language features, APIs and other tools to solve your particular problem. Many newcomers to programming can quickly learn the syntax, but don't really know what to do next. They can only code when following a tutorial or other form of guidance. They understand what given code means and does, but they don't know how to write something by themselves. Personally, I (and possibly many other programmers) have been at that stage before. And I know how awkward it feels. Just take my word as granted - if you keep coding, this feeling will soon go away. Seriously! I don't know when exactly this happened to me, but I can 100% confirm that statement. But again, to achieve that, you have to keep coming and don't be afraid of trying something different than tutorials - it's really worth it! πŸš€

A mixture of knowledge and logical thinking, glued by the whole how-to understanding mentioned above, form everything you need to know to achieve the best results when solving your coding problems.

Open ending

Being a better programmer means being better problem-solver and logical thinker. This results in being better prepared for every difficulty that you can stumble upon in real life. That's why some might say that programming is an art, or rather - the state of mind. These really deep thoughts can help everyone better understand the job of a programmer.

Another thing to note is a funny relation that you'll most likely experience or have already experienced during your career. The interesting paradox - the problem-solving process is one of the hardest parts of the development cycle, but it also brings the most joy. 😁 The feelings that you have when you finally solved the puzzle. When you finally achieve the best architecture. When you finally come to the greatest performance. When you are finally happy with your work. And that's what I really wish you. πŸŽ‰

Learning programming and problem-solving is a never-ending journey. You have to be ready for some big obstacles along the way, but also some great fun. Sometimes you will have to just brute-force your way forward, sometimes just let go. It's just your story, so go, and write it the best you can. πŸ˜‰

Post credits

I hope you enjoyed this logical and theoretical, but also a bit philosophical read. If you think it's worth it, then consider sharing it to other programmers, web devs and people who always ask you what's your job about. πŸ˜… Feel free to share your opinions in the comment section below, and leave your reaction to let me know what you think. Also, follow me on Twitter and on my Facebook page for more content. To stay up-to-date with the latest articles from this blog, sign up for the newsletter below (launching soon! πŸš€). For now, have fun problem-solving! πŸ”₯

Resources