Art of Code — Why you should write more Pseudo Code

How constantly composing solutions to daily problems with the aid of Pseudo Code can help us become better developers

What’s up?

In the book Art of War, written by Sun Tzu is a master piece with deep insights to strategy, tactics and the differences between the two. A remembered quote from it that had become quite infamous around the world is —

Strategy without tactics is the slowest route to victory. Tactics without strategy is the noise before defeat

A picture of the spread open Original Art of War book written by Sun Tzu — Credits Flickr

It seems that in most cases of discussing when to use either of the two and how — us human beings tend to lack the first. We further tend to contemplate much more on the importance and significance of Strategy or the lack of it.

In this article, I chose to do quite the opposite and highlight the importance of Tactics. Further in the context ahead I would like to compose my own quote from the above.

Strategy without tactics is the noise before defeat

I will introduce a frontend developer’s very powerful tool that can help us devise tactics in our day to day work and “Tacticize”, for a lack of a term for devising a tactic in English(although there is one for devising strategies — ie. Strategize).

Design is not the Destination rather, a Journey

Credits Genpac

When approaching complex requirements, design is of course a very important part that has to take place and sometimes iterated upon in order to maximize productivity.

Further, I would like to raise the importance of writing pseudo code (even after design is supposedly ready) — Even if a requirement seems to be designed, scoped and been thought through — It is quite prevalent that when the developer actually starts coding that other issues and concerns rise.

Investing this bit of additional time to organize our thoughts by utilizing this thing called Pseudo-Code we could benefit a whole lot. Whether it be to pick a name for a big function that would eventually generate some complicated entity or structure and inside it a few purer functions that would only be in charge of specific mapping, generating, randomizing of some properties or data properties.

Motivation, Focus and Thoughtless Hacking

Credits Giphy

Taking this time to write commented pseudo code helps organize our thoughts and our motivation and plan the desired outcome code ahead. By doing so, one moment later when we venture through to start hacking we would always have this map or skeleton of our thoughts that can help us regain focus and increase our productiveness and of course we are always welcome to modify this pseudo code skeleton as we hack on and iterate over and over it until it reaches its final form and we have our desired logic built and functional. That is, until the next time a client or our product manager comes with different requirements :)

Strategy vs Tactics

Credit to Diogo Moni

One should not confuse design, wire frames and supposedly scoped development capacities with a real-time updated, in-code, more detail-specific, logic-separated code skeleton called Pseudo-Code.

In order to better perceive its importance I believe it is only reasonable to make the comparison to the difference between Strategy and Tactics. While product design, UI/UX design, specs and requirement scoping is the strategist behind the R&D of a app/screen/feature/component that helps us contemplate things in a higher level. Pseudo-Code is our friendly and more close tactician that is much closer to us physically in the battle field thus, better understands and can better help us in winning the battle and achieving glory in maintaining productivity and deliver in reasonable times.

Between Self Explenatory Code and Blind Developers

Credits Giphy

A huge eternal debate about code comments is taking place all across the world in different time zones and times and will probably continue to take place for all eternity. If we continue our analogy of wars, battles, strategy and tactics without trying to determine which of the sides is correct. I would like to argue that not writing any comments during development is equal to charging blindly at a complex challenge with odds of failure or defeat that are ever against us. Instead I would suggest to use Pseudo Code comments as part of the development process mainly to help us improve our code tactics.

I believe we benefit significantly a second time by keeping pseudo code comments above certain areas in our code as it is a living, updated development-only documentation inside our project that will benefit our team mates when they reach areas of code we wrote.

It will further benefit us when we come back to these areas of logic we wrote a while ago and ask ourselves “who’s the idiot that wrote this?!” and realize it is us — our tactic plan would lay flat in front of our eyes and aid in instantly reminding us what were our true intentions. We can then iterate over the code to see whether our intentions were met or maybe if we have a new requirement to build we quickly become oriented and can better modify that logic if needed.

We of course can always use a library that will remove all comments from our code during compilation and make sure none of them reaches production code, so that issue is of course a solved problem and would not bother us.

Stay in the Game — Stay Focused

Credit to WealthyGorilla

Writing pseudo code can also replace the need for updating every little thing in our task-management platform. whether it is a story in JIRA or a card in Trello(or other programs) we usually get the high-level requirements written there but the lower-level requirements and tasks that are many times discovered during the development process itself are what we are trying to address here.

In some work places these requirements are not monitored at all and the developer’s mind is basically what is being count on to remember every little requirement. In other places us developer are required to update the status of the larger task in the comments or update the requirement itself.

Credit to Brainspores

This process, while maybe beneficial for the team manager or project manager is quite a focus killer. And honestly, most developers do not take the time to even do it and it is usually is prioritized very low if at all.

Pseudo-code Life Cycles

By writing pseudo-code during development, before we begin coding and after we’re done(in thoughts of having everything clear for us when we come back to address certain issues) — we achieve many feats.

I contemplated the following pseudo code life cycles model to help visualize when during our development Pseudo Code meets us:

Pseudo Code Life Cycles Model I Contemplated

Before the work — is what we pretty much cover in this whole article — in short, this is the right way to address complex issues by taking them apart to smaller more manageable and addressable problems. During work — We are able to maintain our focus and not have it shifted to an other product/browser/window. Secondly, After work / Returning to an Existing Issue — When we get more time or are directed to address an old issue we now have clearer guide lines and focus points of the lower level requirements we should address in order to solve the issue in hand, we now where we left off and how to pick it up efficiently.

Important Side Note — Pseudo Code is a tool at our disposal for the purpose of Ideation, Challenges Breakdown and mainly used in Development environment — once serving its purpose and challenges are solved it is no longer needed and should be removed from the codebase either manually / automatically to prevent its appearance in Production environment.

Conclusion

I become more and more aware to the existence of Pseudo Code and the potential benefits it withholds for us developers by writing more of it as we plan ahead, it is further a tactical tool in our disposal and we should utilize it. I decided to share these thoughts with the world and hopefully learn from others whether they use it as well to overcome daily challenges. Further, I aspire to help others in introducing this methodology and urge you to test it in battle as well and share their insights and thoughts!

Credits Giphy

Now What?

More Recommended Posts by me about Product Design, UX & Frontend:

More open-source Vue Components:

Vue Dynamic Dropdown — A Customizable, easy-to-use elegant dropdown

Vue Dynamic Star Rating — A dynamic vue star rating component(similar to google play)

I am Jonathan Doron, a Web Developer with great passion for User Centric Frontend, and modular client architecture.

What thrills me these days is exploring the ocean of Interaction Design more specifically of Microinteractions and their impact on our lives. I do it by recreating existing interactions as well as designing my own interactions along my quest to deepen my knowledge in the field.

You are welcome to follow, tweet or message me freely with any questions, feedback or suggestions! — Twitter