I'm working on a website where I sell products (one class Sale, one class Product). Whenever I sell a product, I want to save that action in a History table and I have decided to use the observer pattern to do this.
That is: my class Sales is the subject and the History class is the observer, whenever I call the save_sale() method of th...
Hi -
I don't have a specific question here but I'm more looking for some guidance regarding a new software project I'm starting at work.
Here is a description of the project:
I am refactoring windows software that was written in Visual Basic 6 and uses MS SQL Server for a database. The code is tightly coupled with SQL queries and refe...
Hello all,
Im looking for a design document (templat) for smart-phone applications, I don't really mind which platform, because it should be easily transferable! I am aware that there are lots of widget & icon design guide lines available but I am also looking for some more high-level, well-rounded design such as use-case, uml diagrams,...
I can't seem to find any examples on the web on J2ME apps with multiple "forms" or screens. What is the best pattern to handle multiple screens in a MIDlet and keep the memory consumption low?
Here's a sample display structure (any can be a form or plain canvas with custom items),
Main Menu
- Sync
- Settings
- Item
...
I have an app that has subtle differences depending on where it's being viewed.
Variations to business logic & view styles are fine - this is all handled through dependency injection & CSS respectively.
However, where I'm coming unstuck is with small variations on view layout / elements.
For example - if a user is running our applicat...
When seeking advice on good programming practices the typical answers are a variation of agile software development, test driven development or design patterns. However, as far as I know, neither of these are proven using the scientific method (if I'm wrong on this then feel free to correct me).
I wonder, are there any good resources on...
I'm having a design issue I could use some advice on. Let's say we need (how original...) Employees in our new application. What I would normally do is something like this:
public interface IEmployee
{
string EmployeeId { get; }
string Name { get; }
void Update(string newName, ...);
...
}
public class Employee : IEmploy...
Hi!
i am trying to create framework/library /API for creating small multiuser games, in which the goal is to achieve 'decoupling' between the server, client and business logic.
The server in my case is kind of registering the clients and sent that
list to business logic, clients are registering with the server,
and the business log...
Before you tell me that there is already a similar question, yes, i know, I've read it.
But the question there focuses on when, I'm interested in why.
I get how the things work. The classic animal,dog,cat example always works like a charm.
The thing is this code
int main()
{
Cat c;
Sound theSound;
c.letsDo(&theSound);
}
...
Hello:
It may seem as if this is question is a dupe, but please bear with me - I promise I've read the related posts (and the GOF book).
After everything I've read, I still don't have it clear when to use an Abstract Factory, a Factory Method, or a Builder. I believe it will finally sink in after I see a simple example of a problem wh...
I recently discovered that UIViews should only have UIViewControllers when they fill the entire window (or are managed by another UIViewController such as a UINavigationController or UISplitViewController). This quotation is from the documentation for UIViewController:
You should not use view controllers to manage views that fill only ...
In Refactoring to Patterns the author replaces the conditional logic by having the client use Loan factory methods where each uses the appropriate Strategy for the given arguments. However, I feel like it has passed the conditional logic code to the client, which must choose based on the arguments which Loan factory method to call. Isn't...
I'm using a tool to automatically generate a class representation of a hierarchically organized XML file. The XML file is a settings file my app need to be able to access (read-only).
If I pass in the top-level node (e.g., AppSettings) to a class that needs to access one or more settings, I can easily end up with code that looks somethi...
I'm currently writing an AI for a game that is written in c++. The AI is conceptually fairly simple, it just runs through a decision tree and picks appropriate actions. I was previously using prolog for the decision engine but due to the other developers using c++ and some issues with integrating the prolog code I'm now trying to port it...
I have a static class which I use to get access to my public properties (global for whole app) and methods which I use during application run. For example I set some property in static class and during app run time I can get value from property.
But I can create non static class with singleton pattern and use it in the same way.
Questi...
I am developing a C# application where the majority of the code base is in C# class libraries. I want the application to support saving and loading of XML based project files and be able to determine if any modifications have occurred since the last save.
My current design idea is:
Each class that needs to store settings implements IX...
Consider this example
The Interface
interface IBusinessRules
{
string Perform();
}
The Inheritors
class Client1BusinessRules: IBusinessRules
{
public string Perform()
{
return "Business rule for Client 1 Performed";
}
}
class Client2BusinessRules: IBusinessRules
{
public string Perform()
{
re...
Hi,
I have a class e.g. MyDataClass.
I have a HashMap<String,MyDataClass> myMap;
For each reference in the myMap, I also have some other MyDataClass references to the same object. To be specific:
MyDataClass c = new MyDataClass();
//configure c object with appropriate values
myMap.put("akeyvalue",c);
MyDataClass ref = c;
At this poin...
The reason I'm asking is tvanfosson's (first) comment to his answer to another question of mine where he said (about ASP.NET MVC): "The lack of server-side controls is due to the inherent separation of concerns that makes MVC a good development pattern..".
I surely know ASP.NET server controls, and I think I know MVC design pattern, but ...
I need some advice to which scenarios a dynamic proxy would prove more useful than a regular proxy.
I've put alot of effort into learning how to use dynamic proxies effectively. In this question, set aside that frameworks like AspectJ can perform basically everything we try to achieve with dynamic proxies, or that e.g., CGLIB can be us...