And they can make you a smarter programmer

Software bug
Software bug
A software bug — Photo by Neenu Vimalkumar and Markus Spiske on Unsplash

The title of this story is a joke we exchange between colleagues when any of us is on the verge of a nervous breakdown due to a software defect that cannot be solved. Or when, at 5.30 pm on Friday, a customer sends us the list of anomalies found, right in the last useful moment to ruin our weekend. Or better still, when somebody sends us a WhatsApp message like “doesn’t work”, period.

We programmers don’t like (software) bugs, but the reality is that they fill at least half of our time and are an essential part of our work. Moreover, they are perhaps the most effective device for us to grow and become expert programmers. The trick is to deal with them the right way and get the most out of them. …

How JavaScript allows building cross-platform Apps that need to run for a few days, but must not even have one flaw

Image for post
Image for post
Image by Tatiana Syrikova from Pexels

No time to fix it

For the last two or three years, I have been increasingly engaged in developing a particular type of mobile App, requiring special technical precautions not needed in most other Apps. These are Apps supporting all participants in a public or private event, such as corporate conventions, wedding ceremonies, alumni meetings, guided tours, and like.

Apps like these have the peculiarity of being made available only a few days before the start of the event and stopping working as soon as the event has ended (or a few days later). The brevity of their “shelf life” has a notable consequence: they can be published on the App Stores only once and, if any defect is found in their content or functions, fixing it by submitting a new version is not an option. …

Believing today is a sure recipe for disaster

Image for post
Image for post
Wonderful photo by Andrew Seaman on Unsplash

It is not my job: I am not a philosopher, nor a psychologist, let alone a theologian. But it is time for an ordinary man like me to have his say. We must stop being children and become adults, we, our country, all humankind.

Let us take our responsibilities and stop behaving as if any supernatural entity is in charge of our destiny and the world’s fate.

Let’s face it: God does not exist or, if God exists, He is not here and perhaps He does not even know of our existence. …

How not to be frustrated by the insufficiencies of the Date object

Image for post
Image for post
Photo by Jess Bailey on Unsplash

One of the least satisfactory aspects of the JavaScript language is the management of the Date object, especially considering that manipulating dates is one of those things where the inexperienced programmer is less comfortable.

Why do I say this? The most fundamental missing pieces, in my opinion, are effective methods for:

  1. Formatting a date
  2. Transforming a string representing a date into a Date object
  3. Performing date arithmetics, e.g. calculating the distance between two dates or adding a hours, days, months, etc., to a given date

In the following sections, I will show how you can remedy these shortcomings in JavaScript with unnecessarily tricky solutions and how, on the contrary, a set of fantastic libraries allow you to achieve the same results straightforwardly. …

6 not-so-easy pieces with JavaScript arrays

Image for post
Image for post
An array of oriented coloured cars (original photo here)

The Array object in JavaScript has a fair number of manipulation methods, which are often overlooked by the average programmer. Everybody prefers to use trivial for loops, rather than venture into experimenting with functions badly understood and a little mysterious.

Indeed, nobody can deny that the most popular manuals do not help much to overcome this obstacle, because they explain these methods with examples so simple as to be of little use for those who face real programming problems.

That is the reason why I decided to offer a bunch of somehow more complex and realistic examples of usage of these functions, in the hope of convincing some goodwill programmer to take that extra step that can lead him to a professional use of arrays in JavaScript. …

The hidden danger of undeclared variables and how to get rid of them

Image for post
Image for post
original image by Becky Lai

If you assign a value to a variable that is not explicitly declared (with var, let, const or as an argument of the current function), JavaScript will implicitly create it as a global variable. In a web application, “global” means that it is property of the window object.

For example, this a typical case of such a “forgotten” declaration:

for (i=0; i<list.length; i++) {
// do something

When the loop starts, a window.i is automatically defined, because the developer forgot to include a let (or var) keyword, like this:

for (let i=0; i<list.length; i++) {

This unwanted global variable survives unnoticed until the web page is unloaded. It is a kind of mistake easily occurring in complex web applications, more often when they are developed without strict standards and out of any well-structured framework. …

Image for post
Image for post

In the era of the web and social networks, it is estimated that up to 30% of online content is made up of copies and duplicates. The reasons why this happens, how it occurs and the effects that follow from it constitute a story in itself.

Web scraping

The first and perhaps most noble art of web copying is the so-called “web scraping”, i.e. collecting information from websites to build your databases for feeding new sites, Apps, mailing list, etc. …


Giorgio D.F.

A degree in Mathematics, software engineer since ever.

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