August 6, 2019

Characteristics of a Good Design?

  —What characteristics make up a good design?

In What is Good Design (Part 1), I was trying to characterize a good design. My thinking has changed since I wrote that article. I’m trying to view design and architecture as the same thing, but acknowledge that architecture is design that focuses on things that are expensive to change.

Design in this context can be viewed as anything that isn’t architecture (can be changed easily–easier).

It’s a position that has been influenced by a variety of factors. A good starting place is Ruth Malan’s Visual Architecting Keynote. I explore Ruth’s keynote in Documenting Architecture Decisions and Big Ball of Mud.

A key insight in Ruth’s keynote.

We’re holding these two ideas about architecture in creative suspension – architecture is decisions about “the important stuff” where important is distinguished by cost of change, and architecture is about the structure of the system, which has something to do with (lowering) the cost of change.

I like the notion of creative suspension. It provides insight on the difference between architecture and design.

A good architecture seeks to minimize cost of change by managing things that are hard to change. A good design follows the same thought trajectory if that design is dealing with important stuff (e.g., relationships between concepts). A good design follows a different thought trajectory if that design is dealing with encapsulated stuff (e.g., the implementation of a concept).

In What is Design (Part 1), I was searching for a way to frame a direction for my team on what constitutes good design. Recall, in the context of that question I said

This important to help align the team around the objective of improving our designs–how do we know good design when we see it?

At the time, I was seeking a concept that could be articulated as a goal and guidance on knowing if we where headed in the right direction.

Does Ruth’s keynote improve my chance of success here? I think it does. Controlling cost is an architecture issue. Design that isn’t expensive to change is not architecture.

How does Ruth’s keynote improve my chance of success? I still don’t have a notion of good design other than it solves a problem whose constraints and use help define it. I have a good notion of the difference between architecture and design but that pushed the vagueness of these notions into cost. I did solve one problem: architecture and design are the same thing. Just different in terms of diffculty to change (hence cost).

July 14, 2019

Google's International Targeting

  —International targeting for unilingual/multi-regional sites.

This blog is only written in Canadian english (en-ca). This is close enough to english (en) that I’d like it to turn up for anyone looking at english search results. Seems reasonable.

Google’s Search Console flags my site saying

Your site has no hreflang tags.

My country is unlisted because I don’t feel like my topics should be targeted at only Canadian users. Vain perhaps, but reasonable given the english-only content.

My site’s URL is bminard.github.io.

How to add hreflang support to my site to eliminate the problem identified in the Google Search Console.?

From Multi-regional and multilingual sites:

A multi-regional website is one that explicitly targets users in different countries.

My site seems to fit the definition of multi-regional, as I am targeting english speaking users in different countries.

From Use hreflang for language and regional URLs:

Using language annotations

Imagine you have an English language page hosted at http://www.example.com/ … …

  • Sitemap. Instead of using markup, you can submit language version information in a Sitemap.

Expanding your site to more languages provided information that cleared up my confusion. The use of hreflang for unilingual and multi-regional sites started at the 0:6:34 mark: use a sitemap even if your site uses only one language.

An example using Jekyll to generate a sitemap containing hreflang. If you need a simpler example, checkout Use a sitemap to indicate alternate language pages.

I modified this example as follows.

July 8, 2019

A Look at Iterator Traits

  —The Iterator Category Trait.

I took the opportunity to develop a patch Boost::Utility to address bug 13002. I concluded:

The compiler error in the reproducer occurs because std::set does not provide a random access iterator.

Absolutely correct. And terribly short-sighted.

I didn’t think this was a bug because C++ doesn’t require support for the expression r += n, unless the object supports a random access iterator. This lack of support for this expression causes the compilation error reported in stl_iterator.h.

std::set doesn’t provide a random access iterator. It provides a bidirectional iterator. Same for std::list. std::vector provides a random access iterator.

Even the tests supported my thinking. But the tests were insufficient and I wasn’t aware of bug 10847.

I wish I could say I authored this patch. I didn’t. Here is the most relevant parts (full commit).

template< typename T >
struct is_iterator
{
private:
    typedef char yes_type;
    typedef char (&no_type)[2];

    template< typename U >
    static yes_type check_iterator_category(typename U::iterator_category*);
    template< typename U >
    static no_type check_iterator_category(...);

public:
    static BOOST_CONSTEXPR_OR_CONST bool value = sizeof(is_iterator< T >::BOOST_NESTED_TEMPLATE check_iterator_category< T >(0)) == sizeof(yes_type);
};

Important components:

template< typename T, typename Distance, bool IsIterator = is_iterator< T >::value >
struct next_advance_impl :
    public next_plus_assign_impl< T, Distance >
{
};
template< typename T, typename Distance, bool IsIterator = is_iterator< T >::value >
struct prior_advance_impl :
    public prior_minus_assign_impl< T, Distance >
{
};

Very cool.

I was wrong about the direction to take this patch because I didn’t look through the bug database to see if there were other open tickets against boost::next() and boost::prior().

On the bright side because someone authored bug 13002 I was able to participate in the improvement of Boost!

June 15, 2019

Bad Behaviour Online

  —We’ve failed to realize the Internet’s promise of cooperation and communication.

In Giving Up More Than You Realize with Twitter (Part 2), I discuss how ill-considered Tweets were career ending for the people involved. Regardless of how you feel about the rightness or wrongness of their Tweets it’s astonishing how much abuse those people recieved.

In What causes good people to turn bad online?, Gala Vince writes:

There is overwhelming evidence that women and members of ethnic minority groups are disproportionately the target of Twitter abuse.

Nothing new here.

While we generally conduct our real-life interactions with strangers politely and respectfully, online we can be horrible. How can we relearn the collaborative techniques that enabled us to find common ground and thrive as a species?

Good question.

Gala’s thesis is that we’ve failed to realize the Internet’s promise of cooperation and communication. We’ve failed to realize this promise because being online reduces our need to cooperate.

She goes on to say social media has weak institutions (or rules) and that there are few reputational or punitive risks for bad behaviour. Essentially, people don’t have a set of rules to govern their behaviour and the consequences of doing so are virtually non-existent.

There is also evidence that moral and emotional words are more likely to spread on social media. Content that triggers outrage is likely to trigger more outrage and be shared.

The article goes on to say that social media platforms might benefit from providing people with control over who they connect too. The idea appears to be that you start with an open network and then disconnect from people you don’t like. Not sure how that’s going to work out given that it’s counter-intuitive to the notion of the promise of cooperation and communication.

A better idea discussed in the article is to add some sort of reputational cost in the form of a social punishment. This seems closer to real life, but doesn’t address the problem that an algoritm needs to be designed to do this.

I like the promise and the notion that cooperation and reputation are missing. Hopefully, we don’t us a broken notion of reputation like the Black Mirror Nosedive episode (Series 3, Episode 1).

June 9, 2019

GDB Steps Over Functions

  —A brain-fart using gdb, but a common one.

I recently had occasion to debug some code in Boost.Regex. Boost.Regex is a really well written Boost library that was a pleasure to read.

I got burned initially when debugging Boost.Regex because I had forgotten that it includes a library, so when I tried to use GDB to step into a library function it stepped over it. The solutin, of course was to recompile the library to support debugging.

The surprising thing about this is that I initially tried solving this issue by Googling for “stepping over template” and got a surprising number of hits related to optimization flags. I wonder how many of those problems were because the template had been compiled into a library…