2021-12-14

White-Box vs. Black-Box Testing


I have something blasphemous to tell you.

Unit Testing is wrong.

There, I said it.

I know I just insulted most people's sacred cow.

Sorry, not sorry.

I will explain, bear with me.

2021-12-04

What is wrong with Full Stack Development

Inntel Hotel at Amsterdam, Zaandam

Table of Contents

  • What is full-stack development
  • Why is full-stack development necessary today
  • What is wrong with full-stack development
  • Conclusion

What is full-stack development


The predominant web application development model today requires splitting application logic in two parts:
  • The front-end, running on the browser.
  • The back-end, running on the server.
The front-end is typically written in JavaScript, while the back-end is typically written in Java, Scala, C#, or some other programming language. The two ends invariably communicate with each other via REST. The choice of JavaScript and REST is not due to any technical merit inherent in these technologies, (there is none,) but purely due to historical accident; see michael.gr - The Wild, Wild Web.

A web application developer can either focus on one part of the stack, or work on both parts. Due to reasons that will be explained further down, more often than not, web developers are asked to work on both parts simultaneously. When this happens, it is known as full-stack development.

For the purposes of this paper, we will call full-stack development not just this mode of work, but also this architectural style as a whole: full-stack development is when application logic must be written both on the server and on the client.

Full-Stack Development is a paradox, since it suggests a way of work which is contrary to what common sense dictates. Common sense calls for specialists each working on their own area of specialization, so one would expect to see different developers focusing on different layers of the stack, and nobody ever attempting something as preposterous as working on all layers simultaneously. However, there is a technological hurdle which renders this necessary today.

Why is full-stack development necessary today


2021-10-27

Windows: how to connect/disconnect wi-fi from command-line


(Useful pre-reading: About these papers)

This assumes that you have previously established a wi-fi connection, so windows has created what it calls a "profile".

In short, the commands are:

netsh wlan connect ssid=<ssid> name=<name>

and

netsh wlan disconnect

To obtain ssid and name, use:

netsh wlan show profile

This should display all existing profile names, and by default, the <name> is the same as the <ssid>.

Things can get more complicated if you have multiple wi-fi adapters, or an ssid that differs from the profile name, but the above should cover the general case.


2021-10-15

The Stateful Microservice

I did a quick search for the term and did not find anything concrete, so I thought I might as well publicly document my thoughts.

Photo of two elephants friendly interacting with each other, from The Scientific American: Fact or Fiction?: Elephants Never Forget

2021-10-14

On Stateless Microservices

This post discusses the stateless microservice design pattern; it is meant as support material for other posts of mine that discuss microservices, mainly michael.gr - The Stateful Microservice.


Dory, the yellow-blue fish (a Royal Blue Tang) that suffered from amnesia in the 2003 movie Finding Nemo by Pixar.

Is statelessness a requirement for a microservice?


In another post of mine I discuss what a microservice really is, and I come to the conclusion that despite various attempts out there to define microservices using twenty-item-long lists of characteristics, a good working definition could be as simple as this: 

A microservice is a scalable and resilient module.

Even if you disagree with the terseness of that definition, and you regard microservices as necessarily more than that, I hope you will at least agree that it is precisely scalability and resilience that the stateless microservice design pattern aims to address, so the definition serves its purpose at least in the context of this series of posts.

There are many who will try to convince you that in order to build a scalable and resilient system, you need statelessness; so much so, that microservices have almost come to be regarded as synonymous with statelessness. This post examines whether this is that in fact so, and what is the cost of doing things this way.

So, what is a Microservice, anyway?

This article attempts to shed some light on what a microservice really is; it is meant as support material for other posts of mine that discuss microservices, mainly michael.gr - The Stateful Microservice.


What is a microservice?

If you go looking for information out there, you will find many different descriptions of what a microservice is; these descriptions exhibit considerable difference of opinion, and to the extent that they agree, it is largely the result of copy-paste. One common theme in these descriptions is that in trying to define this elusive concept, they tend to assign fictitious properties to it. Often, the claims have nothing to do with what a microservice technically is, but rather with impertinent concepts such as the allegedly "independent" software development style around microservices, or some alleged organization of microservices "around business capabilities". Even when the claims do manage to stick within the technical realm, they range from the unwarranted to the preposterous. I have seen statements to the effect that a microservice is supposed to live in its very own source code repository, that a microservice must be independently deployable, that microservices must communicate with each other via REST, etc. (My favorite one is that they must necessarily be stateless; more on that in another post of mine; see  michael.gr - On Stateless Microservices.)

2021-10-04

What is wrong with Scala


This is part of a series of posts in which I am documenting what is wrong with certain popular programming languages that I am (more or less) familiar with.  The aim of these posts is to support a future post in which I will be describing what the ideal programming language would look like for me.  

I will be amending and revising these texts over time.

What is wrong with C#

This is part of a series of posts in which I am documenting what is wrong with certain popular programming languages that I am (more or less) familiar with.  The aim of these posts is to support a future post in which I will be describing what the ideal programming language would look like for me.  

I will be amending and revising these texts over time.

What is wrong with Java


This is part of a series of posts in which I am documenting what is wrong with certain popular programming languages that I am (more or less) familiar with.  The aim of these posts is to support a future post in which I will be describing what the ideal programming language would look like for me.  

I will be amending and revising these texts over time.

What is wrong with C++


This is part of a series of posts in which I am documenting what is wrong with certain popular programming languages that I am (more or less) familiar with.  The aim of these posts is to support a future post in which I will be describing what the ideal programming language would look like for me.  

I will be amending and revising these texts over time.

2021-09-12

[SOLVED] In Windows, how to recover an invisible application window

Scenario:

  • You are using a laptop with one or more external monitors at home and (a different set of external monitors) at the office.

Problem:

  • Every once in a while, when you switch between home and office, some buggy application will not handle its screen positioning correctly, so it will open up off-screen. In the taskbar you can see that the application has launched, but the application window is invisible.

How to fix:

2021-07-27

Malicious Inaction

Actor Wayne Knight in the original Jurassic Park movie
playing the role of the unscrupulous programmer Dennis Nedry,
(anagram of "Nerdy",) the main villain.

Malicious Inaction (noun) any situation where a piece of software encounters an unexpected condition and responds by deliberately doing nothing, including not throwing an exception.  Synonyms: Silent Failure; Deliberate Malfunction; Unscrupulous Programming; Undermining; Sabotage; Treachery; Subversion; Vandalism.

I think that the term "Silent Failure" fails to express the amount of harm done.  Sure, the word "failure" indicates that something went wrong, but the word "silent" somewhat lessens the severity of the term, and it makes sound as if no feathers were ruffled, so it may have been alright.

Well, no. It was not alright. It never is. We need a stronger term to better capture the harm caused by the sinister practice of hiding error. We need a term that clearly conveys wrongdoing, a term that assigns blame and shame.

Hence, I present to the world my new and improved term: Malicious Inaction.


2021-02-12

SVG in WPF

My notes on how to use SVG graphics in a WPF application


The Goal


The goal is to be able do do things like this:

    <Button Content="{StaticResource mySvgImage}">

... where mySvgImage somehow stands for a vector image that has somehow been obtained from an SVG file.  

The solution must not involve any proprietary, closed-source libraries.

Naturally, we want one of the following:

  • either directly include SVG files into our application as resources, or, if that is not possible, then 
  • have an "asset pipeline" approach where our SVG files are automatically converted during build into some format which is suitable for inclusion as a resource.

2021-02-10

Java with Maven: Giving CI/CD a try

Please note that this is work in progress.  I am still working on it and refining it, as my understanding of it improves.

I have a set of public repositories on GitHub showcasing my work, () which is in java with maven. These projects are interdependent, so when you check out one of them, in order to compile and run it you need the binaries of some of the others. You could manually check out all of them and put them in an IDE project, but that's too much work. Solving this problem requires having Continuous Integration & Continuous Deployment (CI/CD) in place, so I decided to try my luck in setting one up using free services only.

The process involves three entities:

  • A Source Repository.  (Where our source code is hosted.)
    • I use GitHub for this.
    • Possible alternatives:
      • GitLab
      • BitBucket
  • A CI/CD provider. (Where the actual CI/CD takes place.)
    • I decided to use CircleCI for this, but in retrospect it was a bad idea, because it does not support GitLab.
    • Possible alternatives:
      • GitLab - I want to use it as a source code repository, and I don't want to put all my eggs in one basket, so I don't want to use it for anything else.
      • GitHub - I want to use it as a source code repository, and I don't want to put all my eggs in one basket, so I don't want to use it for anything else.
      • BitBucket - it is by Atlassian. Need I say more.
      • Appveyor - gives various errors like "There was an error while trying to complete the current operation. Please contact AppVeyor support." -- Lots of open source projects are using it though, so it might be worth a second try.
      • Travis CI - only works with github.
      • JFrog - overwhelmingly fancy front page followed by a not particularly fancy user experience once you get past the front page. Once I have registered, there is no way for me to log back in. 
      • semaphoreci.com - only works with github.
      • buddy.works - after you have given them your e-mail address, they tell you that it is free but they require a valid payment method.
      • atlassian.com/software/bamboo - it is by Atlassian, need I say more.
      • drone.io - not only it works with nothing other than github, they assume that I am using github, which is very annoying.
      • octopus.com - registration fails with "Please use your work email address."
      • buildkite.com - might work; not particularly user friendly.
      • codefresh.io - might work; they unnecessarily complicate things with mandatory docker images.
  • An Artifact Repository. (Where the binaries are stored.)
    • I found a place called Repsy for this; Repsy is minimalistic, unrefined, and they even have bad English on their web site, but it will do for now.
    • Possible alternatives:
      • GitHub Packages
      • GitLab Package Registry
      • JFrog Artifactory

We begin with a situation where we already have the Source Repository (GitHub) and we want to set-up the CI/CD Provider (CircleCI) and the Artifact Repository (Repsy).

2021-01-19

Data modelling

This is a draft paper about a lightweight data modelling framework that I am developing as a home project, for use in other home projects of mine.  It is incomplete; I will be amending it as I find time to write more and as my understanding evolves of what this framework is supposed to do.


Introduction


Every single software project in existence deals in one way or another with data. Some projects have small amounts of data, some have large amounts of data, some even have "big" data. The data almost always exhibit a certain well defined structure, known as the Schema, and the loosely defined term Data Model is used to refer either to the data, or to the schema, or non-specifically to both.

In virtually all cases, the data model is highly application-specific, but many characteristics and operations are common or even ubiquitous across data models.

2021-01-16

The MVVM architectural design pattern

Here is a brief technical explanation of MVVM, which contains enough detail (borrowed from its WPF implementation) and examples to allow the reader to grasp how it actually works.

2021-01-03

Object Lifetime Awareness

The Thinker (French: Le Penseur) by Auguste Rodin (From Wikipedia)


Abstract


Garbage collectors have given us a false sense of security with respect to what happens to an object once we stop thinking about it. The assumption is that it will be magically taken care of, but this does not always go as hoped, resulting in memory leaks and bugs due to failure to perform necessary cleanup. Tools for troubleshooting such problems are scarce, and not particularly helpful, so finding and fixing such problems is notoriously difficult. 

A methodology is presented, which differs from current widespread practices, for maintaining awareness of, and exercising full deterministic control over, the lifetime of certain objects in a garbage-collected environment. We issue hard errors in the event of misuse, and accurate diagnostic messages in the event of omissions, thus improving the robustness of software and lessening the troubleshooting burden.