fizzbuzz: правильное решение
Sep. 14th, 2013 12:28 am(эта запись может быть интересна программистам и сочувствующим)
Наконец-то кто-то сделал важное и правильное дело: выложил в открытый доступ действительно качественное, основанное на правильных принципах решение известной проблемы FizzBuzz:
FizzBuzz Enterprise Edition
Я читал исходники и восхищался. Практически не к чему придраться, ну разве что я бы еще тестов добавил. Но само решение - высший класс.
Наконец-то кто-то сделал важное и правильное дело: выложил в открытый доступ действительно качественное, основанное на правильных принципах решение известной проблемы FizzBuzz:
FizzBuzz Enterprise Edition
Я читал исходники и восхищался. Практически не к чему придраться, ну разве что я бы еще тестов добавил. Но само решение - высший класс.
no subject
Date: 2013-09-13 09:40 pm (UTC)Документации только маловато.
no subject
Date: 2013-09-13 11:41 pm (UTC)no subject
Date: 2013-09-13 09:42 pm (UTC)Oh fsck. Make me unknow it ;-P
no subject
Date: 2013-09-13 09:48 pm (UTC)no subject
Date: 2013-09-13 09:56 pm (UTC)no subject
Date: 2013-09-13 10:04 pm (UTC)no subject
Date: 2013-09-13 10:13 pm (UTC)no subject
Date: 2013-09-13 10:22 pm (UTC)А вообще штука приятная, даже приятнее чем GNU Hello World (http://www.gnu.org/software/hello/).
no subject
Date: 2013-09-13 10:28 pm (UTC)no subject
Date: 2013-09-13 11:18 pm (UTC)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
Date: 2013-09-14 06:13 am (UTC)no subject
Date: 2013-09-14 06:29 am (UTC)no subject
Date: 2013-09-14 12:21 am (UTC)По его словам процентов 70 пишут иерархию классов фигура, клетка, ряд клеток, доска и любят рисовать умл диаграммы о том как эти классы связаны и взаимодействуют
no subject
Date: 2013-09-14 06:08 am (UTC)no subject
Date: 2013-09-14 08:24 am (UTC)Потом приходит change request: добавить в игру поддержку львов, светлячков и единорогов, а также сделать доску шестиугольной и ввести зелёные фигуры. После чего программа отправляется на полное переписывание, так как все алгоритмы были написаны под этот массив.
no subject
Date: 2013-09-14 03:24 pm (UTC)no subject
Date: 2013-09-15 09:43 am (UTC)no subject
Date: 2013-09-14 06:45 am (UTC)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
Date: 2013-09-14 07:42 am (UTC)no subject
Date: 2013-09-14 09:31 am (UTC)С физбазом та же история: найти и генерализировать как можно больше точек в программе.
no subject
Date: 2013-09-14 09:12 am (UTC)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
Date: 2013-09-15 04:04 pm (UTC)