design-patterns

MVC - Cocoa interface - Cocoa Design pattern book

So I started reading this book: http://www.amazon.com/Cocoa-Design-Patterns-Erik-Buck/dp/0321535022 On chapter 2 it explains about the MVC design pattern and gives and example which I need some clarification to. The simple example shows a view with the following fields: hourlyRate, WorkHours, Standarthours , salary. The example is dev...

Why are AbstractQueue and AbstractList Disjointed?

During my C learning days, when I had implemented a Queue, I implemented them on top of a LinkedList. So essentially I had two pointers (front and rear) for the Queue operations on top of LinkedList, or better one front pointer on top of a CircularLinkedList. I am learning the Java Collections Framework, and I observe that the design ha...

How do I write a Java text file viewer for big log files

I am working on a software product with an integrated log file viewer. Problem is, its slow and unstable for really large files because it reads the whole file into memory when you view a log file. I'm wanting to write a new log file viewer that addresses this problem. What are the best practices for writing viewers for large text file...

Create inherited class from base class

public class Car { private string make; private string model; public Car(string make, string model) { this.make = make; this.model = model; } public virtual void Display() { Console.WriteLine("Make: {0}", make); Console.WriteLine("Model: {0}", model); } public string M...

Pattern for version-specific implementations of a Java class

So here's my conundrum. I am programming a tool that needs to work on old versions of our application. I have the code to the application, but can not alter any of the classes. To pull information out of our database, I have a DTO of sorts that is populated by Hibernate. It consumes a data object for version 1.0 of our app, cleverly ...

Java Polymorphism - Selecting correct method based on subtype

Hi Given the following Class and Service layer signatures: public class PersonActionRequest { PersonVO person // ... other fields } public class MyServiceLayerClass { public void requestAction(PersonActionRequest request) { PersonVO abstractPerson = request.getPerson(); // call appropriate executeAction met...

Observer pattern and violation of Single Responsibility Principle

I have an applet which repaints itself once the text has changed Design 1: //MyApplet.java public class MyApplet extends Applet implements Listener{ private DynamicText text = null; public void init(){ text = new DynamicText("Welcome"); } public void paint(Graphics g){ g.drawString(text.getText(), 50, 30...

where should we send notification for updating many views?

Hi all, I want to ask about software design. I have a task, the view controller handles UI event for calling a model manger to perform that task. After finishing, the model manager will callback to update the view. There have also other view controllers who care about that task, and also want to update its own view when that task is fi...

Comparing Design Patterns

Hi, I am learning design patterns using C#. One of the challenges that I am facing is that they look similar. Could you please help me to distinguish them – basically when to use them? - Why not the other? Bridge and Strategy State and Strategy Façade and Strategy Composite and Strategy I understand that there are lots of resources...

How to store the path of a game pawn in a turn based game ?

Hello, I have a square grid, for a turn based game ( grid is similar to the chess board ), but the moves in the games are different based on whether you have lapped your opponent pawn at least once or not. i.e if you have not lapped (beaten any of the opponents pawns) in the outer most grid as below if you have lapped your opponen...

How build my own Application Setting

I want to build a ApplicationSetting for my application. The ApplicationSetting can be stored in a properties file or in a database table. The settings are stored in key-value pairs. E.g. ftp.host = blade ftp.username = dummy ftp.pass = pass content.row_pagination = 20 content.title = How to train your dragon. I have designed it as fo...

Design Layout/Patterns

I am still fairly new to C# and I am trying to decide the best way to structure a new program. Here is what I want to do and I would like feed back on my idea. Presentation Layer Business Layer (Separate Class Library) Data Layer (Separate Class Library) Model Layer (Separate Class Library) What I am struggling with is if it is ok ...

Best practice to modularise a large Grails app?

Hi all, A Grails app I'm working on is becoming pretty big, and it would be good to refactor it into several modules, so that we don't have to redeploy the whole thing every time. In your opinion, what is the best practice to split a Grails app in several modules? In particular I'd like to create a package of domain classes + relevant s...

Simple code implementation of some architectural patterns

Hi all, I was wondering if anyone knew of any simple code implementations of the following architectural patterns (in Java or C#): * Blackboard (passive & active) * Presentation Abstraction Control (PAC) * MVC Thanks in advance ...

iPhone development - app design patterns

There are tons of resources concerning coding on the iPhone. Most of them concern "how do I do X", e.g. "setup a navigation controller", or "download text from a URL". All good and fine. What I'm more interested in now are the questions that follow the simpler stuff - how to best structure your complex UI, or your app, or the common pro...

How to avoid having very large objects with Domain Driven Design

We are following Domain Driven Design for the implementation of a large website. However by putting the behaviour on the domain objects we are ending up with some very large classes. For example on our WebsiteUser object, we have many many methods - e.g. dealing with passwords, order history, refunds, customer segmentation. All of the...

Shouldn't ObjectInputStream extend FilterInputStream?

The block quotes are from the Java Docs - A FilterInputStream contains some other input stream, which it uses as its basic source of data, possibly transforming the data along the way or providing additional functionality. A DataInputStream lets an application read primitive Java data types from an underlying input ...

Looking for design patterns to isolate framework layers from each other

Hi, I'm wondering if anyone has any experience in "isolating" framework objects from each other (Spring, Hibernate, Struts). I'm beginning to see design "problems" where an object from one framework gets used in another object from a different framework. My fear is we're creating tightly coupled objects. For instance, I have an appli...

How to learn design patterns and use them in practice

Already tried: dofactory Sourcemaking+their video "GOF" book "Head First Design Patterns" book But still have problems with implementation scenarios on practice. Maybe i have too little experience? (almost 2 years using C#) Or maybe there are other resources or some methods to learn to see them? ...

Is Design Pattern only for Object-Oriented design?

I was wondering if all design Patterns are only used in Object-Oriented design? Are there any design patterns used in non Object-Oriented design? Thanks and regards! ...