📜 ⬆️ ⬇️

Enterprise version of FizzBuzz with the right architecture

Hello, harabrachitel. I am the editor of the blog ABBYY. This morning the developers came to me, brought this text and asked to print it. I could not think of why this text should appear in the corporate blog, but the developers say that it is funny and will bring joy to people. So be it!

Tired of full curvature and crutches of difficult-to-support programs? Constantly hear about the right architecture, but never saw it? Meet on Github the FizzBuzz Enterprise version showing how a serious solution should look like with the right architecture.

Initially, FizzBuzz is a very simple program, conceived as a task during an interview for developers to check that they are generally able to write code. It is usually assumed that the applicant will write a loop with a chained condition inside and in total the program will take about 10 lines. This is suitable for a stressful job interview, but not suitable for serious business.

The Enterprise version solves the same problem using 10 interfaces carefully laid out in the com.seriouscompany.business.java.fizzbuzz.packagenamingpackage.interfaces package and the number of carefully thoughtful classes corresponding to the seriousness of the task com.seriouscompany.business.java.fizzbuzz corresponding to the problem severity. packagenamingpackage.impl
')
Beautiful is the NewLineStringReturner class, which returns a line feed , which is then used by the NewLinePrinter line-feed output mechanism . Such an applicant for an interview is unlikely to write - he does not understand anything in the correct architecture.

Separately beautiful is the list of “problems” : “XML is not used” , “the repository should be in Perforce” , “we need SOAP API” , “we need multithreading” and others in the same style. All these problems will surely be solved soon, and we will get the standard of a serious solution with the correct architecture.

Finally.

Source: https://habr.com/ru/post/173885/


All Articles