Features in my application: Any solution or pattern?
- From: tailormade@xxxxxxx
- Date: 31 Jan 2006 06:16:28 -0800
The application has something that I call features. For each user of
the application (our customers) there are different sets of features.
Features have only the state activated or not activated. The
configuration for those features are stored in a donlge (one feature
per bit). An example of an feature could be this: the app maintains a
project and a user is now allowed to add a certain thing or not (the
customer has to pay for this feature).
One solution that I thought of was that certain classes could implement
an Activatable interface. Like this (I hope the Java syntax is correct)
public interface Activatable {
public static void setActive();
public static boolean isActive(); //nice to have
}
With this I could initially set the state of the class at the start of
the program. Then I could prevent the creation of an object of the
feature with throwing an exception:
/* This class represents a feature that can be activated or can be left
as inactivated*/
public class ANiceFeature implements Activatable {
private static boolean activated = false;
public ANiceFeature() {
if (! activated) throw new UnsupportedFeature();
}
public static void setActived() {
activated = true;
}
public static boolean isActive() {
return activated;
}
}
Would you say this is a acceptable approach?
If so I have another question. I use VB.NET which does not allow an
interface to have static members (I don't know why). How could I
achieve the same thing with this language?
I guess the suggestion will be too simple. But I am not an expert.
However, I would like to establish a clean, robust and scalable
solution (scalable, since in future new features will be added).
Thanks in advance,
Robert
.
- Prev by Date: Re: Wide Adoption for UML Techniques
- Next by Date: Re: Wide Adoption for UML Techniques
- Previous by thread: File system and UML diagrams
- Next by thread: How to use operations as messages in collaborations?
- Index(es):
Relevant Pages
|