Entry tags:
fizzbuzz: правильное решение
(эта запись может быть интересна программистам и сочувствующим)
Наконец-то кто-то сделал важное и правильное дело: выложил в открытый доступ действительно качественное, основанное на правильных принципах решение известной проблемы FizzBuzz:
FizzBuzz Enterprise Edition
Я читал исходники и восхищался. Практически не к чему придраться, ну разве что я бы еще тестов добавил. Но само решение - высший класс.
Наконец-то кто-то сделал важное и правильное дело: выложил в открытый доступ действительно качественное, основанное на правильных принципах решение известной проблемы FizzBuzz:
FizzBuzz Enterprise Edition
Я читал исходники и восхищался. Практически не к чему придраться, ну разве что я бы еще тестов добавил. Но само решение - высший класс.
no subject
Документации только маловато.
no subject
no subject
Oh fsck. Make me unknow it ;-P
no subject
no subject
no subject
no subject
no subject
А вообще штука приятная, даже приятнее чем GNU Hello World (http://www.gnu.org/software/hello/).
no subject
no subject
com.seriousbusiness.fizzbuzz.IntegerRangeIterator
com.seriousbusiness.fizzbuzz.impl.condition.IntegerDivisionChecker
com.seriousbusiness.fizzbuzz.config.FizzBuzzStrategyConstants.FIZZ_DIVISOR
com.seriousbusiness.fizzbuzz.impl.actors.printers.FizzStringPrinter
etc.
no subject
no subject
no subject
По его словам процентов 70 пишут иерархию классов фигура, клетка, ряд клеток, доска и любят рисовать умл диаграммы о том как эти классы связаны и взаимодействуют
no subject
no subject
Потом приходит change request: добавить в игру поддержку львов, светлячков и единорогов, а также сделать доску шестиугольной и ввести зелёные фигуры. После чего программа отправляется на полное переписывание, так как все алгоритмы были написаны под этот массив.
no subject
no subject
no subject
This codebase has a number of issues to resolve before it can be truly enterprise ready. Configuration is non-existent and needs to be moved into an XML layer or even better a naming service such as JNDI or LDAP. The author should consider using dependency injection to build his objects rather than invoking constructors and factories directly. As it stands you have to recompile the project to change even the simplest settings.
The most glaring error is any kind of externally configurable logging which is absolutely required to be enterprise ready. There is also a complete lack of metrics or management code. Adding some JMX support would be a good start and ideally some statsd integration so you can get some runtime insights into what the code is doing. Right now the whole thing is just a black box. How are you supposed to monitor and track this thing?
At an architectural level there is no reliability guarantee on execution either. If you crash half way through, have a power outage etc, you have to manually restart the process. The whole thing should be triggered by a durable message queue and actually processed by a set of redundant back-end services which would guarantee execution and deliver the finalized document asynchronously. This would also decouple resource usage and allow different SLAs (service level agreements). As it stands, I have no way of guaranteeing resource availability to my Gold customers and thus no way to actually deliver on contractual performance guarantees which may have been made by the sales team. Our top tier customers for example would probably have dedicated boxes reserved for handling just their traffic. Which of course requires some level of identity services/authentication.
In summary: we are missing
* configuration
* logging
* metrics
* monitoring
* reliability
* SLA support
* security/authentication
This is a good start though.
no subject
no subject
С физбазом та же история: найти и генерализировать как можно больше точек в программе.
no subject
https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition/blob/master/src/main/java/com/seriouscompany/business/java/fizzbuzz/packagenamingpackage/impl/stringreturners/IntegerIntegerStringReturner.java
?
public String getIntegerReturnString(int theInteger) {
Integer myInteger = new Integer(theInteger);
StringBuilder myStringBuilder = new StringBuilder(myInteger.toString());
String myString = myStringBuilder.toString();
return new String(myString);
}
кажется тут все можно заменить на return Integer.toString(theInteger);
no subject