From: Stefan F. <ste...@we...> - 2014-04-26 13:57:04
|
John: I agree with the content of your proposal. We differ in the fact that I prefer composition over inheritance for companies in Rails. However please feel free to adopt your favorite style of coding for your implementation. I am sure that for example Erik for example would prefer your approach over mine ;-) The basic idea is discussed here: http://en.wikipedia.org/wiki/Composition_over_inheritance I can see that major areas for which companies can differ in 18xx are: - Ownership: public, private - Operation: runTrains, fixedDividends - Creation: nationalization, merger, ipo Assume that all types of companies might exist, inheritance requires 2*2*3 = 12 classes of companies. (e.g. 1830 has PublicTrainRunningIPO and PrivateFixedDividendsIPO companies, 1835 adds PrivateTrainRunningIPO (minor) companies, PublicTrainRunningNationalization (PR) company). My favorite structure would be do define the following interfaces (or before Java 8 abstract classes): CompanyOwnership CompanyOperation CompanyCreation Concrete implementations would be e.g. PrivateOwnership and PublicOwnership, TrainRunning and FixedDividend and CreationByNationalization, CreationByMerger and CreationByIPO. which when allow to define only one company class and then set the ownership, operation and creation behavior accordingly. In the long run (as soon as we arrive at Java 8) it will be possible to switch to interfaces, which makes this approach even more attractive. One detailed comment: My proposals were for XML templates, it did not imply creating new Java classes. XML company templates are much more lightweight than new classes. Except from that I fully agree with your proposal, however it would be great if you were able to include 1856 (and current prototypes 1826, 18Scan?) into your analysis of nationalization? Stefan > > 1. Generalize the code that handles Prussian formation (and mergers > into it) in 1835, so that there can be more than one "Prussian". > This involves creating a new class, NationalCompany, which has the > property that some of its share certificates are reserved to be > exchanged for the various companies that will eventually merge into > it. > > A NationalCompany is a PublicCompany with these additional properties. > * A list of the other companies (of any kind) which will merge, and > the shares to be exchanged for each. If any of the predecessors is a > public company then there must be an exchange certificate for each one > of its share certificates. > * The game phase that begins the period in which the NationalCompany > may form. (The predecessor that converts to the president's share is, > by definition, the one that may form it.) > * The game phase at which the NationalCompany must form. > * The game phase at which all predecessors of the NationalCompany must > merge. > > [Two important notes here. (a) Two or even all three of these phases > may be the same, thus forcing the NationalCompany to form and merge all > its predecessors at once. SD does this in 1837. (b) If more than one > NationalCompany is giving the same player repeated opportunities to > form it or merge predecessors into it, that player should see only one > dialog box with these choices each round -- not one for each minor or > even each NationalCompany. That would be too much clutter.] > > * A boolean which if true, means that when all non-reserved shares of > the NationalCompany are out of the IPO, all predecessors of the > NationalCompany must merge at the end of that stock round. (Thus I can > use this class, not only for the three state railways in 1837, but also > for most of its other public companies -- to handle the coal companies > that will merge into each one). > > The existing XML interface that handles the definitions of companies > should be expanded to cover these properties. > > Once the above is tested and working, it should probably be used by 1835 > (and 18Mex, and maybe someday 2038, etc...) Thus I don't see it as > belonging in gamespecific_1837. > > [For grins I may even include the capability to have a predecessor > "decide" that it'll never merge after all, thus moving its reserved > trade-in share of the NationalCompany into the regular IPO. This would > handle the growth companies in 2038.] > > 2. Generalize MinorCompany_1835 to MinorCompany_1837. Not much needs to > be changed here, but I want the companies to have a couple of new > properties. One is that a MinorCompany_1837 can have multiple shares. > (I want to handle U1 and U3 this way because most of the differences > between the existing public and minor company classes relate to the fact > that PublicCompany shares can be sold, and therefore have a market price. > U1 and U3 can't and don't.) The other new property is that certain minor > companies (the coal companies) can only own certain types of trains. > > As with #1, the XML interface that handles definitions of companies > should be expanded to cover these properties. > > 3. Generalize the start-round code. 1837 has two start packets: one > where you're buying companies (or a private company plus a share, as in > 1835) from the top of any column in a 3-column table. Then when that > sells out, the minor companies of KK and UG form a second "start packet" > where you can buy anything (but not the non-president's share of U1 or > U3 before the president's share). > > Someone wrote that Rails can now handle a second start packet, but I > haven't gone through that section of the code since it changed. > > [Yes, I know, Steve Thomas says that there is about to be a new edition > of 1837 using the very different start-packet he uses in his PBEM games. > I do plan to accommodate that, but I refuse to make it the only way to > play the game, because I think it ruins the game.] > > * * * > > Once that laundry list is done, the company types become roughly this. > > Mountain railways -> PrivateCompany. No need to even call them > anything else. Of course the special-power ability > > Coal and Minor companies -> MinorCompany_1837. > > Major companies, including State companies -> all NationalCompany, except > the one (GT, IIRC) which has no coal company that merges into it. > That one is just a PublicCompany. > > ------------------------------------------------------------------------------ > Start Your Social Network Today - Download eXo Platform > Build your Enterprise Intranet with eXo Platform Software > Java Based Open Source Intranet - Social, Extensible, Cloud Ready > Get Started Now And Turn Your Intranet Into A Collaboration Platform > http://p.sf.net/sfu/ExoPlatform > _______________________________________________ > Rails-devel mailing list > Rai...@li... > https://lists.sourceforge.net/lists/listinfo/rails-devel > |