From: Stefan F. <ste...@we...> - 2014-09-08 16:38:42
|
Mike: below you find a proposal how to restructure StockMarket. This is an example how I would like to change other components of Rails in the longer run. Please feel free to comment. I will write a mail on 1862/1860 stock market specifics later. Stefan Suggestions for a component structure. Example: Stockmarket Currently the core parts of logic, data and creation for the Stockmarket is combined in one class: Stockmarket. A) Separation of Data and Logic The data parts of Stockmarket should be moved to a separate class (e.g. xxxMarketModel). Possible classes depend on the StockMarket: e.g. RectangularMarketModel, HexagonalMarketModel, LinearMarketModel The logic part replaces the existing StockMarket class and contains method called from Rails that operate on the StockMarket, e.g. payout, withhold, sharesSold, etc. Most likely there will be some default Markets, like RectangularMarket, HexagonalMarket or LinearMarket, but more specialized are possible. Customization should be possible in two ways: i) Internal configuration due to xml settings. ii) Implementing StrategyInterfaces that adjust part of the internal working of the default market. E.g. there could be a SoldOutStrategy interface, that allows to change how the market behaves if shares are sold out after a stock round. B) Move Creation to a Builder/Factory class (StockMarketFactory) Creation of the StockMarket is then done by a separate class, that wires together the different classes according of the needs of the specific 18xx. I prefer to use code to wire together Java elements, so no class names should appear in xml files. This allows easier refactoring and code optimizations. C) Roadmap I offer to create the basic components for 1830 according to the structure outlined above. Then other stockmarkets can be modelled along these lines. On 09/07/2014 09:18 AM, Michael Alexander wrote: > Yes, it is extremely similar to 1860. It might be that the only > difference is that the one in 1862 is longer at the high end. > > No hurry on the response, there are plenty of other things to do. > > On Sun, Sep 7, 2014 at 3:09 AM, Stefan Frey <ste...@we... > <mailto:ste...@we...>> wrote: > > Mike: > I will come up with a more detailed answer later today. > I have not played 1862 yet, however from a short glance, it seems that > the stock market is similar to the one of 1860. > I would not recommend that path, instead please wait on my thoughts, if > you do not mind ;-) > Stefan > > On 09/07/2014 05:42 AM, Michael Alexander wrote: > > And now that I'm looking at the stock market... > > > > I don't think I can use much of the existing Stock Market class for > > it. It just won't fit in a rectangle. I could make a new "Stock > > Market" class for this one and make the .xml file specify which one to > > use. Should I take that direction? > > > > Mike > > > > > > On Sat, Sep 6, 2014 at 8:54 PM, Michael Alexander > > <out...@gm... <mailto:out...@gm...> > <mailto:out...@gm... <mailto:out...@gm...>>> > wrote: > > > > I've pushed up my changes - I think I did it correctly, please let > > me know if I messed something up. > > > > I have the Parliament Round mostly working. My next step is to > > work on the stock market. > > > > > > On Fri, Sep 5, 2014 at 2:46 AM, Stefan Frey <ste...@we... <mailto:ste...@we...> > > <mailto:ste...@we... <mailto:ste...@we...>>> wrote: > > > > I will delay for a further day, as I will only return on > > Saturday. Change of plans. ;-) > > > > > > > > > > Michael Alexander <out...@gm... <mailto:out...@gm...> > > <mailto:out...@gm... > <mailto:out...@gm...>>>schrieb: > > > > I unfortunately had something come up. Don't wait for me. > > > > > > On Thu, Sep 4, 2014 at 1:03 PM, Michael > > Alexander<out...@gm... <mailto:out...@gm...> > > <mailto:out...@gm... <mailto:out...@gm...>>> wrote: > > > > I can get it to a state where I can do that tonight. > > Thanks for the heads up. > > > > > > On Thu, Sep 4, 2014 at 12:56 PM, Stefan > > Frey<ste...@we... > <mailto:ste...@we...> <mailto:ste...@we... > <mailto:ste...@we...>>> > > wrote: > > > > Martin & Alexander: > > I have now rewritten a lot of the tile and token > > lay UI code and intend > > a new alpha tomorrow end-of-day. > > So if you would like to merge some code into > > rails_2_develop, there is > > some time left to do so. > > Good coding, > > Stefan > > > > ------------------------------------------------------------------------------ > > Slashdot TV. > > Video for Nerds. Stuff that matters. > >http://tv.slashdot.org/ > > _______________________________________________ > > Rails-devel mailing list > >Rai...@li... > <mailto:Rai...@li...> > > <mailto:Rai...@li... > <mailto:Rai...@li...>> > >https://lists.sourceforge.net/lists/listinfo/rails-devel > > > > > > > > ------------------------------------------------------------------------------ > > Slashdot TV. Video for Nerds. Stuff that > > matters.http://tv.slashdot.org/_______________________________________________ > > <http://tv.slashdot.org/_______________________________________________> > > Rails-devel mailing lis...@li... > <mailto:Rai...@li...> > > <mailto:Rai...@li... > <mailto:Rai...@li...>>https://lists.sourceforge.net/lists/listinfo/rails-devel > > <https://lists.sourceforge.net/lists/listinfo/rails-devel> > > > > > > ------------------------------------------------------------------------------ > > Slashdot TV. > > Video for Nerds. Stuff that matters. > >http://tv.slashdot.org/ > > _______________________________________________ > > Rails-devel mailing list > >Rai...@li... > <mailto:Rai...@li...> > > <mailto:Rai...@li... > <mailto:Rai...@li...>> > >https://lists.sourceforge.net/lists/listinfo/rails-devel > > > > > > > > > > > > ------------------------------------------------------------------------------ > > Slashdot TV. > > Video for Nerds. Stuff that matters. > >http://tv.slashdot.org/ > > > > > > _______________________________________________ > > Rails-devel mailing list > >Rai...@li... > <mailto:Rai...@li...> > >https://lists.sourceforge.net/lists/listinfo/rails-devel > > > ------------------------------------------------------------------------------ > Slashdot TV. > Video for Nerds. Stuff that matters. > http://tv.slashdot.org/ > _______________________________________________ > Rails-devel mailing list > Rai...@li... > <mailto:Rai...@li...> > https://lists.sourceforge.net/lists/listinfo/rails-devel > > > > > ------------------------------------------------------------------------------ > Slashdot TV. > Video for Nerds. Stuff that matters. > http://tv.slashdot.org/ > > > > _______________________________________________ > Rails-devel mailing list > Rai...@li... > https://lists.sourceforge.net/lists/listinfo/rails-devel > |