design-patterns

Are Multiple Iterators possible in php?

PLEASE CHECK ANSWERS by VolkerK too, he provided another solution, but I can't mark two posts as answer. :( Good day! I know that C# allows multiple iterators using yield, like described here: http://stackoverflow.com/questions/1754041/is-multiple-iterators-is-possible-in-c In PHP there is and Iterator interface. Is it possible to i...

Data access pattern, combining push and pull?

I need some advice on what kind of pattern(s) I should use for pushing/pulling data into my application. I'm writing a rule-engine that needs to hold quite a large amount of data in-memory in order to be efficient enough. I have some rather conflicting requirements; It is not acceptable for the engine to always have to wait for a full...

Advice on displaying and allowing editing of data using ASP.NET MVC?

I am embarking upon my first ASP.NET MVC project and I would like to get some input on possible ways to display database data and general best practice. In short, the body of my webpage will show data from my database in a table like format, with each table row showing similar data. For example: Name Age Position D...

UML Class Diagram for User Login

Hi, The diagram below is my very first attempt at creating a UML class diagram describing a user login into a website. I'm sure its a poor design and full of flaws, but I'm hoping to learn from you guys how you would design a simple login like this. I'm particularly interested in your use of design patterns and which patterns you woul...

What are the differences between enterprise software/architecture patterns and open source software?

I am mainly a business app developer and I hear terms like CQRS, ServiceBus, SOA, DDD, BDD, AOP a lot. My question is that do these patterns/practices exist only in the "enterprise" world? In contrast to the enterprise world is the open source community. Highly trafficked sites like Digg, LiveJournal whenever there is an article mentioni...

MVC and conditional formatting - strategies for implementation

Right now I am writing a simulation program which output is formatted according to certain factors. The question is in a MVC architecture, where is the conditional formatting to be taken place? What are some strategies for implement this feature? FYI, The platform I am using is rather bare-bone in its GUI/front-end execution. To change ...

How do i structure my SQL Database (tables, Schemas, users, stored procedures etc.) to prepare it for an n-tier architecture ?

I think the title is self explanatory. What I'm looking for is material so I can further my knowledge. I've never developed a full application before so building one from scratch is a bit overwhelming for me. And the first bump in the road is the database. Websites, articles, books, elaborate answers, anything will do as long as they ...

How to design the application to conform to the n-tier architecture? (Winform sample in .net with linq?)

Rather a simple question. But the implications are vast. Over the last few weeks I've been reading a lot of material about n-tier architecture and it's implementation in the .NET world. The problem is I couldn't find a relevant sample for Winforms with Linq (linq is the way to go for BLL right?). How did you guys manage to grasp the n-...

Is this physical collection class that contains only static methods an Anti-Pattern?

I'm trying to figure out if I should continue on with a current pattern in an application I'm working in, or refactor this into something else. I have a set of collection classes off a generic base of List. These classes have public constructors but contain only static methods that return collections. They look like this: public class ...

Is there a memory and performance hit taken from using Bloch's Builder Pattern?

What is the memory and performance usage compared to creating a object with only a constructor? The usage here is in creating a Set<Object> or List<Object> that may contain million plus entries and I am concerned with the overhead of using Bloch's Builder Pattern. I have used it in the past, but never in this large of a scope. Refer...

MVC repository pattern design decision

I have an asp .net MVC application and recently started implementing the repository pattern with a service validation layer, much like this. I've been creating one repository/service for each model that I create. Is this overkill? Instead, should I create one repository/service for each logical business area that provides CRUD for many ...

How to design WCF Contracts?

We are designing a WCF layer which can be invoked either by a Asp.Net or a WinForm application. Our Application contains too many Entities. We have basically two choices. If we design WCF Contract around these entities then we get too many Contracts e.g IPartyService, IUserService, IPaymentService etc. So, I may end up with 30-40 Contr...

Composite + Chain of Responsibility example

Hello! Can anyone give a practical example of using the design patterns Composite and Chain of Responsibility together? Thanks ...

Best approach for OOP Class relationship design

I have got a designing dilema. I have a class named UserAccount that represent a user that has the ability to log into a school system and access information like the courses he/she is taking, avatar, news, etc. Then there is another class named Course that represents any course given in this school. It holds information like the amount ...

ASP.NET MVC - Should I use the Repository Pattern to write ViewModels to the database or convert them to Models first?

In my ASP.NET MVC app, I have a fairly complex edit page which combines a number of models into one view. I'm using the ViewModel pattern to combine all of this information and present one cohesive object to the View. As an example, my ViewModel structure is something like this: CompanyId CompanyName List<Employee> Employees List<Cont...

RCW and .Net Design Pattern

Hi As we know that . net creats rcw when adding a com component so evenrything look like .net class from a developer perpective so this leads to a design question in my mind , which design pattern .net uses to do this conversion? ...

What problem/s does a Rule Engine Algorithm solves?

What problem/s does a Rule Engine Algorithm solve? Which are the recommended ones? ...

Why would it be a bad idea to have database connection open between client requests?

1) Book I’m reading argues that connections shouldn’t be opened between client requests, since they are a finite resource. I realize that max pool size can quickly be reached and thus any further attempts to open a connection will be queued until connection becomes available and for that reason it would be imperative that we release con...

[WPF] When Should I Retrieve Values from Textbox?

Suppose I have a Window with TextBoxes I want to use the values. Right now I'm thinking of either: 1) Updating each associated value once the cursor is out of focus, and once the user presses Ok I start the program 2) Once the user presses Ok, I retrieve all the values at once then start the program I'm not sure which one is better tho...

Best practice for passing configuration to each GUI object

Hi, I am writing an application, where I do have few different windows implemented, where each window is a separate class. Now I need somehow to pass a single configuration object to all of them. My GUI is designed in way, where I have one main window, which may create some child windows of its own, and these child windows can have thei...