I have the following situation:
Customers contain projects and projects contain licenses.
Good because of archiving we won't delete anything but we use the IsDeleted instead.
Otherweise I could have used the cascade deletion.
Owkay I work with the repository pattern so I call
customerRepository.Delete(customer);
But here starts the...
I'll often have objects with properties that use the following pattern:
private decimal? _blah;
private decimal Blah
{
get
{
if (_blah == null)
_blah = InitBlah();
return _blah.Value;
}
}
Is there a name for this method?
...
This is a pretty simple django patterns question. My manager code usually lives in models.py, but what happens when models.py is really huge? Is there any other alternative pattern to letting your manager code live in models.py for maintainability and to avoid circular imports?
A question may be asked as to why models.py is so huge, but...
So, the object model is rather complex and hierarchical.
Grandfather accepts is created by a GrandfatherFactory that accepts a GrandfatherRepository in it's constructor.
All is well.
Now when Grandfather needs to load it's Children how does it do it?
How does it know about the ChildFactory and ChildRepository? It shouldn't correct?
...
I want to have the changing setting of my program to take effect right away rather than rebooting my program, what design pattern is suitable here.
have a centric setting class, once the setting changed it has to update the property of objects that need to be updated, if the number of objects is big, this will create unnecessary depen...
I am writing an application which monitors a real-time stock market feed. Users submit a query to the service. When a stock meets the conditions of the query, the user is alerted.
I am trying to find a good way to load balance the application, and make it redundant.
Is there a standard pattern for achieving active-active load bal...
Pretty new to dependency injection and I'm trying to figure out if this is an anti pattern.
Let's say I have 3 assemblies:
Foo.Shared - this has all the interfaces
Foo.Users - references Foo.Shared
Foo.Payment - references Foo.Shared
Foo.Users needs an object that is built within Foo.Payment, and Foo.Payment also needs stuff from Foo...
In my WPF application data model I have multiple classes representing data for interaction with backend DB through WCF self hosted service.
Should I have multiple Data Contracts or multiple Service Contacts or Endpoints in my WCF Sevice for representing these multiple WPF data model classes? What is correct (or maybe the only) way to a...
Hi Guys,
I was wondering how to package the factories I have in my application. Should the Factory be in the same pacakage as the classes that use it, in the same package as the objects it creates or in its own package?
Thanks for yout time and feedback
...
I'd like to:
Make commonly required services visible to all classes that need them,
with a minimum of boilerplate, and
without sacrificing testability!
It's a small project and I think DI might be overkill, but maybe I'm wrong? Anyhow, I have been focusing on the ServiceLocator pattern as described by Martin Fowler
In a client clas...
Hello
I have some algorithms to do that are very similar in very aspects but are all different.
I'll try to give an example of what I mean.
Let's assume I have a Robot class. This class should be the "base" of all classes. It provides basic mechanisms to make the robot work in its environment. It might or not have to work by itself (...
I have a method:
internal List<int> GetOldDoctorsIDs
{
var Result = from DataRow doctor in DoctorTable.Rows
where doctor.Age > 30
select doctor.ID
List<int> Doctors = new List<int>();
foreach (int id in Result)
{
//Register getting data
Database.LogAccess("GetOldDoctors...
Following on from my question on service locators I have decided to use constructor injection instead. Please consider the following code:
<?php
interface IAppServiceRegistry {
public function getDb();
public function getLogger();
}
interface IFooServiceRegistry extends IAppServiceRegistry {
public...
I have a design-pattern question.
I have a framework for our smart-client application similar to CAB (Composite Application block), and we call it widget-framework.
Where we can define the modules of our application as a "Widget", and there is a config file which lists all the widgets.
The widget is any class that implements IWidget inte...
Java has the concept of a "bean", which is a class with a no-arg constructor and getter/setter methods. Does this pattern have a more generic name so that, if we're talking to programmers who have never used Java, we can avoid using the term "bean"?
...
basically, i want to have something like:
class DataProcessor{
};
however, in the future, i will need to pass DataProcessor's instance to some other functions, because DataProcessor contains some crucial data.
what I got in mind is to separate the members from methods:
class DataProcessorCore{};
class DataProcessor : public Da...
I am trying to use the Model-View-Controller pattern in a small application. The model contains some data and a selection like this
TModelSelection = record
CurrentItem : TItem;
end;
TModel = class
public
property Items : TList <TItem>;
property Selection : TModelSelection;
property Subject : TSubject <TModel>; // Observer...
Hi,
I have a Windows WCF serivce and Web client. My service has one method
[OperationContract]
SubmitOrder(OrderInfo info)....
// class used to pass all relevant data
[DataContract]
class OrderInfo
{
[DataMember]
OrderType Type;
// general order data
}
It was great until I have introduced new order types (controlled by OrderInfo....
I am working on a Data Access Layer Design, we have not finalized what ORM we are going to use as of yet.
I am leaning towards NHibernate + FluentMappings + Nhibernate.Linq but depending on project timelines we could even wait for EF4. I want to replace methods like :
IList<Customer> FindById(int id);
IList<Customer> FindByName(string ...
I'm looking for the best way to dispatch objects to the correct "target" object.
I have a base command class: Cmd, two sub-classes: BufferCmd and StateCmd. Command "GotoLine" is derived from BufferCmd and "ChangeCmd" is derived from StateCmd. BufferCmds are intended to go to a Buffer class and StateCmds are intended to go to a State o...