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.


Making a living in the stock market

Image for post
Image for post
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

Image for post
Image for post
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

Image for post
Image for post
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

Image for post
Image for post
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

Image for post
Image for post
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

Image for post
Image for post
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. …


CODEX

A comprehensive tutorial

Image for post
Image for post
A linter running

This is the fourth and last part of a comprehensive tutorial on constructing a JavaScript linter. You can read the third part here.

And here is the source code of dirtyrat in GitHub.

Registering names

As we saw in other parts of this tutorial, when the linter, while parsing token by token, finds a token of kind name, it calls some function to register the name (token) as declared or as used.

Lets’s take a look at the module register.

Basically, registering names means filling dictionaries of the source code file object (rat) using the pattern dictionary[branchedName]=token.

Besides preparing data for…


CODEX

A comprehensive tutorial

Image for post
Image for post
A linter running

This is the third part of a comprehensive tutorial on constructing a JavaScript linter. You can read the second part here.

And here is the source code of dirtyrat in GitHub.

Parsing the function body — blocks

Statements like if, else, for, while always create a block of code, also known as scope. When the parser finds, for example, the statement break it must have a way to know if this statement is inside a loop or not. Other example: when the parser finds a closing curly brace, it must know what block is being closed.

Controlling the code blocks is done by two global variables…

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