why they are important and why you should pay close attention to interface definition
Gergő Pintér, PhD
gergo.pinter@uni-corvinus.hu
an interface is a shared boundary across which two or more separate components of a computer system [1]
Ethernet 1000BASE-T | DisplayPort 1.2 | USB 2.0
NASA and Lockheed Martin mixed up units for the Mars Climate Orbiter (1999)
based on [3], read the full story written by Tim Dodd
the most important elements of the design are the interfaces, hexagonal arcitecture focuses on them
data sent to the UI
A mock, in software engineering, is a simulated object or module that acts as a stand-in for a real object or module [4].
require 'sinatra'
def generate_progress
rand.round(2)
end
def generate_activity_matrix
result = []
(1..4).each do |_w|
daily = []
(1..7).each do |_d|
daily.push rand(10)
end
result.push daily
end
result
end
get '/user/:id/statistics' do
data = {}
data['name'] = 'Marvin'
data['id'] = params['id']
data['registration'] = '2019-10-02'
data['progress'] = generate_progress
data['activity'] = generate_activity_matrix
return data.to_json
enda mock backend should be enough for a frontend developer to create and test the user statistics view of the user interface
{
"name": "Marvin",
"id": 42,
"registration": "2019-10-02",
"progress": 0.92,
"activity": [
[4,9,7,4,7,1,8],
[9,8,1,8,4,1,7],
[3,6,8,4,2,4,5],
[3,5,5,3,2,9,7]
]
}it may be presented to the customer
fast feedback, agile, and so on…
this will break the frontend
it is not just rude, but will waste the time of the other team (with pointless debugging)
the number one rule of kernel development is that “we don’t break users”
https://developers.facebook.com/v21.0/me?fields=id,name
GeoPandas 1.0 / new deprecations: unary_union attribute is now deprecated and replaced by the union_all() method (#3007) allowing opting for a faster union algorithm for coverages (#3151)
DeprecationWarning: The ‘unary_union’ attribute is deprecated, use the ‘union_all()’ method instead.
def unary_union(self):
warnings.warn(
"The 'unary_union' attribute is deprecated, "
"use the 'union_all' method instead.",
DeprecationWarning,
stacklevel=2,
)
return self.union_all()source: github.com/geopandas/geopandas
public class Worker {
/**
* Calculate period between versions
* @deprecated
* This method is no longer acceptable to compute time between versions.
* <p> Use {@link Utils#calculatePeriod(Machine)} instead.
*
* @param machine instance
* @return computed time
*/
@Deprecated(since = "4.5", forRemoval = true)
public int calculate(Machine machine) {
return machine.exportVersions().size() * 10;
}
}source: [5]
IDEs can parse the deprecation decorators and show to the developer during work
With a sufficient number of users of an API,
it does not matter what you promise in the contract:
all observable behaviors of your system
will be depended on by somebody.– Hyrum Wright, 2012
/user/<id>/statistics
think like a villian, someone who’s going to abuse the system that you’re designing and building
Be conservative in what you do, be liberal in what you accept from others.
– Jon Postel, in the specification of TCP in 1980 (RFC 761) source: Postel’s Law
When receiving data, handle variations, minor errors, or deviations where possible. Don’t crash or reject communication over minor issues.
When your system emits data or interacts with the outside world, adhere closely to protocols and standards.
In modern times, overly liberal acceptance can sometimes mask errors, so this law is occasionally tempered with security considerations.