I want to develop an application which has a graphical user interface that could be developed by using different widget toolkits. For example I want to use Qt, GTK+ or even ncurses as a building block for my user interface for the same application. Moreover users could choose which GUI implementation will be used during the next startup ...
The advantages of DI, as far as I am aware, are:
Reduced Dependencies
More Reusable Code
More Testable Code
More Readable Code
Say I have a repository, OrderRepository, which acts as a repository for an Order object generated through a Linq to Sql dbml. I can't make my orders repository generic as it performs mapping between the Linq...
I happened to be working on a Singleton class in ruby and just remembered the way it works in factory_girl. They worked it out so you can use both the long way Factory.create(...) and the short way Factory(...) I thought about it and was curious to see how they made the class Factory also behave like a method.
They simply used Factory...
Can someone give me an example of Decorator pattern in C++ ?
I have come across the Java version of it. But C++ i have found it difficult to understand the examples that are given.
...
I'm not sure if 'architecture' is the correct term, but I've been looking for some articles online which talk about programming design and more about how best to use languages such as JavaScript in a code design sense rather than the actual syntax itself.
I have found many websites but a lot seem to be very out dated, and I'm not sure w...
This is just an efficiency question really.. I'm interested to know if there is a more efficient or logical way that people use to handle this sort of scenario.
In my asp.net application I am running a script to generate a new project my code at the top level looks like this:
Dim ok As Boolean = True
ok = createFolderStructure()
...
I'm developing a website that uses some complex computations (NLP-related). My customer wants to have "debugging" webpages for some of these computations where he can run them with arbitrary input and see all the intermediate results that occur during computation.
Before this request all of the computations were encapsulated in beans an...
I'm brainstorming some ideas around a pattern to use for the following scenario.
I have some 3rd party controls that I want to add common functionality to. Functionality is added by handling several of the the events and doing certain things when the events fire along with adding some private variables to hold some state info between e...
I have a service layer with a logger class
Service layer references DAL for Logger class to get its email credentials to use while sending email for critical log items.
I want to use this logger inside the DAL since there is stuff that needs to be logged there also - but with my current architecture I cannot.
I see this could somewha...
What are some good names for the client and server side classes that communicate over the network when implementing a remote proxy? The classes are often called stub and skelleton but I don't find those names very "intention revealing". Are there any other (better) alternatives?
...
Hello, I need a hint concerning MVC and Observer-Pattern.
For example a model contains the classes "Address" and "Person". The Address class contains the fields street:String, zipcode:String, location:String. Whereas the Person class contains the fields name:String, firstName:String, address:Address.
My approach so far looks something ...
Design pattern can separeted 3 important part: "http://www.dofactory.com/Patterns/Patterns.aspx". why three part?
Creational Patterns
Structural Patterns
Behavioral Patterns
How can i separete it into three part? According to what?
...
Here is a small currency converter piece of code:
public enum CurrencyType {
DOLLAR(1),
POUND(1.2),
RUPEE(.25);
private CurrencyType(double factor) {
this.factor = factor;
}
private double factor;
public double getFactor() {
return factor;
}
...
I've been doing some reading about design patterns and wanted some perspective. Consider the following:
Dim objGruntWorker as IGruntWorker
if SomeCriteria then
objGruntWorker = new GoFor()
else if SomeOtherCriteria then
objGruntWorker = new Newb()
else if SomeCriteriaAndTheKitchenSink then
objGruntWorker = new CubeRat()
end i...
The first pattern stands for this acronym is SRP. Here is a quote.
the single responsibility principle
states that every object should have a
single responsibility, and that
responsibility should be entirely
encapsulated by the class.
That's is simple and clear till we start to code ) Suppose we have a class with well def...
I am creating a silverlight site. I am currently breaking out my ideas into pieces of functionality. One of the idea's I have is the concept of a content manager. This is essentially a UI control with 4 regions. Top, Bottom, Right & Left. I also have a collection of objects that are considered "Menu Items". These are controls that functi...
I need to add some document management functionality into my software. Documents will be grouped by company name and project name.
The folders need to be accessed by the application using the id numbers of clients/projects, but also easily browsed by the end user using windows explorer.
Clients and Projects will be stored in a databa...
What is the best way to do a city/country dropdown pair in ASP.NET MVC?
I see lots of places with country above city, but that's unnatural: in real life we write city/country. I've used city, then country, but the problem is that the user then has to go backwards after changing the country.
The other problem is what do you do about cit...
I have a Ruby on Rails (2.3.5) application and an APE (Ajax Push Engine) server. When records are created within the Rails application, i need to push the new record out on applicable channels to the APE server. Records can be created in the rails app by the traditional path through the controller's create action, or it can be created by...
I have such a design in my mind.... My aim is to reuse the program with some features included and without some features.
What is it called in the literature?
More information: there are events.. Events cause calls to function1() or function2()...
Features have functions which are called when events takes place.
A feature may influence ...