Anyone can Cook. Anyone can Code. The Way of the Programmer

Written by alexcpn | Published 2019/03/08
Tech Story Tags: programming | software-development | software-engineering

TLDRvia the TL;DR App

How I Learn, How I Code- From a professional programmer

I found that as a long time programmer I have developed a sort of symbiotic relationship with the Internet. I do my work with its help, firing tens or sometimes even hundreds of search queries in a day. You can call me a-Google search Programmer/or a Stack Overflow programmer- but I don’t mean it the way to copy answers naively, post silly questions, get away with doing the bare minimum. No, I code with the help of the internet, and I try help it be a better helper- in small way’s, I add to the knowledge base via articles, answers, blogs, so that it becomes a little easier for someone else to follow. Nothing illustrates it better than sites like StackOverflow — the question-answer format that is much easier to follow than language manuals. But it does not limit itself with Q&A, a little of Quora, tutorials from blogging platforms, helpful Gists, GitHub everything; even maybe this article.

I am not ashamed to say that I develop/program with the help of sites like StackOverflow and other articles and blogs and gist and code that come up during Google searches. I am not ashamed to say that I am not a language expert, and yet can avoid language-specific quirks and pitfalls. I am here to tell a story where I put a strong case for others like me, and for others who want to be programmers and for those who hire and manage programmers.

You do not need a degree from the worlds best universities to become a world-class programmer/commercial programmer — writing production quality code for a living.

You can learn almost everything freely; seek and find the rest. Only you need to embrace an idea of work, something that may be done as a contract, but something that is unbounded by the confines of any contract or agreement, something that is fuelled by passion and love.

The way of the Programmer

It is better to get this straight before proceeding, as what I am mentioning is not as a shortcut, but rather a more effective and efficient way to code. To begin with, we need to have the correct idea/spirit of work. We need to define what work is; work is something that makes you sweat — literally or metaphorically- work is something that is really tough, challenging. If you are not sweating it enough, you are not working/improving enough. I know this goes against all that is written regarding work. But hear me out.

Work is that type of effort that gives you joy in indulging, a lifetime in perfecting, and executing truthfully without being swayed by outcomes.It is a relationship that demands time, devotion and loyalty.

Ask any singer, musician, professional painter, a professional soldier, writer, inventor who do what they do, as part of ‘work’- ask him or her if it is all easy. It will surely go beyond written contracts if there are any.

It is usually said -the best soldier is usually the martyred soldier- the one who fights so well and so bravely, that he has to embrace death constantly and lucky to survive; same is the case, though not literally in any other field.

The famous warriors- the Samurai’s written code reads thus

“Meditation on inevitable death should be performed daily. Every day when one’s body and mind are at peace, one should meditate upon being ripped apart by arrows, rifles, spears and swords, being carried away by surging waves, being thrown into the midst of a great fire, being struck by lightning, being shaken to death by a great earthquake, falling from thousand-foot cliffs, dying of disease or committing seppuku at the death of one’s master. And every day without fail one should consider himself as dead” ― Yamamoto Tsunetomo — Hagakure — https://www.goodreads.com/author/quotes/14204578.Yamamoto_Tsunetomo

Every life should be led with some code; every work should be done with some code. This is something deeply personal, but it will help us take the right decisions when confronted with difficult choices.

There is not much joy in life if work is boring. One of my favourite pass time is to clean; I used to do it as a kid, I do it now, making endless small changes -I have always felt that cleaning and organizing your house or table or something is soul relaxing (Marie Kondo anyone?). It gives me joy. I notice those janitors, liftmen, gardeners who try to excel their yesterday, hunt and clean the dirt under counters, between a crack that no one will see, early at work trimming grass — that is work, it is hard, it is exhilarating it is a daily strive for improvement.

It does not matter what you work at, whether taking care of home or office or coding or janitoring, it is a joy to observe those that follow the code.

Why write about this? why go on and on? Because I see the abhorrence or avoidance to work by many.

It is no more fashionable to stretch, to strive till night, to find the real cause of that bug, to expand and stretch and strengthen your skill.

Not that I am advocating stress, nor am I some super healthy person who has no apathy to those handicapped by some problem or other, either too personal to reveal to others or too frightened. I suffer from migraines/headaches of all sort even now. I have coded my way through one of the most painful of all -cluster headaches. Yes, when you need to rest you need to; neither is it wise to carry a debt of time with your kids, your spouse or close relations. But that does not mean that you skew more to life than work. Life is work. You cannot run from that; embrace it and enjoy.

Trained for the Job or Training on the Job

As I started my job I asked this question in Google groups — Do you have to be a good mechanic to be a good race car driver? I thought at that time the question was very deep and poignant. If you are not me, it may look a strange analogy, maybe even silly if you start thinking critically about it. I wrote that with intense feeling at that time, after getting rejected again and again in various programming job interviews at the beginning of my career. All were asking me language details and internals, and I have a problem there -memory-pretty bad memory.

I remember things, but forget things too; I have very good long term memory, not that good short term — I am not sure how to put it -I remember the essence of things; for the rest, I figure out on the go. I don’t remember ‘interview questions’. I started off as s C++ programmer. Virtual functions, polymorphism .. I don’t remember the rest of the standard questions. So most interviewers rejected me. After a couple, it really starts hurting. You feel sad that no one is able to see your point. Rejection hurts always. Surprisingly very few asked about my work. I was a pretty good programmer then, though I was very less experienced. Come to think of it, I understand better now, experience has nothing to do with how good you are. Especially true of big companies.

One of the best person I took after interviewing (that was years hence) failed in my standard interview questions (yes I ask some of these questions- just to filter out the ‘unwashed’ as Joel Spolsky puts it) -he was sure that I would not select and was going to pack up. Truth is I never care whether the answer is wrong or right; an interview is not a quiz. I care if they have it in them the curiosity, and the desire to excel daily in their work that will give them the tenacity to find the answers- somehow, and improve their craft with time. I basically ask and listen about how they did their work, even college projects for freshers and that tells a great deal. Sure I have taken in not that great people also. But the ratio is less.

And lest you think the StackOverflow/Google search programmers like me are among Joel’s ‘unwashed/un-interested/blue-collar programmer’, you may be right, if you are a person like Linus T or some other amongst those few super-hero /genius programmer/language creators. But as the general crowd goes, I smell or stink as much as the best of the rest. I have done pretty ‘languagy’ things , stretched the language as much as it will go, as good as the next. I am not much interested in the language as is, except maybe once in a while, the strangeness of JS (monads was it ?). I have worked for years in C++, then years in Java — little Scala (yes Actors too- I am no fan), then a few years in Python, then with JavaScript, TypeScript, Go lang and hell even fiddled with strange Clojure!. All was for some end, not for the language itself.

To give the title some justice, as Python is the worlds favourite language -if Python was a statically typed and strongly typed language then it would have come close to something I love the best too; because it is pretty easy to code with it, and with strong static typing, easy to do commercial grade/production quality code in(assuming, of course, the problems like the GIL limits etc is not there, but I am speaking just from a language angle, not the implementation part).

So how did I learn/code in Python and do it still?

Here is an hours snapshot -

A typical hour in the life of me in office

Does it mean that people like us, who code, but are not specialized language experts ? not necessarily. I have used greenlet via gevents, multiprocessing, graph programming (germlin ), custom C extensions- and the works.And when faced with some code that I am uncertain of, I check the net for best practices, common pitfalls of the language, anti-patterns of the language and what features to be careful of when using.

This is how I Python.

I code in C++, Java and maybe now more in Go lang- and it is the same way. Hell, I started learning TensorFlow this way, it really gives me the chill,-it is spine-chillingly hard, but I do not know any other way or a more effective way. Especially if you are impatient and do not have time to sit through a structured class.

I remember this search when I started working with Python as a tech lead and faced with a code review — pasting the link as is, as it gives an idea about the search -https://stackoverflow.com/questions/3076967/python-is-this-an-ok-way-of-overriding-eq-and-hash. The excellent answer to that by Alex Martelli is all you need. Same for other languages. How much the answers by such people help others are reflected in posts like this.

Sometimes if you are searching meaning in your work/life or meaning of your life, helping the world and future programmers by your answers maybe not that bad an idea to spend your spare time on — make the programming world a slightly better place than it is.

The Law of Leaky Abstractions and the Programmer

Here is a some thing to know about programming languages and generally all frameworks

All abstractions are leaky abstractions, same with Programming Languages

I mentioned (or if not, let me mention now) about being careful with languages especially when writing production quality code. Most people know how quirky JavaScript is. Though not that evident, no language is designed perfectly; nor can be. The more you use it, the more certain key abstractions leak through making you a language expert or language horror aware, even if you have not the least intention of being.

Production Quality Coding is like Professional Quality Cooking — anyone can code- anyone can cook; But if you want to serve in a star restaurant you need time, effort and a work code to hone your skills. I am not giving the false impression that you can Google your way to Codedom in a few days. It will take at least a year or so if you are very good and for others maybe two or three.

After tearing my hair for years chasing down strange threading problems and stranger memory leaks in C++ (one happened only in one server and I spend weeks trying to reproduce it in vain in other machines -finally reached out to our company C++ tutor at that time -old bearded absent minded person-he told me that in his times they used a hair dryer to fast fail corrupted rams which were causing sporadic errors — that was the strangest debugging advise I have got), I was really happy in my initial years in Java; I loved automatic memory management like I loved anything till then; but only till the ugly/gory/complex details of the garbage collector came up and I needed to understand it. That was for some code that used huge heap (not mine) and was churning out huge string objects and dereferencing without much thought. This was before G1 GC and I spend a month figuring out what was happening -gcstats, histograms and what to do. This is not to frighten others, but this is a fact, the best of the abstractions will leak through, and maybe at a time when you least expect it. That is part of the work code, that you devote enough time to understand and solve it, and not work around or postpone or ignore it. That is not a true programmer’s way.

The Programmers Code — Production Quality Code for Production Use

This is why I warn/preach/beg people who just code the functionality and go. This is why I keep harping about production quality code. There is a growing culture now, on not engineering enough, not having the pain to design your program to be easily extensible, testable (by others), readable (by you and others), scalable, using low resources (don’t do premature optimisation is the mantra — for me if you do not optimize in the beginning, it is extremely hard to do it later.

Here is a recent, popular post reflecting that part. (most of the other parts of the post are really good though)

** Second, building performant systems seems rational. Some engineers are appalled by “hacky” systems as if they are a moral failing. This aversion to potentially inelegant solutions is especially an issue for startup engineers who worked for large tech companies where everything must be done at scale. “Do things that don’t scale” is a regular missive in Y Combinator, and it applies in engineering as much as it does in business processes. -https://hackernoon.com/four-startup-engineering-killers-1fb5c498391d

Yes, I feel appalled by hacky code now when I am a big company programmer, and back then, years back when I was in a very small company.

I am screaming here — It is f**ly simple to write/wire up some shit to do something- but how does it handle the load that will come with time, how easy it is to extend with the features that come with time, how easy it is to read, how easy it is to debug.

If you, as a professional programmer do not know about this or care about this, well, no one else will know about this — for a long time sometimes. I feel this is not the way for the good programmer, whether management understands it or not, whether you are crucified or praised for that, you cannot know this and write it for easy gain, even if that means you miss deadlines (mostly you won’t).

I guess with startups this is the sort of culture- build something fast, get customers, sell it fast and get a lot of money. The good intention may be that if we have so many customers, we have enough time and money to rewrite — I know Youtube and I guess even Google started with Python, but I also read(and have seen too) that rewrite is pretty painful and unclear results.; mostly it fails.

Almost two decades ago, Joel Spolsky excoriated Netscape for rewriting their codebase in his landmark essay Things You Should Never Do.

He concluded that a functioning application should never, ever be rewritten from the ground up. His argument turned on two points:

The crufty-looking parts of the application’s codebase often embed hard-earned knowledge about corner cases and weird bugs.

A rewrite is a lengthy undertaking that keeps you from improving on your existing product, during which time the competition is gaining on you.

https://medium.com/@herbcaudill/lessons-from-6-software-rewrite-stories-635e4c8f7c22

I was part of the team that took over and maintained a startup company product that was bought by our company, all written- you guessed it right — in Python (you can do things really fast with it). I know the horrors of large projects or projects that have gone large using this mentality. It is bad, and worse it is a nightmare to refactor or re-write it now.

And since we are still on Programming Languages and Leaky abstractions — Python- it looks all good and clean, except when you unexpectedly come across the limitations due to GIL, and the dynamic type starts making you crazy after you have created a layer too many, even with proper TDD way. I know there are some posts that argue that static typing does not help in any way, even though general reports are there how it has reduced bugs in companies. I won’t argue with those. I won’t argue with any for these matters. But my opinion stands, and I do code in dynamically typed languages and use that in production too, but keep it to the minimum and always with proper test cases -TDD.

C++ has no strong abstractions, so it does not leak through; however, you have to however forever swim through it or you drown. It is a language like Python that never seems to fade with time, though nowhere as popular as Python and rightly so.

Go Lang looked nice, but not as easy as Python. I used it for some time. I have used it very less, but its lack of a package management feature was a surprise -it was dep and something else and now something else.. (Though I would have spent at least a few weeks in it I forgot - I just googled** it again — it was Glide and then it got depreciated and now it is what ? dep I guess). This is my how my memory works, maybe all enterprise programmers who need to deal with multiple languages and technologies are in the same helpless state.

This is how I Python

My wife learns classical dance. I wonder at the teacher who remembers all those complex songs and steps in mind. I wonder at my wife who remembers all the steps in mind and relates to the song sequence. I am really amazed and since it is so easy for them, they can never understand.

I was a very poor student in my initial years. In my early school days, one of my teachers used to throw my book and me in that order out of her class as she got irritated with my handwriting or lack of that.

I am certain now that I am really stupid about many things, and that awareness is my strength as it gives me a challenge every day to improve.

But there is hope for those of us stupids/idiots/misfits in the world of programming. You don’t have to remember things. You just have to create. It is a beautiful job.

Like anyone can cook, anyone can Python. A great Pythoner/Programmer you can be if you like your Pythoning and willing to work and improve over time. Again as I said you cannot be a hero in a day, it takes time, maybe a few years, but it is really doable.

Those who are capable of doing incredibly complex things think programming is complex, while those like me, know that if it is simple enough for me, it is simple for most of the world.

Come into the world of Programming. Hundreds of thousands like us are there to help you via sites like Stack Overflow or blogs and similar.

Other related posts

Love Python? You may like this link

Learning Pythonmedium.com

Love some other language -Google furiously and learn- Happy Programming!!

Use TDD to write Production Quality code

https://hackernoon.com/tdd-the-great-divider-the-world-needs-a-better-name-code-a-little-test-a-little-coli-teli-87624b0becd8


Published by HackerNoon on 2019/03/08