I have been reading up on Dependency Injection frameworks. I really fell in love with the idea of separating the concerns and letting the objects do their core work - which is undoubtedly an excellent and long-standing design principle!
However the more I read on DI frameworks, the more I get worried:
1) In the way they "automagically" ...
Suppose I have a function that performs some task (this is in Python pseudocode):
def doTask():
...
But I have several optional features on the platform which results in having code that looks like this:
def doTask():
...
if FEATURE_1_ENABLED:
...
if FEATURE_2_ENABLED:
...
...
Unfortunately, this...
Hi,
I'm confused in one of the line about Business delegate that says:
Business delegate handle & abstract
any remote exception
What do they mean with the word "abstract" here? Is it just providing a details not how to implement them?
...
I'm working in AS3, but I guess this could be a general question, so I'll frame it more vaguely...
I'm using an XML file to define parameters for a particular class of object that implements the Strategy Pattern. There will be large variety of objects, and this works for us as a designer friendly solution to customizing these objects. A...
Hi,
What the following line is saying about model component in MVC pattern:
If the model adheres to a strict
contract (interface). then these
components can be reused in other
application areas such as GUIs or
J2ME.
Does the above line mean, if the model components implement any interface based on any GUI and J2ME applicat...
For several applications I made for my current client I have shared user accounts. This means that each account in one application should exist in the other applications.
Each application has it's own set of settings.
The number of applications and the settings themselves will be the parts that really change over time so I want to separa...
I'm running into problems implementing statuses for a model. This is probably due to wrong design.
There is a model which has a status. There can be multiple instances of the model and only a few predefined statuses (like: created, renewed, retrieved etc.). For each individual status there is some calculation logic for the model. E.g. m...
Classic scenario, where an order has order lines.
The client wants to be able to apply a rebate to the entire order, that is either a fixed amount or a percentage.
What would be the best way to implement that?
I am thinking storing two fields on the order-object:
Rebate fixed amount
Rebate percentage
And then I can calculate the t...
I've been programming for many years, recently i've been trying to apply some of the ideas from Domain driven design, but I still struggle with deciding on good names for certain parts of a system.
Here's one example;
I have a WCF webservice that returns "Computer" objects. The object is an aggregate root that contains child entities.
...
I'm currently working on a legacy system using Oracle's ADF Faces JSF implementation for the presentation layer. The system relies on a rules engine to make certain form elements required, disabled, or even highlighted depending on the user's interaction with them or values entered.
At it's current stage the application is "working", s...
If I have a method that does something and additionally logs information, should I create a new method if I don't want to log or use a flag?
public void MethodA(string myMessage, bool logIt)
{
if(logIt)
{
//do stuff with logging
}
{
//don't need to log
}
}
...vs...
public void MethodA(string myMessage)
{
//do stuf...
When you want to call an EJBBean from the client, first you need to get hold of an EJBHome object reference through JNDI lookup. This code needs to be executed each time you need to work with the EJBBean so is gets redundant and expensive.
To solve this problem, you can cache the EJBHome object references and reuse them again and again...
I am using Python for automating a complex procedure that has few options.
I want to have the following structure in python.
- One "flow-class" containing the flow
- One helper class that contains a lot of "black boxes" (functions that do not often get changed).
99% of the time, I modify things in the flow-class so I only want code ther...
Hi SOlers,
some time ago we implemented impersonation into our application (a DMS system). We did this because the users should not have access to the physical files of the document pages.
So the user logs into our application, gets impersonated to a special user so he can access the files he needs from within our application.
When th...
I want to issue a series of Command executions, but only when the prior command succeeded. Right now i am raising an event within the command object indicating whether the command succeeded or failed. I am using this to control execution, but it feels inelegant.
Example:
command1.CommandSucceeded += delegate { command2.Execute(); };
co...
Two part questions
I have a product aggregate that has;
Prices
PackagingOptions
ProductDescriptions
ProductImages
etc
I have modeled one product repository and did not create individual repositories for any of the child classes. All db operations are handled through product repository.
Am I understanding the DDD concept correctly so...
I'm using a basic 3-tier design. For flexibility (and testing) purposes, I wanted the data layer to be abstract and specify the concrete class in my code. But, how should I pass this along to my business objects. Here's an example (pseudo code):
abstract class IDataLayer
{
PersonData GetPerson(int); //PersonData would be a row of da...
I'm trying to figure out what logic should go into the different UIViewController methods like viewDidLoad, viewDidAppear, viewWillAppear, ...
The structure of my app is that I have a root view controller that doesn't really have a view of its own, rather it has a tab view controller and loads other view controllers into it. But in the...
Hi All,
I am constantly debating how best to create my classes.
By this I mean why dont we always create a class that Implements INotifyPropertyChanged and IDataErrorInfo so that "if" we want to we can bind directly in our forms, and why dont we always decorate them with the attributes so that if we want to we can use the class in WCF...
This is an example from: dofactory
I reformatted it a bit for better fit (compressed):
namespace DoFactory.GangOfFour.Decorator.Structural{
class MainApp{
static void Main(){
ConcreteComponent c = new ConcreteComponent();
ConcreteDecoratorA d1 = new ConcreteDecoratorA();
ConcreteDecorato...