I'm building a large scale web application. It will grow in the future so I need a good back-end and front-end architecture for my application. at the back of the site, I use Zend Framework so the architecture is OK for me. But at the front, working with javascript and ajax without having a good architecture makes later changes hard and ...
So suppose I have a tree class like this in c++
class Node{
void addChild(Node*);
/*obvious stuff*/
protected:
Node* parent;
vector<Node*> children
}
class specialNode : public Node{
void addChild(specialNode*);
/*obvious stuff*/
/*special stuff*/
}
Now whenever I access the children in special...
I have an ADO.NET data access layer that has been written to work with multiple data providers, and am finding that I can't make some operations completely data provider independent.
As part of my application's installation functionality, it tells the DAL to create a database with a table and some data. The DAL uses the Sql command CREA...
I have lots of code which is doing some data processing (in C# to be more specific). Very often the data may be only processed, if some criteria are met. Since the criteria can be rather complex, they are checked in a lazy fashion. They are not checked beforehand. Thus: If during the processing some criterion is not matching, the process...
I am using contracts in my Java project. (Contract = doing checks at the start and end of methods)
I am wondering if there is a nice way/pattern to write a contract for a generic method. For example:
public abstract class AbstractStringGenerator{
/**
* This method must return a new line as it's last char
* @return string ...
Hi,
I'm currently implementing the Factory design pattern in Python and I have a few questions.
Is there any way to prevent the direct instantiation of the actual concrete classes? For example, if I have a VehicleFactory that spawns Vehicles, I want users to just use that factory, and prevent anyone from accidentally instantiating Car...
I have a C# project in which I use the Memento/Command pattern to implement Undo/Redo functionality. The application is a WPF application that uses StructureMap for IOC, has extensive unit tests and makes use of mocking via interfaces using RhinoMocks.
In my code I have an Operation class which represents all undoable operations, and I ...
Hi,
Recently I started to move from a .NET platform to J2EE. I'm Eclipse to build JSP and Servlet applications which should use Business Logic layer.
The approach in .NET is very simple I'm building web Application Project inside the solution, then Creating Class Library project and refers its output in Web Application References.
Ho...
There is a website (called the Anti-if campaign) that talks about how to replace big nested if-statements with something more maintainable (through the use of a 'bond class' see example). I understand the concept, but I don't know how to implement it (even with the example).
Question:
May I get a concrete example of how to implement thi...
I have the understanding that using data access routines directly from presentation code is considered evil. So I have a separate Repositories project, as well as a Services project. From what I can tell, typical use of a service layer is to insulate the data access from the presentation. All well and good.
I have a pretty simple domain...
Hello SO;
I shall start with some background on myself. I am a junior programmer (almost entirely .Net, unsurprisingly) and have been in my first graduate job for just over a year; before that I took a physics degree and learned programming on the side, first Fortran and then C# off my own bat for a project.
After this relatively short...
Imagine that I have a general class Person. Then I have specializations of that class, for example DanishPerson and BritishPerson.
Now I need a function that returns the correct instance of Persons, depending on what country they are in, or a way to easily determine what type of persons they are. So I have the function:
List<Person> Ge...
Well this is a simple design question i've wondered about many times and never found a satisfying solution. My example is with php-sql, but this certainly applies to other languages too.
I have a small database table containing only very few entries, and that almost never needs updating. eg this usertype table:
usertype_id (primary k...
I am learning Fluent NHibernate and this issue arose from that project.
I have a base Class and a base Interface:
public abstract class Base : IBase
{
public virtual Guid Id { get; set; }
public virtual bool IsValid()
{
return false;
}
}
public interface IBase
{
Guid Id { get; set; }
bool IsValid();
}
...
I want to start a new project basically a e-commerce website. I trying to figure out is there any advantage of using Web client software factory (WCSF) over creating all the layers by myself. How much time does it save me. What are the other failure associated with WCSF.
...
Hi guys...
I was wondering how to do the PHP OOP design pattern for real life application. I wish someone can share their learning experience with me. I am particular interested in PHP and actionscript. Most of the books I could find in the book store are only basic PHP (or AS3) programming. I appreciate any help. Thanks!
Please do no...
The question will best be understood with an example.
I have Hospital One who have 3 main pharmacies called; Central Pharmacy, Ward Pharmacy, and Private Suite.
These pharmacies can be added, deleted, and extended at will. While these go on i would love to know from my code when we are talking about a Central Pharmacy or a Ward Pharmac...
I want to design the architecture of .net web application.how to decide which pattern have to use as per scenario wise? Let say for banking or payroll system like application.
...
We are designing a system and one of our requirements is to be able to record various events which are enacted on our domain entities as they pass through their lifecycle. A bit of me thinks we should store all these events as "Command" pattern objects with associated metadata (actor, date/time etc.) but this is based on my having used i...
Hi all,
I would like to improve testability of some legacy code. To achieve this, I am introducing interfaces for existing classes (and have existing classes implement those) and factories that create an instance of a test object or an object of the original class, depending on some configuration setting.
I can foresee some internal fe...