Develop

Asymmetric IFs help you keep DRY

Symmetric IF The following is an example of what I started calling Symmetric IF because all the branches of the IF have equal dignity and weight. public Observable<File> getSelectedFile() { if (selectedFile != null) { return selectedFileSubject.asObservable().startWith(selectedFile); } else { return selectedFileSubject.asObservable(); } } This code is written to leverage the capabilities of ReactiveX/RxJava, a library that… Continue reading Asymmetric IFs help you keep DRY

Advertisement
Develop

The Babel of Polyglot programming

Polyglot cooking An honorable mention goes to the first person who can translate the following: Rebus: I sextarius lac, et recens totum organicum Totum in velit vel empta lyophilized lactic fermenta yoghurt Procedimento Mettete il latte a riscaldare. La temperatura del latte dovrà raggiungere i 40 ° ma non superarli. Oltre la soglia dei 50 °C… Continue reading The Babel of Polyglot programming

Develop

An API is first and foremost a contract but how it’s honored is what matters the most

An API is first and foremost a contract Like a contract between humans defines the rules both sides have to follow to make a certain interaction work, so an API defines how an application can interact with another one. Not all contracts between humans have characteristics very similar to a typical API but certain analogies… Continue reading An API is first and foremost a contract but how it’s honored is what matters the most

Develop

One-liner methods can easily become an antipattern

Unless you are a very old-style procedural programmer, chances are you’ve grown up in an environment that promoted keeping the body of methods as short as possible. Nowadays more and more advocate that the Nirvana is to have methods of 1 line of code. The rationale behind is the false assumption that shorter methods are… Continue reading One-liner methods can easily become an antipattern