Java extensions organisation

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

wallis2xk
Posts: 43
Joined: 01 Sep 2006, 10:00
Location: United Kingdom

Java extensions organisation

Postby wallis2xk » 16 Feb 2010, 10:15

Hi,

We have a set of custom classes we are using across our Java server-side extensions, for example com.ourcompany.utils.CustomPlayer. Our problem is that we would like to be able to separate versions of these classes for different games. For example

com.racinggame.MainGame

and

com.shootinggame.MainGame

could both use a CustomPlayer class, but whenever a new version of this class is uploaded it will affect all of the games which might potentially cause compatibility problems. Is there a way to sandbox projects from each other without changing the package structure of our shared files?

Cheers
Richard
User avatar
Lapo
Site Admin
Posts: 21597
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 17 Feb 2010, 13:16

Hi,
if you have classes that are used as libraries from different projects, all projects will be affected when you change/update that library. The solution is to be found in the way those classes are designed.

Suppose you have an HighScoreManager class, that you want to use from 3 different games. If you need to be able to change/modify it and be able to affect only one of the games, you should make sure to detach the implementation from it's interface.

In other words HighScoreManager should be an interface.
Then you would provide concrete implementations such as DefaultHSManager, SpecialHSManager etc... If you update the library you can then swap the implementation to a different one in the games that require it, leaving the other unaffected.

It's the old "program to interfaces not implementations" mantra that you find in any design pattern book. http://fatagnus.com/program-to-an-inter ... mentation/
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “Server Side Extension Development”

Who is online

Users browsing this forum: No registered users and 4 guests