Saturday, September 24, 2022

Software Development as Meditation

Meditation

There is a sense of peace, relaxation when you are at a meditation retreat, you close your eyes, listen to the breath and feel the flow of air through your nostrils.

You concentrate.

Interruptions are not welcome, but your mind, being what it is, will naturally take you places. It's like the 2-year old with a five-second attention span. And so you are taught to gently bring your attention back to the breath when you discover this mind wandering.

I'm told that even seasoned meditators (if that's a word) of decades of experience will feel this mind wandering, it cannot be helped. But it can be managed. It may be simply thinking of bills, projects, taxes, relationships, weight, upcoming trips, food, discomfort, pain, parents, spouse or children. This stuff just bubbles up and you think of it.

Writing Down the Bones

Then Natalie Goldberg came along and said that you can use writing as a form of Zen practice. Exploring the mind through writing. I enjoyed one of her books, Writing Down the Bones. I enjoyed it enough to buy  my own hard copy - since I normally get all my books nowadays either from the public library, or ebooks from Kobo.

I love writing, and Natalie taught me to put the pen on the page and simply go, without stopping for a page or two, not thinking but allowing the pen to move and the words to come out. For me, this was a step up from the breathing and I rarely found my mind wandering. However, a couple of pages was my limit since my hand would get tired. And typing is not the same thing.

Morning Pages

And then I read Julia Cameron's book, The Artist's Way. No doubt these two are friends, and the influence they have on each other is recognizable. In Julia's book, the free-form, flowing, writing is called Morning Pages. You're supposed to do them in the morning, first thing, before you get busy with other things.

I actually practised Morning Pages for close to a year, and then almost as suddenly, I skipped a session, then one became two sessions, then a whole week went by without a single Morning Page written, and at this writing, in September, the last time I wrote a Morning Page was probably in July. Morning Pages were an interesting exercise and it's hard to say if I got anything out of it. One thing it did was detract from my real writing because after Morning Pages, I was too mentally tired to sit and actually write anything. In looking back at that exercise, two full pages, long-hand, each morning, I could have completed a novel. If only I had that discipline for real work.

Software Development

I'm intrigued by puzzles. I enjoy working on those cast iron chain link puzzles where the solution is removing an item, or untangling the links, from the complicated mess. Some of the puzzles, mostly gifts, I have been working on for many years, and still no solution. Clearly I don't work on them daily, or for hours at a time, but suffice it to say that I keep them close and when I feel drained, they are curiously satisfying, even in their incomplete state.

I think that's why I found Architecture enjoyable. Drawing complicated shapes in 3D was a skill I developed and I could literally spend hours working on a single item. Days even. So when my career gravitated to writing software for a living, this was not work to me. This was being paid to have fun. This was something that I could do, even if I wasn't being paid.

Software development in its purest form is problem solving. Once you're past fighting with the tools and can concentrate on the problem, then the fun begins. It can be a challenge if you're still learning how to use the tools while trying to solve a problem. It's something like trying to design a bridge but not knowing anything about structural forces and the mechanics of materials.

Project Euler

There's this great website, Project Euler, which presents mathematical problems to solve, most which need some computer tools to complete. Some are easy, and others not so. The challenge is to look at the problem, understand it, and then take a crack at it.

Here's number 1 on the list of problems, possibly the easiest one and can almost, with enough time on one's hands, be done by hand.

Copyright Project Euler (https://projecteuler.net/)

Meditation

Why meditate? I think that there's some misinterpretation in a lot of literature that paints meditation as a singular activity that requires some notion of clearing of the mind. Wikipedia describes the activity as requiring focus to train the mind to achieve an emotionally calm and stable state. Many practitioners describe a fuzzy practice which needs stillness, while there are few who indeed say that mindfulness (a practice) can be achieved even when walking.

I believe the closest way to describe what the purpose of meditation is, is as an escape. Some practice that allows you to remove yourself from the stressful continuity of daily life. In a way, sitting quietly and concentrating on the breath can help achieve this. But so too can sitting and writing some computer code. Even if it's your daily job. As long as it's not focussed on the result, but on seeing the puzzle move ahead.

Coloring books

As an Architecture student I had a lot of sketch books where I could scribble down ideas - after all, the language of Architecture is drawing. Later in life, I found that I could zone out by colouring and so I have colouring books. The difference between the sketch books and the colouring books is that one is unguided, and the other one is guided. When you're colouring, you can focus on layering colour between the lines, the shape is already there. And if you concentrate hard enough on the process, and feel the colour pencil, and look at the layers of colour bringing the image to life - the still black outlines become fleshed out with colour - then you can use colouring as a form of meditation as well.

So here's the solution, in the Python programming language of the problem above.

sum = 0

for number in range(1, 1000):

    if (number % 3 == 0) or (number % 5 ==  0):

        sum += number

print(f'The answer is {sum}')

That's the brute force method of getting the answer.

There's even an Excel way to do this, here's one solution.


In that solution, all the numbers from 1 to 1000 are in column A. Then we use an IF() statement in Excel in column B to see if that number is divisible by 3. And we use an IF() statement in column C to check if that number is divisible by 5. Finally, if there is a "Y" in either column B or C, we put that number in column D. The answer is to sum all the way down to row 1000.




Tuesday, September 13, 2022

Practice what you Preach

Life is complicated enough without the addition of drama. You cannot deceive yourself, what on earth makes you think you can deceive others? Possibly because you constantly think that you're smarter than the pack. You know more.

This past week we had the drama of petitions in the Supreme Court of Kenya where the losing candidate petitioned for a review, really an overturn, of the election results announced. The court held that the elections had been fair and that the results would stand.

During this entire process, I was intrigued to listen to the various arguments, mostly around vote mischief, and I wondered if the lawyers presenting the arguments were really confident, technically, in their arguments. This is the one feature about lawyers that is intriguing to me, and also most frustrating, is that you require a certain amount of expertise to discuss the stuff that was being discussed, and I was not convinced of the technical expertise I saw.

IF YOU DON'T KNOW, BE SILENT

Take for example the allegation that documents were tampered with. It was alleged that the winner took votes from the loser, and the way that this proof was presented was by illustrating how some of the calculations at the polling station were doctored while on transit, or when actually submitted, to the collections centre. A lot of pdf images were shared with the lawyers zooming in on various sections of the document to show alterations. In addition to that, some system logs were shared showing access to systems by developers, foreigners (the system vendor) as well as elections management - who shouldn't have had access to some parts of the system.

I would have come to the same conclusion as the Supreme Court judges. But I would have challenged the petitions on a technical level.

While not saying that what was presented by the petitioner's lawyers was suspicious, or could not have happened, the supreme court judges simply said that what was presented was not enough to convince them. Which is the second part of my intrigue. I doubt that any of the supreme court judges are technology experts and would have known to ask the various technology questions to satisfy themselves that the technology platform was secure. In fact, in one submission, the vendor refused to supply some details of the system architecture (which I find strange) but offered superficial logging - without explaining how the logging was done. I could be wrong, but in rejecting the petitions, the judges didn't give me enough good reason as to why they were rejected.

I believe that it is partly due to the incompetent submissions by the petitioner's lawyers why the fraud, that may or may not have happened, was not highlighted sufficiently as a technology problem. That the technology failed was not explained as it should have been, to a technical panel. Instead, some very tedious technical detail was superficially highlighted and, at least it seemed to me, dumbed-down to the level that a child could understand. And as an I.T. professional myself, I could have said, woulda-coulda-shoulda.

Lastly, in explaining away the petitions, there were a lot of statements like "we were not convinced," or that there was lack of "sufficient evidence" and so on. It would have been good for this standard of evidence to be explained to us mere mortals, not of the judiciary. What's enough? In murder cases, the anecdotal smoking gun is something like DNA under the fingernails of the diseased. But what do you look for in an attempted hack? What's the smoking gun?

I doubt that these were questions that the judges would have been looking for, or at least, it did not seem so on the surface. And while I'm not a lawyer, and don't know what kind of training they get, this seemed to border way too much on the superficial. System logs are somewhat useful, but only when confirmed to be authentic and secure. We've seen the movies, and we know that logs can be altered. But I suppose they can form step number one in an investigation. A direction, a place to look and ask further questions that may lead to the truth. The blood trail tells you where to go, in order to find the body. But you must be willing to follow the trail.

All in all, I'm quite pleased that the IEBC has started to use technology to manage the country's elections. The move by the Kenyan Government to full eBusiness is to be congratulated as it will increase efficiency, and reduce the level of corruption at the lower ranks.


Monday, September 05, 2022

The Fatigue of just BEING

These days it seems like I cannot get away from tiredness. From the moment I get up, all through the day, a weariness that goes to the core. I don't know why?

The workaholic in me is truly awake. When I had a 9-to-5 job, while I still went above and beyond the call of duty, there were things to be done and timelines and deadlines to achieve them in. But now that I'm my own boss, I can pack my calendar with unrealistic visionary projects and deadlines that are all seemingly in the past.

I try to get in a bit of exercise early in the morning. I now know that this is the most realistic time to stick to anything of importance. I went through a writing exercise once in which I took time, every morning, from about 5 am, to write at least two pages long-hand. This is an exercise in creativity written about by Julia Cameron in her book The Artist's Way. And for almost a year, at least I'd like to think it was that long, I was dedicated in waking up and writing, by hand, two full A4-format pages. Some days it took about 50 minutes to write, some days, 45 minutes, some days even an hour. But I always wrote and wrote with the thought that this will bear good fruit, sooner than later.

Like exercise. I know for a fact that weighing yourself each and every day is not good for the soul, especially if you are trying to lose weight. Perhaps weighing yourself monthly, or if you cannot help it, then weekly might be better. But daily, geez. That can be really disappointing. But the real trick is that sticking to a routine, a daily one, will work miracles, even when you don't feel the results, don't see them and feel rotten. The mere act of doing the work will bear results.

And that's probably where I am now. The fatigue of waking up, doing about one hour, sixty minutes, of a cardio routine, mechanically, robotically and then going through the day, and coming out at the end feeling tired of just being.

ON WRITING PRACTICE

I eventually stopped writing, but did not stop in believing that there was something to the practice. Of course there's a fundamental idea that staying put, keeping on the path, doing the drills as to get the muscle memory will eventually pan out. Just staying on the path will get you to a destination, albeit with many obstacles on the path. But it's better than staying put.

My writing practise stopped because it had become quite uninspiring. Even my determination that good things come to those who wait was waxing and waning till there was no inspiration left to do anything. Quite dry in fact. Until it became a slog-fest. Uninspiring and quite frankly tedious. So after a really long time, enough time in which I could attest that I gave it my best shot, I stopped. Not the idea of writing as an exercise, but the structure of the morning pages.

Now I write when I feel a block. I write when I am uninspired. Unlike most people who will only go to the keyboard when they feel that they have something to say, I feel that the best thing to do is write when I am lost. The writing becomes a method of finding my way. That way, I seem to absolve myself from the ownership of the content. I can write anything, in an uninspired state of mind, and feel some sense of accomplishment at the end.

And it was very tiring too - which is what I started writing about. In the beginning, I'd wake up anticipating getting to the page. And I'd write non-stop, as the exercise is supposed to. I was obsessed with not missing a single day, and when I could not make it to the pen and paper by 5 am, I tried to at least make it during the day, not morning pages, sometimes afternoon pages or evening pages or night pages. And then as the most precious time of the day, morning, was taken up in an exercise that I did not believe in, I started to feel cheated, robbed. One skipped day turned to two and then weeks turned to months. 

But like I mentioned, I still think that there's power in writing meditatively. Not writing with a singular purpose, but taking what's in your brain and spilling it out. You'll be surprised at the end that there's stuff there that needed to be penned. It was like a cancer eating at the soul and even though you can go to a meditation retreat and try on the silent mindfulness meditation, which is also positive in a clear-the-mind way, the best way to flush is to actually concentrate.

LAYING BRICKS

Thinking about something is OK, but doing the work, laying the bricks is a better meditative technique. Analysis paralysis - the strange condition where you're not quite ready to do the work, since you're in the planning stages. I could never be a project manager, the need to start laying bricks is too strong. But I have also been fond of planning ahead and sometimes the need to lay the brick perfectly slows me down, the work does not proceed since I keep asking if this is the best way for it to work. The story is inside my head, the characters are blurry, unfocussed, strangely boring and I wait for them to reveal themselves. But they don't so they never mature.

I love to write software and sometimes the same thing happens. I can see the software in my mind, like I see the hundred-story building in all its glory. But I worry that if I lay the first brick, I may be laying it wrong and then the consequence of the twists and turns later to make things right will make the ending ugly. So we don't get off the start line. And none of the characters get off the blurry platform and make it into the train, or the first line of code never gets written.

Amazingly though, as soon as I stopped worrying about the morning pages, and write only when I am uninspired, I found that I could allow myself to make a lot of mistakes. I allow my story not to be excellent and the software not to be perfect. I don't need to have all the answers before I start and somehow, things will work themselves out along the way.

Much like this blog - from today anyway.

Not planning details, but having an outline, a rough path mapped out on where to go. Details are not required, but mapping is always good. I realize that what makes it good about writing is the typing exercise, watching the words come out and solidify themselves on paper. Same thing with programming. The logic is flawlessly awesome and when you click on something and it works, a rush of endorphin gives you a little bit of a rush. You've automated something. And perhaps that's what the point is. Doing something repetitively is not a bad thing, there's a feeling of comfort in repetitive work as long as it is not boring. But the act of making a tool so that your work is easier is infinitely more rewarding - and even more rewarding is using that tool to make something.

BE YOURSELF

Why make your own table when you can buy one? Why make your own chair, or anything for that matter? In some cases it's a cost issue, but not always. The cost of buying sometimes is cheaper than the labour and materials to make it yourself. But the act of creation is a powerful aphrodisiac. There is a sense of accomplishment accompanied with satisfaction. And our altruistic selves then want to make something for someone else. The desire to make someone else happy is not just mammalian, but I suspect runs across all species.

This fatigue is caused not by just sitting, because I am quite active. But at the end of the day, doing work for others, productive work, is the key to happiness. No matter how much introspection you have or are willing to bear, ultimately, the greatest satisfaction is with sharing a part of you with humanity and not remaining in a cocoon. Which greatly explains the explosion of social media especially with the youth, the young, who have grown up in a world where connectivity is taken for granted, and can be experienced immediately. Unlike the old days when you would need to walk just to see a friend for a few minutes, in our digital world, an interruption by a friend, or a story, can happen at any moment.

And the desire to share what we are doing is an overpowering, intoxicating drug. Not to be alone, or at least not to feel alone. Even as I write this, I suspect that perhaps someone may read it, perhaps even all the way down to this paragraph. Who knows, they may connect with me at a different level in terms of what they are feeling and then they too may sit down and write something because something they have read has opened up their own personality. Because amazingly, not only do we learn by accretion, slowly and glacially, but we also learn by quick inspiration. Newton and his apple. Or Archimedes eureka moment. Sometimes it's a word spoken by someone, or an image seen. It is possible that life could change in a single moment, something happens and you are never the same again.

I have discovered, slowly, not by eureka, that I cannot think of what others want to read, or want me to say as I write. So I just have to expose myself and write and there will be people who will take this and critically say, no, that's not for me, while others may look at the writing and connect. Who knows, they may get their eureka moment.