Encodo presented a short talk at Voxxed Days 2017 this year, called The truth about code reviews. Sebastian and I also attended the rest of the conference. The following is a list of notes and reactions to the talks.
Engineering You
Martin Thompson — Video
The keynote was about our place in the history of software engineering. Martin described us more as alchemists than engineers right now, a sentiment with which I can only agree. There is too little precision, too little reproducibility and too little focus on safety for use to qualify as engineers.
He gave as an example the pride with which car companies brag about the hundreds of millions of lines of code they have running in software in their cars: a claim that should send shivers down your spine. We know how this software is written and how it is tested.
Quino has fewer than 100,000 lines of code (about 85,000, at least 15% of which is obsolete) and we’ve been building that for almost 10 years. How a company whose main business is building automobiles guarantees safety and correctness of 300 million lines of code is beyond my comprehension. I would venture that they don’t.
Highly recommended talk. Very interesting. Lots of good history mixed with common-sense recommendations, like the following:
References:
He discussed a proof-of-concept transport-tracking application. Uses the SBB REST API for vehicle positions (using the same API as exposed for the app). Then there is the OpenData Transport API for station-board information, which provides details about delays. Everything is available as JSON with relatively straightforward data models.
Uses Kafka to handle this real-time data pipeline (kind of like Chronicle, RabbitMQ or EasyMQ, but from Apache). The pipeline includes reformatting the data into the desired format (mostly eliding unwanted data), then store them in LogStash and then to ElasticSearch, which allows easy querying of the stored data. This type of data isn’t fundamentally relational, so a document-based store is appropriate.
The transformation also involves extrapolating the data that you’re interested in from the data you obtained. For example, determining whether a train is stopped. E.g. are there x events with the same position? Is the position near a station?
It was developed in Scala with Akka actors as well as the Play framework for REST. They represented all stations and trains with actors (objects). The actors are async and can run on any number of machines.
After that comes Cassandra? Are they trying to use every possible technology? I’m losing track over here. Deployment on Docker. Also uses Zookeeper in another container for load-balancing/redundancy. OMG buzzwords.
He asks: Why not a single application on a single server? Classic Java on Tomcat? It doesn’t scale. It can only scale up, but not out. The actual solution feels like a lot of moving parts, but each part does a compartmentalized task, handing off to the next piece. It ends up being quite lightweight, using very little CPU overall.
The simple, one-use components scale natively and relatively easily (LogStash, streaming, docker). The app server using Akka can be scaled, but it’s here that you have to invest time to use the available fallback and clustering strategies.
To render the data on the map, they used React to manage the data and d3.js to render. React is fast and scalable (but as Encodo has also discovered, that’s not free either). Also, the client-side CPU usage is not insignificant, even with a lot of nodes.
He also discussed UX and UI with tests. How to visualize possibly overlapping and differently sized elements at different zoom levels.
Used Jupiter to analyze data and produce graphs.
Conclusion: offload the parts of your application that aren’t your core problem to external software and services. Things like managing data streams, transforming data, etc. Focus on your models and analyzing your data.
Functional data structures in Java
Oleg Šelajev — Video
He discussed how to build reusable structures that don’t share mutable state (non-imperative vs. functional).
Void
is a “code smell” because the only reason to call it is to cause a side effect. Prefer pure methods.Any discussion of data-structure design/implementation will naturally involve balancing performance vs. storage. The safety is baked-in, but performance is always a concern when working with immutable data structures, most especially when changing them.
Even though the average call time for a method is nearly constant (as with most mutable structures), what if you call too many expensive operations and skew the average in real-world use? Well, you can combat this by leveraging the cachability of your collections (as defined above) as a way of memoizing (a well-known performance-optimization technique which carries with it possibly higher storage costs if you can’t share the memoized instances very much.)
In some cases, you can reason about performance in the following way: if you get to a situation where you would have to do an expensive operation (e.g. the reverse implicit in balancing head/tail of a queue), you can only get to this situation by having done n cheap operations first. So it is proven that the average is still constant time.
Destructive behavior (like deque
) looks different than mutable data structure. In those cases, the operation returns both the removed element as well as a reference to the queue that represents the new state of the queue.
Tuple<T, Queue<T>> Dequeue();
For maps, you need a concept called Zip
that lets you quickly build a representation of the structure where the element viewed at a particular point in an existing structure is different. So even when a desired mutation would require alteration of a lot of the underlying structure, this operation allows reuse of a lot more of the structure than would otherwise be possible. The node can point to different parent and child nodes, referencing the new part of the structure while embedded in as much of the prior version as possible.
“Object-oriented programming makes it easier to reason about moving parts. FUnctional programming makes it easier to minimize moving parts.”
References:
Does diversity really matter?
Sombra González and Brigitte Hulliger — Video
This talk began by posing the following questions to the audience.
Good questions. Good topic. Mostly well-presented, although the middle dragged a bit: Sombra envisioned a (near-)future where women are the same as men in a tech world, a meritocracy. It didn’t add very much.
As with everywhere else, the software industry has to figure out how to deal with long maternity leaves. Some countries have introduced “rainbow” leaves, which allow sharing of the time between partners, so if the partner is male, the industry has to deal with male absence as well. That will probably help increase acceptance of female leave, as it removes the distinction.
For small companies, these kinds of extended leaves are a big hurdle because we can’t so easily absorb so much missing capacity.
We haven’t improved at all in the last quarter-century: there have been proportionally fewer women in technical software positions every year since 1991. The quit rate is much higher (41%) than for men (17%). This is not primarily due to family concerns, though. It’s mostly due to women not feeling comfortable in an industry where they’re often the only female in a meeting, on a team or in a company.
Reference:
The truth about code reviews
Sebastian Greulach — Video
This talk is a reduced version of the code-review talk that Sebastian has been doing for Encodo Systems in both English and German over the last year.
The presentation includes some statistics about the value of code reviews, a discussion of which benefits you can expect to get, which types of reviewers are likely to yield which benefits as well as Encodo’s approach and advice for integrating code reviews into your development process.
This was the most informative and amazing presentation at the entire show. All kidding aside, the room was packed and the ratings were quite good. There seemed to be a lot of interest in process.
Reference:
This guy was supremely entertaining. He is the undisputed master of the animated and reaction GIF in presentations. Informative, spirited and very funny.
var
) and the tuple elements are unnamed (p1
, p2
, etc.) C# 6 is still like this, but C# 7 introduced named items for anonymous tuples.UPDATE
statement in his projects, where he can) and then you basically have an immutable data structure in a separate process with a really powerful and efficient query languages over the graph.[3]References:
A practical introduction to Category Theory
Daniela Sfregola — Video
Category theory is about Monads, examples of which are Option
, Try
and Future
(promise).
The example she uses shows how to apply category-theory constructs to data-validation. The examples are in Scala, although the API that she presents looks very similar to the terminology used in Java’s Streams API. E.g. flatMap()
. That’s Select()
for C# developers. Similarly, Options
is Nullable
, although I can’t think of the type analog for Some
or None
.
Her validation example is well-made, going from returning an Option
which is no better than a Boolean
. Then she shows an Either
but that doesn’t allow for having both sides wrong. This can be done with Either
but it’s painful. That’s why we invented pattern-matching (now available in C# 7).
When she introduced a Validated
, which is capable of returning a list of errors. “Focus on how things compose.”
The talk was quite short and didn’t introduce much new. The pattern-matching syntax in Scala is a bit wordy.
g º f patterns
Mario Fusco — Video
Since my previous talk was done early, I joined Sebastian in this one. I saw only the tail-end of it, but man are the streams() libraries still really wordy. Welcome to functional programming, Java! Still, I’m disappointed that I can’t use streams()
in the Android project I’m working on because it required Java 8, which forces API level 24, which excludes a lot of devices.
Sebastian said the talk was pretty good.
What about CSS? Progressive Enhancement and CSS
Ire Aderinokun — Video
Rules:
WTF is the squirrel browser? (It turns out it’s UC Browser, popular in China.) Or the one with the strange globe? (Maybe Flock? Not sure.) Does Opera really have higher market-share than IE? Probably globally, right? Phone browser in India/China/etc.
She showed a really cool graph of how many hours you have to work to use 500MB of data. Germany: 1h, Brazil: 56h, US: 6h. Bandwidth matters. A lot. WWW != Wealthy Western Web ammirite?
<main>
or <header>
.More rules:
vertical-align
is ignored when flexing is enabled.)What about the future of the web? VR? Old devices handed down from the 1st to the 3rd world.
I asked about testing that the progressive enhancements work as programmed, but no-one has any new ideas for testing, though. Manual testing to verify that the enhancements and fallbacks work.
References:
I just hacked your app!
Marcos Placona — Video
He started off the talk as a bandit, reverse-engineering a Base64-encoded name/password. He used Charles to get MITM. It was a nice trick, and it probably works on a lot of devices and apps.
It’s very easy to make a hackable application if you don’t think about security. He uses a nice word-definition slide with pronunciation and usage to make it look all official.
CertificatePinner()