Friday, December 31, 2021

Replace nested-if's with proper exception-handling

" Why handle exceptions separately:
■ Handling exceptions separately enables you to define the main logic of your
code together.
■ Without the use of separate exception handlers, the main logic of your code
would be lost in combating the exceptional conditions. (See figure 7.5 for an
example.)
■ Exception handlers separate the concerns of defining regular program logic
from exception-handling code."

OCA Java SE 8 Programmer I Certification Guide  by Mala Gupta


Wednesday, May 15, 2019

Force Proper Error Handling - via Checked Exceptions?

Forcing the calling code to handle the error right away is the correct approach, because it forces the programmer to think about the possibility of an error occurring. That's a key point. The fact that this clutters the code with error checking is unfortunate, but it is a small price to pay for correctness of operation.
http://www.lighterra.com/papers/exceptionsharmful/

Friday, May 10, 2019

Providing Rest Clients Nearly as Bad as Publishing SOAP Contracts

Even still, many developers and architects have continued to emotionally cling to the SOAP bad old days, wherein the contracts between a server and a client are to be well-defined and strictly-enforced. Semantically-versioned contracts is a common pattern, where the contracts themselves are held in a separate package, and compiled for consumption by consumers. Another is the published “ServiceClient” which exposes all methods and contracts for the consuming clientA to call serviceB. Both are architecturally troubling, because once more these contracts or clients are nothing more than another form of tight-coupling.
Once again, nobody moves unless everybody does, just not in as rigid a format as SOAP provided.
from: https://medium.com/it-dead-inside/isolating-your-microservices-through-loose-coupling-48b710e28de6

Overly Coupled Microservices

The rule of thumb goes that if a change to one microservice requires the redeployment of x number of other microservices in order for all of them to be successful, then the higher x is, the worse your architecture is.
https://medium.com/it-dead-inside/domain-driven-design-in-the-era-of-icroservices-de2be01821ed

Thursday, May 2, 2019

Waterfall better than Agile without Business Support

For agile to be effective, stakeholders and product owners have to change their behaviors and provide a conducive environment for the delivery team. Else, they should just stick with traditional waterfall because doing agile without reaping the benefit is sheer stupidity.
https://blog.gds-gov.tech/the-biggest-myth-of-agile-development-faster-cheaper-and-better-outcome-27c20a95978c

Wednesday, April 24, 2019

Everything is either a Service, Entity, or Value

First, remember that everything in your system is either a Service, Entity or Value. I didn’t make those names up: I learned them from Eric Evans in Domain-Driven Design.
https://blog.thecodewhisperer.com/permalink/when-is-it-safe-to-introduce-test-doubles

Tuesday, April 23, 2019

Fourth generation languages

Another is that trying to make a language syntax English-like often demands that the ``English'' it speaks be bent seriously out of shape, so much so that the superficial resemblance to natural language is as confusing as a traditional syntax would have been. (You see this bad effect in a lot of so-called ``fourth generation'' and commercial database-query languages.)
http://www.catb.org/~esr/writings/cathedral-bazaar/cathedral-bazaar/ar01s09.html

Sunday, April 21, 2019

Hardest thing in Software Engineering

The hardest part of the software task is arriving at a complete and consistent specification, and much of the essence of building a program is in fact the debugging of the specification.
Brooks -- No Silver Bullet

Thursday, March 7, 2019

OCP

In other words, the OCP says that you can always add new code to an object, but should never change the design of old code.
https://medium.com/@severinperez/maintainable-code-and-the-open-closed-principle-b088c737262

Monday, January 28, 2019

Microservices

A species would be a combination of roles [DCI?], instead of being characterized as an animal, which would not necessarily be the best description. At a larger scale, microservices are a very similar case [of composition instead of inheritance / ISP], they are pieces of a system separated by responsibilities, instead of being a great monolith.
https://hackernoon.com/solid-principles-made-easy-67b1246bcdf

Procedural vs OO

In any complex system there are going to be times when we want to add new data types rather than new functions. For these cases objects and OO are most appropriate. On the other hand, there will also be times when we’ll want to add new functions as opposed to data types. In that case procedural code and data structures will be more appropriate.
https://medium.com/mindorks/how-to-write-clean-code-lessons-learnt-from-the-clean-code-robert-c-martin-9ffc7aef870c

Saturday, May 26, 2018

On the necessity of having multiple models in your code base

You cannot under any circumstances have a single model that does everything for you and does it well. It doesn't exist!
-Greg Young https://www.youtube.com/watch?v=JHGkaShoyNs

Saturday, May 19, 2018

Wednesday, May 9, 2018

CPU Transistor Usage

The trick to cache design is finding an algorithm that gets key information into L1 cache when it's needed. This is so important to performance that more than half of a processor's transistors may be used for a large on-chip cache.
https://www.computerworld.com/article/2584352/computer-hardware/inside-a-microprocessor.html

Diodes vs Transistors

Since all diodes having only two terminal means no controlling action possible whereas Transistors (BJT, FET’s e.t.c) have three terminal.Thus configuration of transistors allows for controlling action due to presence of controlling terminal (i.e for BJT ‘Z’ is Base and for FET’s ‘Z’ is Gate terminal).
http://qr.ae/TUTsSg

Tuesday, August 15, 2017

JSF vs Struts 2

JSF was designed in part by the authors of Struts to create a "Struts" that did a more accurate implementation of MVC (Struts is technically "Model 2") and to get rid of all the interface and subclass dependencies. The idea being that POJOS are more re-usable and easier to unit-test offline than framework-dependent code. Which is why I chant endlessly:
The more JSF-specific code that is in your JSF webapp, the more likely it is that you're doing it wrong.
The other thing that the Struts folks didn't like about Struts was that you had to define too many classes for each component. In JSF, you define a view template file, a backing bean (model), and that's basically it. There's no separate "action" class to transition data in and out of the MVC part of the webapp, just POJO methods that are defined in the same class as the POJO model.

https://coderanch.com/t/625642/java/Struts-JSF

Tuesday, November 29, 2016

Decompose and Expose

Large, complex private methods are a code smell. An implementation which is so complex that it cannot be usefully decomposed into component parts (with public interfaces) is a problem in testability that reveals potential design and architectural problems. The 1% of cases where the private code is huge will usually benefit from rework to decompose and expose. – S.Lott Feb 14 '12 at 20:06
http://softwareengineering.stackexchange.com/questions/135047/new-to-tdd-should-i-avoid-private-methods-now#comment253312_135049

Wednesday, October 12, 2016

Continuous Delivery Quotes

...a suite of tests is run, optimized to execute very quickly. We refer to this suite of tests as commit stage tests rather than unit tests, it is useful to include a small selection of tests of other types at this stage...
Begin the design of your commit test suite by running all unit tests. Later, as you learn more about what types of failure are common in acceptance test runs ... you should add specific tests to your commit test suite to try and find them early on.
Acceptance tests written without developer involvement also tend to be tightly coupled to the UI and thus brittle and badly factored, because the testers don't have any insight into the UI's underlying design and lack the skills to create abstraction layers or run acceptance tests against a public API. 

- Continuous Delivery
- Jez Humble, 2011

Friday, September 16, 2016

The "Ultimate Configurability" Antipattern

The desire to achieve flexibility may lead to the common antipattern of "ultimate configurability" which is, all too frequently, stated as a requirement for software projects. It is at best unhelpful, and at worst, this one requirement can kill a project.
Continuous Delivery - Addison-Wesley 2012 p. 40

Friday, August 12, 2016

Closures vs Lambdas

Where closures go beyond lambdas is that they bind or "close over" variables that are not explicitly defined in the closure's scope.
http://dublintech.blogspot.com/2014/05/groovy-closures-this-owner-delegate.html