I'm trying to refactor a big tightly coupled application and trying to make it more maintainable and flexible.
I've got many unit tests, so I'm hoping to refactor step by step.
Which Design & Refactoring Patterns should I consider implementing / applying to accomplish this task ?
I can think of some :
Extract Interface
Extract Meth...
Found myself trying to find a link to an official definition of this design pattern which I believe I saw in Go4 but can't seem to find it anywhere.
class Processor{
ProcessParameter(AbstractParameter x){
x.Process(this);
}
ProcessParameter(ParameterA x){
... A-specific logic...
}
ProcessParameter(Paramet...
If the Single Responsibility Principle states that every object must have a single reason to change and a single strategy class implemented with the Strategy pattern (by definition) has multiple methods that can change for any number of reasons, does that mean that it's impossible to implement the Strategy pattern without violating the S...
I'm interested in perceived "best practice", tempered with a little dose of reality here.
In a web application, do you allow your web tier to directly access the DAL, or should it go through a BLL first?
I'm talking specifically of scenarios where there's no "business logic" really involved -- such as a simple query : "Fetch all custom...
Background:
I have a win app and a web app and a
shared class library.
In my class lib I have some static
methods for SQL queries which pick up
my SQL connection string
I store my SQL connection string in a
Session variable since it is set at
log in time where it is determined
which database to use.
My class lib cannot access my sessio...
Looking for advice, links, design patterns, etc. on the best way to design an application where entities and related screens could be extended with additional attributes/related lookups via metadata/without recompile, ideally by end users. I'm thinking something very similiar to how Dynamics CRM 4.0 works with extension tables/dynamic p...
Say we have two aggregate roots in a domain model: Group and User.
Now, Users can be added to or removed from groups. Using the repository pattern, I only modelled the following two interfaces so far:
interface IGroupRepository
{
Group FindById(int groupId);
}
interface IUserRepository
{
User FindById(int userId);
IQueryabl...
Hello,
I want to create a singleton in C.
What's the best way?
A concurrent solution would be nice..
Edit - I am aware that C isn't the first langague you would use for a Singleton, If it was the question was much simpler.
...
I have a domain object used in an identity map (the keys are the object's Id property).
Pseudocode:
map = new Mapping();
map[domainObj.Id] = 'foo';
I observe the object to tell me when it has been saved to the database:
domainObj.bind('saved', function() {
map[domainObj.Id] = 'new foo!'
})
For new objects the Id field is empty...
UPDATE:
So pretty much everyone here told me that i just need to start over again on how i designed my classes (thank you folks for your excellent answers by the way!). Taking the hint, i started doing extensive reading on the strategy pattern. I want to create behavior classes (or strategy classes) that inherit from an abstract base c...
I'm trying to brush up on my design pattern skills, and I'm curious what are the differences between these patterns? All of them seem like they are the same thing - encapsulate the database logic for a specific entity so the calling code has no knowledge of the underlying persistence layer. From my brief research all of them typically ...
I have a special kind of collection (in an object-oriented programming language) that provides a large range of persistence services, but that is also queried by other components. At times I have objects that I need to store in the repository, but whose type I would like masked from other services until it is ready (e.g., approved, or co...
I'm looking for a pattern describing a certain situation. Maybe someone knows something and can give me a hint
Situation Object of type A, 1 : n association to objects of type B. Example: A Person and all his pets. The pet objects have an age data member. Now each person should have a data member for the average age of his pets. I don't...
Duplicate of: http://stackoverflow.com/questions/546403/whats-the-best-way-to-store-class-variables-in-php
For some time I've been having this discussion with a co-worker on how should you store attributes within a PHP class.
So which one do you think it should be used. Something like this:
Class test{
public $attr1;
publ...
I'm trying to implement the Event Generator Idiom (http://www.javaworld.com/javaworld/jw-09-1998/jw-09-techniques.html). I find things to be a bit "odd" when it comes to the observable class though. Let's say I have the following classes:
interface BakeryListener
+ orderReceived(BakeryEvent event)
+ orderProcessing(BakeryEvent even...
I have been using factory method creation pattern for awhile now. I was just recently told that this:
public static class ScheduleTypeFactory
{
public static IScheduleItem GetScheduleItem(ScheduleTypeEnum scheduleType)
{
IScheduleItem scheduleItem = null;
switch (scheduleType)
{
case Schedule...
I work in a web shop as a PHP programmer. Most of the time we use good coding practices but not much structure to the site as a whole.
I have now entered my phase of being bored with some of our practices and want to branch out and simplify and generate some things in a helpful way not just for me, but the hybrid-programmer web develop...
I am a senior level developer but I haven't had a lot of formal training and I although I have used many design patterns and seen them used in my years as a developer, no one really went out of their way to say. "Oh this is an observer pattern, or this is a Singleton pattern."
Reading over some of the design patterns, I came across the ...
I was trying to use RoR or ASP.NET MVC but at my first impression it seems to me that MVC is a drastic way to change the programming paradigm. Is this just my resistance to changes or it is really weird? Some times i feel really lost! Any suggestion or I just have to turn back and program in the old fashion way?
...
I have a three tier system, SQL Server backend, hand written data access layer, and using stored procedures.
I have a table called EventTable. Each row is an 'Event'. An Event has a primary key, and a start date.
CREATE TABLE EventTable
(
ID INT IDENTITY(100,1) PRIMARY KEY,
StartTime DateTime NOT NULL
)
There is a stored proced...