Ok, lets say i have a DataRepository class with the methods, getNames() and getStates(). lets say this data is stored in a webservice or database that is an expensive operation.
once the first query is run and returned, when a consumer asked for these methods its returned immediately as the results are cached in the DataRepository clas...
What advice/suggestions/guidance would you provide for designing a class that has upwards of 100 properties?
Background
The class describes an invoice. An invoice can have upwards of 100 attributes describing it, i.e. date, amount, code, etc...
The system we are submitting the invoice to uses each of the 100 attributes and is submitte...
I'm just wondering how to best handle transactions across multiple service layers. The service layers use an ORM to store and retrieve from the database. Should the transactions be known and handled within the individual service layers? Or should they be handled by another layer?
For example: I have two service layers for users and clie...
I'm interested in starting to properly design my software on paper before I ever start coding. What is the standard approach for this?
I'm thinking something along the lines of UML but I feel that it's a bit overkill for a one-man project.
What are some of the things professionals say is best to do when developing hobby projects?
Anti...
The reason I ask is because many applications, particularly web applications, do things in a similar fashion. Of course, the pattern used varies with the task at hand, perhaps even a combination of patterns. I'm guessing that many of us use a primary pattern for apps that we start out from scratch and I'm wanting to see if there is a com...
Obviously MVC promotes separation of concerns.
One thing we are struggling with is proper separation of Model from the datasource, with IDs being the main sticking point.
The interfaces that define our model call for an ID of type X
Currently the datasource is SQL server.. but what if it is an xml file for some reason and our ID is of...
Hey
Isn't there a Design Pattern who describes how to high cohesion?
I need some guidance on how and when my classes should be split up in more classes so i get some good high cohesioned classes.
...
Hey
I have developed a MVC web application with ASP.NET MVC and im just wondering which Pattern you prefer to use with a MVC project?
...
Motivation
Recently I searched for a way to initialize a complex object without passing a lot of parameter to the constructor. I tried it with the builder pattern, but I don't like the fact, that I'm not able to check at compile time if I really set all needed values.
Traditional builder pattern
When I use the builder pattern to creat...
Hello there,
Could anybody point out a good dependency injection tutorial? I found a ton on Google but none of them that would assume the reader is a just Java beginner.
Thanks!
...
Hello,
I am trying to understand the Abstract Factory design pattern. I am having a lot of trouble with it. I am trying to use the following example to develop a UML class diagram:
Car designers can design many different types of cars. Cars can have two doors, or they can have four doors. Cars can be four-wheel drive, or they can be tw...
Hello,
First of all I have to mention that I have read many C++ virtual questions in on stackoverflow. I have some knowledge how they work, but when I start the project and try to design something I never consider/use virtual or pure virtual implementations. Maybe it is because I am lack of knowledge how do they work or I don't know ho...
Hello,
I have been wondering if the Factory Pattern and the Repository Pattern is keened to go hand in hand in a Domain Driven Design project?
The reason i ask is the way i'm doing this is like so:
GUI -> ClassFactory -> ClassProduct (is in the Domain Model) -> ClassProductRepository -> Datasource
The GUI calls the ClassFactory to se...
I'm creating a class that will house election results. I have a results class that has a static method that will parse a file and return a results class with the results from the file.
I want to make sure that only the static method can modify the results, so i've been using the internal modifier (Precinct.InternalCandidates) (The pr...
Hi,
I have a winforms app which performs actions (logging into a site and performing UI tests), but with a number of selected options such as logging in via basic auth or normal forms auth, as well as the browser type, etc.
Is the specification design pattern best suited to this? Are there any other good strategies?
Thanks
...
hi, i've recently come across a producer/consumer pattern c# implementation. it's very simple and (for me at least) very elegant.
it seems to have been devised around 2006, so i was wondering if this implementation is
- safe
- still applicable
Code is below (original code was referenced at http://bytes.com/topic/net/answers/575276-prod...
What is the difference between Strategy Design pattern and State Design pattern?
I was going through quite a few articles on the web but could not make out the difference clearly. Can somebody please explain in layman's terms?
...
Is the following implementation, using lazy initialization, of Singleton (Meyers Singleton) thread safe?
static Singleton& instance()
{
static Singleton s;
return s;
}
If not, why and how to make it thread safe?
...
I have a number of classes that are all related conceptually, but some more-so at the details level than others. For example, these three classes have nearly identical properties (although member functions will vary):
public class RelatedA : IRelatedType
{
public string Name { get; set; }
public string Value { get; set; }
p...
I’m trying to refactor some “sending out an email” code by dividing the steps (validate, attach related content, format, send) into separate classes that can be more easily tested, logged, and updated.
As part of this I’ve got to figure out a way for the operations to communicate validation or transient errors (“that item was deleted”)...