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

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