I'm modelling a list of strongly typed database keys. Some will be ints, some strings, some guids etc.
EDIT They are strongly typed in the sense that some of the keys will contain integer values, some strings, some uids etc.
So if my class for the Key was "Key" and my list was List<Key> I'm looking for how to implement the strongly ty...
I have never read a clear explanation, what's yours ?
Update: I forgot decorator :)
...
Hi Everyone,
I have a video class, which can have many tags associated with it. A while ago, I read an article about a design-pattern(or perhaps it was just a standard way of doing this) which detailed the most efficient and accurate way of working out how similar two video classes are by looking at how many of the same tag records they ...
hi guys, please am a student working on a project to develop a visualization tool to analyse data using an mvc design in matlab. but the problem im having is that im new to programming and matlab is the first real programing im doing. ive pretty much done the codes but i fear they are no way in an mvc design pattern so i need to change t...
Hi all,
I am creating a custom control in WPF, it is the highly unoriginal example of a stock ticker that I am deriving from the Control type. My question is: Are there any recommnded design patterns for controls themselves (as opposed to the app)? I am using MVVM for the application as a whole but just wandered if it is good or bad pr...
I've implemented a small proof-of-concept app using Core Data to accept some object attribute values from the user via text fields and it's all working great thanks to information found here and in the iPhone Core Data Recipes app. But I'm at the point where I need to display object validation errors to the user and I can't find a recom...
In my current project, there are lots of Factory Methods,
so when the program begin it has:
Init()
{
RegisterFactory(A1);
RegisterFactory(A2);
...
//hundreds of Register.
...
}
Is there any other way to do this? It looks not reasonable.
...
Setting:
A pseudo-random pattern has to be generated. There are several ways / or algorithms availible to create different content. All algorithms will generate a list of chars (but could be anything else)... the important part is, that all of them return the same type of values, and need the same type of input arguments.
It has to be p...
In writing my current project, I have created interfaces for all of my objects. I thought that this was considered good coding practice.
I've basically ended up with a bunch of interfaces which define pretty trivial classes.
Eg:
public interface IUser
{
int Id { get; }
string DisplayName { get; }
}
I don't really see any po...
Possible Duplicate:
Examples of GoF Design Patterns
Currently studying patterns stuff, and this one lacks concrete examples. Would you help me to fill missing cells in a table illustrating design patterns with concrete examples from Java 6 SE/EE APIs?
In the end I'll update this table with your contributions. Thanks.
...
Hi all. This might be a little subjective, but I'd like to get your input on my current situation. I have a class that will be used to serialize/deserialize an object.
public class MyClass
{
public static string ToXmlString( MyClass c ) { /*...*/ }
public static MyClass FromXmlString( string xml ) { /*...*/ }
}
I only like th...
I need to implement Observer Pattern in ASP.NET MVC. Can anyone guide me where I can find the skeleton of the classes for this or can provide me a skeleton itself?
I need to apply this pattern with the clear separation of model, view and controller.
Thanks.
...
I am working on a personal project that uses a custom config file. The basic format of the file looks like this:
[users]
name: bob
attributes:
hat: brown
shirt: black
another_section:
key: value
key2: value2
name: sally
sex: female
attributes:
pants: yellow
shirt: red
There can be an arbitrary number of users ...
I've used the self-shunt unit testing pattern a few times over the years. As I was explaining it to someone recently they argued that it violated the SRP. The argument is that the test class can now be changed for one of two reasons: when the test changes, or when the method signature on the interface that the test is implementing change...
Hello SO
My application has a set of base classes derived from almost all the UI controls
XCombobox,XButton,XMenu etc. All these classes have some additional functionality apart from standard functionality (ex: Serialization capability)
I use all these controls in my test windows application.
I want to implement a concept similar to t...
I wonder why .NET framework doesn't have pair (Observer/Observable) interfaces similar to Java's feature?
EDIT:
yes i know about events and delegates but using those interfaces is a simple and bookish approach of this DP isn't it?
...
class Theme
{
function __construct()
{
}
function load( $folder, $file )
{
$theme_path = ROOTPATH . '/theme/' . $folder . '/' . $file . '.php';
require_once($theme_path);
return TRUE;
}
}
on index.php
<?php
require class.theme.php
$theme = new Theme;
$theme->load('site','index');
?>
...
I'm adapting Image Downloader from Google Android blog. I want ImageDownloader to be singleton since I'll be using it in multiple places in my application. I want also to be able to manipulate Bitmaps using different Strategies (eg. produce transparent bitmaps).
Context:
I want to be able to use ImageDownloader in one activity and set ...
In other MVP-related questions on SO, people talk about the Presenter keeping the state information (could be session state or UI state). What I'm wondering is, since state is basically "transient data", and the Model's purpose is to encapsulate data access, can't state be kept inside the Model? Are there any rules of thumb or pros/cons ...
I'm not doing much new development right now, but a lot of refactoring of older C# subsystems whose original requirements no longer support new and I'll add unexpected requirements. I'm also now using Rhino Mocks and unit tests where possible (vs 2008).
The dilemma for me is that to make the methods testable and mockable, I need to defi...