Currently working on a project, new product, using MVC. I've written a few of these, and I've found doing a repository pattern with "specialized" generic services (GetObjectService< T >, UpdateObjectService< T >, etc). This allows for those special instances of "hey, I need to get something based on this stuff" that's fairly complex an...
Hi all,
Over the past few weeks, I have been creating a sort of text-based adventure game revolving entirely around the actions of a player. The general idea is that there is a Simulation class that maintains the state of the world, and is the responsibility of the SimulationController (ie, the player) to keep actions going. Most of t...
There are various discussions about whether to use Flash, Silverlight or HTML5. When it comes to Silverlight, it has very different programming experience (more of a desktop model), and this makes it reasonable for Silverlight applications to use MVVP presentation pattern.
But when it comes to pure HTML5-based Web application, is there ...
Just trying to get some opinions on whether or not CommandHandlers can/should communicate with other CommandHandlers.
Here is a simple case I just ran into. I have a ChangePasswordCommandHandler who's command looks like the following:
public class ChangePasswordCommand : Command
{
public string Email { get; }
public string OldP...
In a scenario like below where an object needs to be intantiated based on some conditional logic, can the factory method pattern help to avoid client code getting cluttered due to number of if/elseif conditions (which would also be a maintenance nightmare if more and more products needs to get created due to different variations of logic...
How to do it? What design patterns? Ideally would be sample code in the answer.
...
Which is the best book to learn and implement Design patterns available in the industry with examples? like Creational Patterns,Structural Patterns, Behavioral Patterns ?
...
I've reached a bit of a problem in my app and I'm not sure how best to resolve it.
I'm using Linq to Sql and I have a domain object which wraps the Linq object so I don't directly expose Linq objects to my front end.
So I have something like:
class MyOrder : IOrder
{
Order _order; // this is the Linq entity
public MyOrder(Or...
Okay, to give a little background, I learned WPF about 3 years ago and have kept reasonably up to date with what's happened since in various different versions. I looked at (and implemented) MVVM on a couple of projects, had a good look at frameworks like Prism so I think I'm pretty well versed in most areas of the framework. I've also...
Some I'm reviewing some code within my team's code base, where we traverse over one hierarchical data structure and build a new data structure from it. There are no nested loops -- every level of the hierarchy has its own dedicated function.
So we have code like this:
public void DoA(A a, Transform transform)
{
foreach(B b in a)
...
When should we use the Singleton pattern and why?
...
I am working on a rewrite of a very old Perl project. This project for employee performance evaluation. Every year an employee will be evaluated by his supervisor(s).
The project was first put into use in 1994 using mysql. In 1995, a new mysql database was created for 1995 evaluation and the source code was modified. Then 1996, 1997, ....
In the same way a web or desktop app might have 3 or n tiers - UI, Business, Data for example - what is the suggested structure for an Android application? How do you group classes together, what layers do you have etc?
I'm just starting Androi dev (an internet based app that must respond to incoming notifications) and have no real fee...
I often find that design patterns, libraries, and frameworks promise great things and sound awesome - until you actually study them and realize that what they say sounds better than it actually is.
Completely modular and stackable - use
only what you need!
For example, how do you properly Unit Test your database if your applica...
Apparently this key-oriented access-protection pattern:
class SomeKey {
friend class Foo;
SomeKey() {}
// possibly non-copyable too
};
class Bar {
public:
void protectedMethod(SomeKey); // only friends of SomeKey have access
};
... doesn't have a known name yet, thus i'd like to find a good one for it so we can refe...
Can we increase the re-usability for this key-oriented access-protection pattern:
class SomeKey {
friend class Foo;
// more friends... ?
SomeKey() {}
// possibly non-copyable too
};
class Bar {
public:
void protectedMethod(SomeKey); // only friends of SomeKey have access
};
To avoid continued misunderstandings, ...
Say if I want to extend the functionality of a range of objects that I cannot change - for instance for adding formatting, and don't want to derive a huge amount of classes to extend the functionality - would the following considered bad? (I'm using int and float as an example, but in my program I have about 20 or 30 classes that will e...
Hi,
In reading about the Observer design pattern, I noticed that it is implemented using interfaces. In Java, the java.util.observable implementation is also a class. Shouldn't the C# and Java versions use interfaces ?
Scott
...
Hi,
I know that MVC is highly acclaimed for PHP applications, but I am not sure at all that it fits in JavaScript. If you think otherwise, then please explain how and where you handle common scenarios like AJAX requests, data saving (offline storage), presentation, how do you handle controller logic (do you have a front controller?), an...
I have a reasonably large set of strings (say 100) which has a number of subgroups characterised by their similarity. I am trying to find/design an algorithm which would find theses groups reasonably efficiently.
As an example let's say the input list is on the left below, and the output groups are on the right.
Input ...