I know a similar question has been asked but I feel as though the example wasn't specific enough for me.
Basically I have a Website which utilises a service which supplies various error codes, coupled with this I have errors which can be generated via the Website itself.
Based on errors which can occur, I want to display an approp...
Is this a good pattern? It has a code smell to me with having a factory class aware of the IUnityContainer...
My basic need was to resolve an ICalculationRuleProcess at runtime depending on an Id of a class. It could be based on something other than the Id, I am aware of that... basically I have a known set of Ids that I need to deal ...
I understand the benefits of three tier architecture ( for example, changing code in one layer doesn’t usually affect code in other two layers ), but I don’t understand why it would be bad idea for UI layer to ( in certain circumstances ) directly access the `data layer.
a) I can think of few reasons why UI should only talk to BLL laye...
I'm writing a painting/graphics Java application for a mobile phone (so memory is limited). The application state is essentially three 1000x500 bitmaps (i.e. layers of a painting). Loading three bitmaps takes about 2 or 3 seconds.
I'm trying to write an undo engine but I just cannot work out a good way to do it. The typical approaches a...
Hi, would it be considered bad practice to return different types from the same method in php. Maybe there is a best pattern for this but essentially i want my method to do something and if it fails return a string error message but if it works then return true. This doesnt seem quite right to me but the only other way i can see to make...
I am building a tool. I have a Collection Class that stores data gathered from files on network. (Why? because reading from network files was more time consuming than reading all data at once and storing data into an object)
I need to use the same instance in various different classes.
I looked over the pro's and con's of Singleton Clas...
I am sorting the UITableView by using a predicate with NSFetchedResultsController. But, when I make a change in a detail view and save it, the object I changed immediately gets placed in its new location in the UITableView.
I have up/down buttons similar to the message view in Mail. This behavior disrupts the ordering of items, and I'd ...
What classes in the .net framework implement the various design patterns like decorator,factory etc?
...
Hi I am new to design pattern and apologize if this question is creating any confusion although i am trying to describe the issue in best possible way.I have implemented sample abstract factory pattern in winforms. Front end contains two check boxes to create the objects. Note: If both the check box are checked, both the objects are crea...
hi all,
I'm new to the all DI pattern idea and i have some basic design doubts.
im using Unity application blocks 2.0 as my DI framwork.
To the questions :
Say I have an interface for HW devices named IDevice.
And some HW listener that receives such IDevice.
Now say you have several HW Devices that implement IDevice and Several Liste...
I was coding some stuff on objetive c.. but I still dont get it, I dont know/understand what a delegate is at all.
Maybe cuz my main programming language is C++ and Java... dont know.
I searched the web looking for an ENGLISH explanation, but, seems like I dont speak english :)
...
I've noticed that some programmers like to make interfaces for just about all their classes. I like interfaces for certain things (such as checking if an object supports a certain behavior and then having an interface for that behavior) but overuse of interfaces can sometimes bloat the code. When I declare methods or properties as public...
I'm familiar with the use of the context object design pattern - a lightweight context wrapper around objects passed between tiers.
If one were to use the context object to track taint (untrusted user input), or the origin tier, I could see how a receiving tier could dynamically filter, encode, or validate accordingly.
For example:
A ...
The more I get into writing unit tests the more often I find myself writing smaller and smaller classes. The classes are so small now that many of them have only one public method on them that is tied to an interface. The tests then go directly against that public method and are fairly small (sometimes that public method will call out to...
I would like to validate some objects. The validation has two parts:
validation whether the user has right to access the object (the specific rights are already calculated and stored in boolean values, there are maximum 4 roles)
checking if the object is in a certain state (from a set of states)
I have a lot of rules (actually around...
Hello to all, i have wrote the visitor pattern as follow but i don't understand what is single and double dispatch.
AFAIK, single dispatch is invoke a method based on caller type where double dispatch is invoke a method based on caller type and argument type.
I guess double dispatch is happen in single class hierarchy but why visitor ...
I have a web service which provides an interface to query data. I am writing a WPF application using MVVM. I am working on creating a repository that my View Models can use to retrieve models. The repository will call the Web service to fetch data, when required.
I would require various Find methods in my repository that finds the data ...
Hello everybody
In below example, i defined number field. This field will work as i wanted but it is not enough efficient to provide my expectations.
number value is fixed value for each class,number is not dependent instances and number support polymorphism. How can i do that ? Or is there another solution for not use unneccesary numb...
I'm writing a painting program. My basic classes are:
class Workspace { Bitmap b; List<Command> undoList; }
class Command { void execute(); }
class ClearScreen extends Command
class BlurEffect extends Command
class View { Bitmap screen; }
class Interface
The workspace object holds the bitmap which represents the progr...
I just read a book on object-oriented programming patterns. It describes a Factory pattern by which you can make a call to a static factory method of an object and the object will return a new object of expected type, but it will be subclassed appropriately.
My question, can this functionality be provided by a constructor for the cla...