Why not thinking will help you code faster.

Andrew Velez
Posted on 4/25/2019Last Modified: 5/2/2019

When working on a project you will always run into a problem that requires a lot of thinking. There are multiple solutions and ofcourse you want to know which is the best way to solve that problem. So you take a couple days, maybe even a week thinking about what is the best way to solve the problem. This might just be a huge waste of time.
Let me clarify, my article isn’t about not thinking about good design but rather its about not thinking about how the classes will actually be implemented. I only think about what I need to do in a high level way. “The classes should talk to each other this way.” “This class should only do this.” But that really should be as far as you go. I find when i write what the method will do and what variables need to exisit it was a waste of time.
There are scenarios where it’s best to write out what methods and variables need to be in a class. That time is when you need to get a good grade in your university class. You’ll have to do this for qml diagrams. They can be over detailed and useless In my opinion.

Just Code Already!

All that time you spend writing out what the methods should do could’ve been used trying to figure out that problem. If a problem is so hard that you had to take a step back and think about the problem then take the first solution and start playing with it. This will put you in a state where you can come up with more solutions. If you are using version control like its meant to be than you can revert it later if you decide it wasn’t the right solution.
Once you write that first solution, I can say definitively that you have a way better understanding of the problem then if you were just thinking about it. It probably took you the same amount of time too. Taking the time to write code and getting a working solution will propel you in the right direction for how to solve the problem the right way. Even if you decide that the first solution you thought of was wrong.

I’ll give you a real life example.

When writing software to solve the problem “procedurally generate a map” i would start of by defining my first task. (Ill talk about how i do this in a bit)
My first thought when seeing this problem is to create UI with a button that places a mesh on the map. My first “solution” doesn’t solve my task. What it will do is give me a framework for creating the UI and start adding objects to the scene. I can later add more logic to decide where to put the object but by just having started the problem i know how to start generating objects.
If you familiar with Unity this is a really simple task but if you’re on a different engine you’ve never seen before than this could actually be a hard task.
You can learn half way through the task that it would be better to generate those objects inside of a predefined area like a sphere. You decide that it would be better to have the generate objects button inside of the sphere class. (This is probably not the best thing to do, The idea is that your first solution just became obsolete) The first thought you might have is that i wasted all that time. That is far from the truth though, you took all that time learning how to add buttons to the engines ui and you also already have code for generating objects. It would be really simple to transfer over that knowledge to adding a button to the sphere class. That code you wrote for generating an object can also be moved over.
In the process of writing that code you were able to come up with a better solution and reuse the code you were writing. This happens all the time. If i wasted that day thinking about the best solution then im really just wasting my time. I'm not putting myself in the best frame of mind to be able to come up with ideas.

Frame of Mind

There are multiple ways to put yourself in the correct frame of mind to start generating ideas. One my teachers spoke a lot about brainstorming and having an open culture. If everyone feels comfortable to express their deepest thoughts than you are able to come up with a lot of creative solutions. This is useful but a lot of times you will be on your own trying to figure out a problem.
My favorite brainstorming method is round robin. Everyone in the group takes time to write 5 ideas on 5 posts it. You then have people vote on the ideas they like most. The ideas remain anonymous and you aren’t influenced by other peoples thoughts when creating them. Group think can make it hard to be creative so try not to shoot anything down. People need to feel comfortable to say their thoughts.
My favorite way of coming up with ideas and the most reliable is to just code. As you are coding you will start to have an idea of what is possible with the code. Since you are putting yourself in a creative frame of mind (coding requires creativity) than you are able to more easily come up with ideas. This is when you start taking notes while coding. I talk about the benefits of note taking in my last article. It really is the best time to come up with ideas and you want to make sure you are writing them down.

Breaking up Problems into smaller tasks.

I spoke on this briefly earlier but i’m going to create a full article on this topic later. For now you just need to know that breaking up your problem to the smallest task that needs to be done will save you a lot of heartache. When dealing with huge problems it can be overwhelming to think everything that needs to be done. It’s much easier to come up with solutions to small tasks. This will help you to just start coding and get into the creative mindset to come up with ideas.
I hope you enjoyed the article, have a wonderful day

Andrew Velez
Posted on 4/25/2019Last Modified: 5/2/2019


Comments 0

0 / 10