Developer Blogs

Since these are blogs, there are no guarantees as to the accuracy or readability of the information contained therein. The entries are also a mix of German and English (Don't worry...one language per entry!)

Subscribe to the newsfeed in RSS or Atom format.

A tuple-inference bug in the Swift 3.0.1 compiler

Published by Marco on in Development

I encountered some curious behavior while writing a service-locator interface (_protocol_) in Swift. I’ve reproduced the issue in a stripped-down playground[1] and am almost certain I’ve found a bug in the Swift 3.0.1 compiler included in XCode 8.2.1.

A Simple, Generic Function

We’ll start off with a very basic example, shown below.

 Simple argument with label

The example above shows a very simple function, generic in its single parameter with a required argument label a:. As expected, the compiler determines the generic type T to be Int.

I’m not a big fan of argument labels for such simple functions, so I like to use the _ to free the caller from writing the label, as shown below.

 Simple argument without label

As you can see, the result of calling the function is unchanged.

Or Maybe Not So Simple?

Let’s try calling the function with some other combinations of parameters and see what happens.

 Label-less argument with tuples and multiple parameters

If you’re coming from another programming language, it might be quite surprising that the Swift compiler happily compiles every single one... [More]

Two more presentations: Web tools & Quino upgrade

Published by Marco on in Development

Check out two new talks on our web site:

Networking Event: How Encodo builds web applications
At our last networking event, Urs presented our latest tech stack. We’ve been working productively with this stack for most of this year and feel we’ve finally stabilized on something we can use for a while. Urs discusses the technologies and libraries (TypeScript, Less, React, MobX) as well as tools (Visual Studio Code, WebStorm).
Quino: from 1.13 to 4.x
Since Quino 1.13 came out in December of 2014, we’ve come a long way. This presentation shows just how far we’ve come and provides customers with information about the many, many improvements as well as a migration path.

Quino Documentation: Table of Contents

Published by Marco on in Quino

Thoughts on .NET Standard 2.0

Published by Marco on in Development

Check out two new talks on our web site:

Microsoft recently published a long blog article Introducing .NET Standard. The author Immo Landwerth appeared on a weekly videocast called The week in .NET to discuss and elaborate. I distilled all of this information into a presentation for Encodo’s programmers and published it to our web site, TechTalk: .NET Standard 2.0. I hope it helps!

Also, Sebastian has taken a Tech Talk that he did for a networking event earlier this year, Code Review Best Practices, on the road to Germany, as Die Wahrheit über Code Reviews So klappt’s!

v3.1: New metadata builder API

Published by Marco on in Quino

The summary below describes major new features, items of note and breaking changes. The full list of issues is also available for those with access to the Encodo issue tracker.

Highlights

This release is a “bridge” release that has the entire new Metadata API as well as the older version, which is marked as obsolete. It is intended that projects upgrade to this version only temporarily in order to more easily migrate to the 4.0 Metadata API. At that point, projects should immediately upgrade to Quino 4.0, from which all obsolete methods have been removed. Once 4.0 is available, there will be no more bug-fix releases for this release.

Metadata construction

  • Remove MetaId/Guid parameters from all metadata-building APIs
  • Remove all dependencies and requirement for the MetaBuilder; make MetaBuilder obsolete.
  • Drastically reduce the surface of the MetadataBuilder and base classes and improve dependency-resolution
  • Replaced AddClassWithDefaultPrimaryKey(“A”) with AddClass(“A”).AddId()... [More]

Why you shouldn’t use Bootstrap when you have a styleguide

Published by urs on in Web: HTML/CSS/JS

From a customer, we got the request to apply a visual style guide (VSG) to a Bootstrap-based application. Since we do have a lot of experience with applying style guides on web applications and styling in general, we accepted the job and started to evaluate the details.

Which version of Bootstrap to use

The most recent stable version of Bootstrap is 3.3.6. However, when you go to the Bootstrap website, there is an announcement that Bootstrap 4 “is coming”. The current state of Bootstrap 4 is alpha and the last blog post is from December 2015 which is almost half a year ago. It also is not clear, when version 4 finally will be available and stable and so we had to use the old Bootstrap 3 for this project.

But even here, there is some obscurity going on: Bootstrap was initially developed with LESS but for some reason they decided to switch to SASS. Even if we prefer to use LESS at Encodo, we decided to use SASS for this project to be able to upgrade to Bootstrap 4 more easily when... [More]

Tabs vs. Spaces … and how many?

Published by Marco on in Development

Encodo has long been a two-space indent shop. Section 4.1 of the Encodo C# Handbook writes that “[a]n indent is two spaces; it is never a tab.”, even though “[t]he official C# standard […] is four spaces.” and that, should you have a problem with that, you should “deal with it.”

Although we use our own standards by default, we use a customer’s standards if they’ve defined their own. A large part of our coding is now done with four spaces. Some of us have gotten so accustomed to this that four spaces started looking better than two. That, combined with recent publicity for the topic[1], led me to ask the developers at Encodo what they thought.

  • Urs was open to the idea of using tabs because then “everyone can use whatever he likes and we can avoid the unnecessary discussion about the ideal value (why does it have to be an even value? I want 3 spaces!!!) Further, we might be able to save some disk space ;)”
  • Sebastian was emphatically not open to the idea of tabs because “Tabs is just a lie.... [More]”

ABD: Improving the Aspect-modeling API for Quino

Published by Marco on in Development

Overview

We discussed ABD in a recent article ABD: Refactoring and refining an API. To cite from that article,

“[…] the most important part of code is to think about how you’re writing it and what you’re building. You shouldn’t write a single line without thinking of the myriad ways in which it must fit into existing code and the established patterns and practices.”

With that in mind, I saw another teaching opportunity this week and wrote up my experience designing an improvement to an existing API.

Requirements

Before we write any code, we should know what we’re doing.[1]

  • We use aspects (IMetaAspects) in Quino to add domain-specific metadata (e.g. the IVisibleAspect controls element visibility)
  • Suppose we have such an aspect with properties A1…AN. When we set property A1 to a new value, we want to retain the values of properties A2…AN (i.e. we don’t want to discard previously set values)
  • The current pattern is to call FindOrAddAspect(). This method does what it advertises: If... [More]

ABD: Refactoring and refining an API

Published by Marco on in Development

We’ve been doing more internal training lately and one topic that we’ve started to tackle is design for architecture/APIs. Even if you’re not officially a software architect—designing and building entire systems from scratch—every developer designs code, on some level.

[A]lways
[B]e
[D]esigning

There are broad guidelines about how to format and style code, about how many lines to put in a method, about how many parameters to use, and so on. We strive for Clean Code™.

But the most important part of code is to think about how you’re writing it and what you’re building. You shouldn’t write a single line without thinking of the myriad ways in which it must fit into existing code and the established patterns and practices.

We’ve written about this before, in the two-part series called “Questions to consider when designing APIs” (Part I and Part II). Those two articles comprise a long list of aspects of a design to consider.

First make a good design, then compromise to fit project... [More]

Beware the Hype: .NET Core

Published by Marco on in .NET/C#

The article .NET Core, a call to action by Mark Rendle exhorts everyone to “go go go”.

I say, “pump the brakes.”

RC => Beta => Alpha

Mark says, “The next wave of work must be undertaken by the wider .NET community, both inside and outside Microsoft.”

No. The next wave of work must be undertaken by the team building the product. This product is not even Beta yet. They have called the last two releases RC, but they aren’t: the API is still changing quite dramatically. For example, the article Announcing .NET Core RC2 and .NET Core SDK Preview 1[1] lists all sorts of changes and the diff of APIs between RC1 and RC2 (GitHub) is gigantic—the original article states that “[w]e added over a 1000 new APIs in .NET Core RC2”.

What?!?!

That is a huge API-surface change between release candidates. That’s why I think these designations are largely incorrect. Maybe they just mean, “hey, if y’all can actually work with this puny footprint, then we’ll call it a final release. If not, we’ll just add a bunch more stuff until... [More]