From: Stefan F. <ste...@we...> - 2015-08-30 09:54:11
|
Martin: now that I have hopefully all changes for 2.0 done, I will focus on 1844/1854. One thing I would like to avoid this time is the code duplication in sub-classes of major Rails classes (like OperatingRound, StockRound, PublicCompany etc.). This is a nightmare to support and debug. What really makes this difficult is to find the differences to the standard implementation and checking if the difference is by chance (e.g. bug fixes not implemented there) or required due to a rule change. Take for example StockRound: In addition to the general class, there are 7 game specific sub-classes, 4 more general sub-classes that itself contain another 5 game specific sub-classes. If all of them copy the general code of share selling to change a minor detail how shares are sold, there are close to 20 implementations of share selling, which have to be maintained. The general guidelines should be: * Game specific code should only contain code that is relevant to implement a delta specific to that game. It should not copy general code. * If this is not possible, comments on what was copied and what is the intended change is a MUST. So Martin (and everyone else writing code for Rails) please think hard or ask for help BEFORE copying code from methods in general classes. I know the problem is that many methods, especially in the Round classes, have been written in a fashion that reusing them is difficult and code copying easy. However the better solution is: Refactor the general method FIRST to allow re-use and than call the re-factored method from the game specific class. To increase co-operation for 1844 and 1854 development, I have added wiki pages for those games, that allow to share a list of things to do and what is already implemented. http://github.com/freystef/Rails/wiki/1844 http://github.com/freystef/Rails/wiki/1854 Sorry for sounding harsh, that is not my intention. My intention is to make all our life in the future easier. Stefan |