or The art of using Baby Steps and other strange programming principles

What about Bob?
What about Bob?
What about Bob?

Over the years writing code, I have been testing various programming principles. Some I rejected, others I adopted and others I adapted. I also invented some.

It is not enough for a principle to be very good, it needs to be remembered or it will not be used. I believe that the most remembered principles are those that are imported from the everyday life. And if they are associated with something nice or have a funny name, more we tend to use them. And lighter our work becomes.

The Chuck Berry principle


The right architecture for handling mouse and keyboard events

Messy event handling
Messy event handling
Messy event handling

Simple Application

The browser (JavaScript) is very helpful about handling user input. For example:

var doneButton = document.getElementById(“done”)
doneButton.onclick = function () { sendDataToServer() }

This is a simple and straightforward code that works perfectly well for the following context.

  1. The user spends a minute filling out a form with his data.
  2. The user clicks the “done” button.
  3. The user waits two seconds for the page to be updated, which he considers very acceptable.


Timing logic and animation

Programs like video games have complex logic (mechanics) and animation. In this article, we will examine some principles about timing. This subject is not hard, but maybe very tricky if we don’t follow some basic rules.

This article is suitable for any programming language, but a few parts are specific to JavaScript.

Photo by Andrik Langfield on Unsplash

Small convention

In this article, the word “mechanics” refers to the game logic; how much life has the avatar, for example. While the word “animation” refers only to the visual aspects; the sprites that are drawn on the game canvas. The animation is supposed to match the mechanics.

The main loop (the foundation stone of timing)


How to handle the overlapping of source lights in a 2.5D browser game

Lost In Maze (browser game)

In this article we will see how the light effects of the browser game Lost In Maze were made, in plain JavaScript, not using any library or WebGL.

General performance

Drawing sprites (images) on the browser canvas is a very efficient process. We can rely on it as long as we don’t abuse it.

Due to the 2.5D nature (perspective) of Lost In Maze, it is not possible to draw just a part of the canvas: there is always some missile flying among trees, for example. …


Making a living in the stock market

Photo by Ibrahim Rifath on Unsplash

This is the sixth article of a series. The previous article is “The Stock Market Needs (losers) You”.

There are people who think that compound interest is evil and unnatural. Therefore, it should be banned in favor of simple interest.

In this article we will analyze whether banks who lend us money at compound interest do so because they are greedy or because compound interest is the natural mathematics.

Spoiler

Banks (as far as I know) are greedy and insatiable.

Good! Now we just need to look at the mathematical question. Let’s use a fanciful example.

Fanciful example

You and your best friend…


Making a living in the stock market

Photo by Dmitry Ulitin on Unsplash

This is the fifth article of a series. The previous article is “Pretend You Own a Shoe Store”.

Commercial trading

the practice

  1. You enter Joe’s shop and pay him $2 for a lollipop.
  2. You leave the shop.
  3. Joe calls the factory and buys a lollipop for $1, replacing the one he sold to you. Good trade!

the theory

  1. The system demands to be fed with money.
  2. You feed the system with money.
  3. The system feeds you with lollipop.
  4. Joe is happy. You are happy.

Stock exchange trading

the practice

  1. You enter the stock market and pay $2 for some stock.
  2. You don’t know who is the seller. I know. …


Making a living in the stock market

Photo by Boston Public Library on Unsplash

This is the fourth article of a series. The previous article is “The Cat in the Kitchen”.

Pretend you own a shoe store. You buy shoes for $50 and sells for $100. The gross profit is $50. As you have expenses to maintain your shop (fixed costs) you know part (or all) of the profit when you sell shoes is consumed to cover the fixed costs of the shop.

There is a certain pressure on you. Each month you need to generate gross profit enough to cover the fixed costs of the shop, at least. …


Making a living in the stock market

Photo by Nick Karvounis on Unsplash

This is the third article of a series. The previous article is “The Magical Elven Box”.

I remember my mother preparing the meal in the kitchen.

While she is cutting the meat, her pet cat is purring, meowing and rubbing its body against her legs (accident-prone), begging for a meat bait. As always, my mother goes to the laundry room and places some meat in the cat dish. And the cat eats the meat.

Once in a month (not exactly), the cat does not eat the meat. It sniffs it, runs back to my mother and repeats the ritual hey-give-me-a-bait.


Making a living in the stock market

Elven dice tray at The Wizard’s Vault

This is the second article of a series. The previous article is “How Many Golden Eggs Would You Pay for the Golden Goose?”.

Some clarifications

What I mean about making a living in the stock marketing is making money enough for your financial independence, at least. I don’t mean working 8 hours per day connected to the market. In fact, you will have a lot of spare time. And when you have time and are not in need of money, you can work in the activities that you are passionate for, in the pleasant conditions that you choose.

Ideally, working in the…


Making a living in the stock market

Photo by Sharon McCutcheon on Unsplash

Is it possible to make a living as investor/trader in the stock market?

Yes. Possible and easy. This is what I’ve been doing for more than 35 years. In fact, it is the only way I made money in my life, except when working as employee in my youth.

At this point of life, I would like to expose and discuss some thoughts, beliefs, experiences and financial strategies.

I hope you can use it somehow.

Let’s start!

Our special fairy tale

You dream a very pleasant dream. You are walking in a beautiful magical garden, rich colored, with pretty and strange animals and plants. …

Joana Borges Late

I am interested in computer programming and production of browser games. Also I am a fan of https://www.bobsprite.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store