design-patterns

How do you call this pattern?

What do you call the design where the object's constructor is responsible for all/any subsequent actions. Usage of this class involves simply creating an instance and then it's all fire-and-forget. A silly example: public class Order { public Order(int ammount,Product type) { Ammount = ammount; Namespace.OrderMana...

overview/understand architecture codes in eclipse

I have a maven project imported into Eclipse. I'm trying to understand the code pattern (architecture). What is the best way to do this? will use any UML Eclipse plugin help on this? will use sequence diagram, help on this? what plugins should I use? Please share your opinion. ...

How to handle a collection of singletons?

We have the following class hierarchy: public interface IManager { object GetObject(int); } public class BaseManager : IManager ... public class XManager : BaseManager { ... public static XManager Instance; } public class YManager : BaseManager { ... public static YManager Instance; } public static class ManagerFacade...

Design patterns for functional-oo hybrid languages?

Is there already any collection of best practices for languages like Scala? I've found a work on design patterns for functional languages here. There's GoF design patterns for oo languages. But are there any patterns for functional-oo hybrids? All I've seen is this list. Does anyone know any more? ...

Cocoa/Iphone dev - target/action mechanism

Hi, I started learning Iphone development. As i'm reading about the cocoa development framework, few principal notions came around and with it a little bit of confusion. I want to make sure I understand things right and to get a little clarification : Delegate - basically the strategy design pattern. I set my class delegate and data so...

What is the best-practice way to use Linq-to-SQL in a C# application? [Design-pattern]

OK, I'm always trying to improve the way I code because it's my passion. I have a .dbml file (linq-to-sql) and I use it to access my MS SQL database. Imagine, if you will, that you have a Person table in your database and you want to provide a way to delete,add,modify a Person record. The way I'm handling things currently is creating ...

Mobile Development Architecture & Design Patterns

I need some links on various mobile development architectures and design patterns, for example, in iPhone Development MVC is been used, same like this, what are the various other architectures which are being used in mobile application development. ...

State pattern: why states are not Singletons?

I've used the State pattern to implement a simple finite state machine. Looking at the description given on Wikipedia, and more specifically at the suggested Java implementation, I wondered why classes implementing the State interface (i.e. the various states) are not Singletons? In the suggested implementation a new State is created wh...

Understanding the differences between Table and Transaction API's

Friends, This Ask Tom thread which I found via another SO question, mentions Table and Transactional API's and I'm trying to understand the difference between them. A Table API (TAPI) is where there is no access to the underlying tables and there are "getters" & "setters" to obtain information. For example to select an address I ...

When should developers read and learn about design patterns?

Hello Folks, I want to know when should developers read and learn about design patterns? Is it in junior, senior, or beyond senior level? This question is very fuzzy one for me. ...

What object handles switching views in a desktop MVC app?

In a desktop application that uses MVC, what object should be responsible for switching from one view to another? A controller at the next highest level of abstraction? (Conceptual question not particular to language/platform.) ...

How to design configurable MVC panels?

I have to make a web application that produces pages that contain panels with different setting configurations for different sites the page is hosted under. For example, SiteA.com has a search panel with 3 select dropdowns and SiteB.com can have a search panel with 4 select dropdowns. Can anyone offer any advice on how I could proceed...

Java - Should I use a field or a class for the problem as follows:

I have two tables in the DB FuelStation (fuel_station_id: int (PK), fuel_station_name: varchar, fuel_brand_id: int(FK)) FuelBrand (fuel_brand_id: int (PK), fuel_brand_name: varchar) As we can see, both tables are linked via. foreign key (fuel_brand_id) Now, I want to design an object model corresponding to the above data model but I...

Turning my inherited classes in an Abstract 'factory' C#

Hi all, I'm not really pro and find my question quite hard to describe, so please ask if anything is unclear: I have an abstract class called BaseDevice. Other devices, as Beacon and Transponder, inherit from BaseDevice. For example the Beacon, it has the BaseClass methods PLUS its own properties and methods. Let's say, the difference ...

Is the Single-Element Enum Type Singleton really a widely adopted good idea?

Item 3 of Josh Block's Effective Java (Enforce the Singleton Property With a Private Constructor or an Enumerator) mentions that "While this approach has yet to be widely adopted, a single-element enum type is the best way to implement a singleton." Example: public enum Elvis { INSTANCE; private final String[] favorite...

using ScheduledExecutorService to start and stop timer

From my readings, it seems that ScheduledExecutorService is the right way to start and stop timers in Java. I need to port some code that starts and stops a timer. This is not a periodic timer. This code, stops the timer before starting it. So, effectively every start is really a restart(). I am looking for the right way to do this usin...

Observer design pattern and C# event delegate model

It seems that the observer design pattern is in built in C# through its event delegate model. Is there any reason where I may have to implement it in the classical way? regards 123Developer ...

Code vs. configuration for game object library

I'm working on a small online game where there is a need to store a reasonable amount of information about many (100+) different kinds of game objects. I'm trying to decide whether to have this data generated by code or stored in some configuration file. Data generation approach would be something like (in java-ish pseudo code): (wit...

mvc approach for cms application

Hello I have been tasked with creating a fairly complex web application in php, it is to be a custom CMS that would be able to replicate the functionality and features provided by well known content management systems like WordPress, Joomla or Drupal. I am to try and integrate as much of the functionality that these well known and powerf...

How should toolbars, menus, and their commands be implemented in a desktop application?

At a conceptual level (not platform/framework specific), how should components like toolbars and menus (and the commands they contain) be implemented in a desktop application that uses the MVC pattern, with minimum coupling & maximum code reuse? ...