Code syntax has become increasingly complex and expressive in recent years. There used to be a time when procedural languages like Java, C, C++, C# were purely procedural and functional languages like Lisp, Erlang were purely (mostly) declarative. Since these are very different mechanisms of programming, when writing code in a specific language a programmer tends to think either declaratively or imperatively.
So consider this simple example problem: An object needs to be created with a list of entries that contain properties describing a specific year and week. Let's say that property is: Hours. So each year / week combination has one property defined called Hours. This object gets instantiated and passed the list of resolved items. It also has a bunch of properties to allow iteration over the years and weeks to build up a grid of Hours and totals. A very naive implementation might look something like this in C#:
class SomeHolder {
private Dictionary<int, Dictionary<int, List<int>>> entities;
public List<int> Years {
List<int> years = new List<int>();
get {
for (int year in entities.Keys)
years.Add(year);
return years;
}
}
public Dictionary<int, List<int>> Weeks {
get {
Dictionary<int, List<int>> weeks = new Dictionary<int, List<int>>();
for (int year in Years) {
if (!weeks.ContainsKey(year))
weeks[year] = new List<int>();
for (int week in entities[year].Keys)
weeks[year].Add(week);
}
return weeks;
}
}
public Dictionary<int, Dictionary<int, int>> WeekTotals {
get {
Dictionary<int, Dictionary<int, int>> totals = new Dictionary<int, Dictionary<int, int>>();
for (int year in Years) {
if (!totals.ContainsKey(year))
totals[year] = new Dictionary<int, int>();
for (int week in Weeks) {
if (!totals[year].ContainsKey(week))
totals[year][week] = 0;
for (int hour in entities[year][week].Values)
totals[year][week] += hour;
}
}
return totals;
}
}
public SomeHolder(Dictionary<int, Dictionary<int, List<int>>> entities) {
this.entities = entities;
}
}
These algae are of course not called Mandarin algae - I call them that since when viewed under UV light, their chloroplasts autofluoresce in red, mimicking Kanji.
I need to start off by mentioning that even as a realist with a strong scientific background, marketing can be a powerful force not to be underestimated - especially concerning aspects that are unfamiliar to oneself.
Water. H2O. Why do they teach people in primary school that water's chemical formula is H2O? Only perfectly pure water in a vacuum might approach that composition. Normal water is so much more complicated that trying to understand it is like trying to understand how individual electrons move in a macroscopic object like a person.
Enough rambling. I recently relocated to a small town in Alberta, Canada. The water used to be very soft on the west coast where I came from (TDS = 19ppm). So water treatment was really not needed in any home I have lived in. The water was soft enough to not cause issues with soap, washing machines, refrigerators or boilers, and hard enough not to be corrosive. However it is a different story here on the other side of the Rockies. I measured my TDS with an electronic meter and the result was 260ppm. That is considered very hard water (depending on who you ask). It is enough that I could see buildup of limescale on some of my equipment such as the HVAC unit. The previous owner had a Premier AF-40K water softener installed, however it had no salt in it.
I have been falling victim to a classic mistake - trying to compare something to some kind of perceived "average" or "normal" based on a sample of a group. It is easy to see a couple of instances of some behaviour and then assume it should apply to your sample as well, and if it does not, feel somehow disappointed.
See, the thing is Toruk cannot play fetch. He will sometimes chase after something thrown, but he will never bring it back. Other cats play fetch, even fish and whales play fetch: