design

Single Responsibility Principle(SRP) and class structure of my rpg looks "weird"

I'm making a role playing game just for fun and to learn more about the SOLID principles. One of the first things I'm focusing on is SRP. I have a "Character" class that represents a character in the game. It has things like Name, Health, Mana, AbilityScores, etc. Now, normally I would also put methods in my Character class so it would ...

Techniques to Reduce Complexity in Game Programming

In my spare time I program games as a hobby, different sorts of things and currently nothing very complex. Things likes 2d shooters, Tile-Based games, Puzzle Games, etc... However as the development of these games goes on I find it becomes hard to manage the complexity of different subsystems within the games, things like Interface, Wo...

Who should format my data for display ?

I have a django view, and this view returns a table which is populated asynchronously with an ajax call. From the design point of view, which one should I follow: the django view, called via ajax, returns the content of the table as a json response, containing html markups for each cell. The javascript callback handler takes the cont...

Use of events for modifying domain objects

I'm trying to understand when it is appropriate to use events. It seems to me that an event can be thought of as an SQL trigger. Then, is it correct to use an event triggered by one domain object to modify another, or will it imply lack of a well thought out design if we use events to modify other object's states? Or should there be a me...

Why use output buffering in PHP?

I have read quite a bit of material on Internet, where different authors suggest using output buffering. The funny thing is that most authors argument for its use because it allows to set HTTP response headers while also generating response output. Frankly, if for no other reason, I think that responsible web applications SHOULD NOT mix ...

Does TDD mean not thinking about class design?

I am making a role playing game for fun and attempting to use TDD while developing it. Many of the TDD examples I see focus on creating the test first, then creating objects that are needed to get the test to pass. For example: [Test] public void Character_WhenHealthIsBelowZero_IsDead() { // create default character with 10 health ...

Solutions for many markers in the same coordinate, Google Map mashup

I am making a mashup where thumbnails will be shown over a google map. The problem is that many thumbnails will share the same coordinate. So if I plot them like markers, they will be one on top of the other. Have you seen any creative solution for this problem? Thanks ...

NHibernate Design For WinForms

How should I have the NHibernate Session Factory and the sessions for a WinForms application? Should the SessionFactory be a singleton? Or can I create it every time? What about sessions and transactions? Any help would be appreciated. Thanks ...

OOP software design problem

There are two classes:A and B. And I need to implement a function whoViewed, I have two options,make it an member function of A and B.Which smells a little duplicate. Another choice is to make it a separate class:Viewer,but it's more abstract. If you were me,which way will you choose? To make it more general: what will you do when ...

Visualizing multiple simultaneous progress bars

My application framework provides a progress reporting service to plugins. Each plugin can request any number of task monitors and is then responsible for updating the status includes a textual message, percentage progress (or indeterminate). Process monitors are free to switch from discrete percentage / indeterminate at any time. What ...

Tab structure best practices

Hi, When developing a WinForms app that will utilize a tab control to display different sets of data, is it best to add all my controls to the tabs directly, OR create user controls, add my controls to the UC and add the UC to each of the different tabs? I was informed that the UC approach is best practice, and I understand some of the...

Database resiliency

I'm designing an application that relies heavily on a database. I need my application to be resilient to short losses of connectivity to the database (network going down for a few seconds for example). What is the usual patterns that people use for these kind of problems. Is there something that I can do on the database access layer to h...

WCF service design question

Is it ok from your real-world-experience to define service contract with one method which will accept some object as a form of request and return some other object as a result of that request. What I mean is instead of having method for creating, deleting, editing and searching customers I would have these activities encapsulated within ...

Can OSGi help reduce complexity?

I saw lots of presentations on OSGi and i think it sounds promising for enforcing better modularization. Apparently "hotdeployment" and "running different versions of x in parallel" are mayor selling points too. I wonder whether what OSGi promises to solve is even an issue...? It reminded me of the early days of OO when similar claims w...

design pattern in Compact framework

Hi All, I have been working on Web application so far and has just got an opportunity to work ong Microsoft Compact Framework. i am pretty new about the framework. In ASP.net application I have been following some of the predefined Design patters and sometimes frameworks like CSLA.net or Factory/Abstract Factory. Now while looking at t...

How can I learn to create beautiful infographics (with connection to my R knowledge)?

Hello all. I am a devoted R (r-project.org) user, and love infographics. I just came across this article: http://www.noupe.com/design/fantastic-information-architecture-resources.html Giving a long list of resources for information designers. And it raised in me the desire to do more beautiful (not just informative) R plots. Do you have...

Calculate scrollbar height according to amount of hidden contents

I'm creating a graphical scrollbar so I need to calculate the scrollbar height manually. You know how in most applications the scrollbar height changes based on how much there is to scroll? What is the formula for calculating the scrollbar height based on the amount of hidden contents? Is it logarithimic or exponential or just plainly b...

How can I extend the background of an element beyond its container?

I have a div that contains an h3 tag, and i want the h3's background to extend beyond the containing div tag to the edge of the page. Is there a way to do this in CSS? I considered absolutely positioning the h3, but I don't know the size from the edge of the screen to the edge of the div (where I want it to be) since the div is centered....

How to determine if your code is overstructured or understructured?

What are some indicators or factors in determining if your code is over-structured or under-structured? Edit Perhaps over-engineered / under-engineered would be close to synonymous for over-structured/under-structured. How do you find a balance? This post refers to any language. ...

UML - class model question

Hello, I have started to study UML standard and would need little help with two things I cannot find. I understand that in the class model I should design classes and their relations like: Customer<>--->(*1)Items ordered 1)Is it correct that we design only "our" custom classes and do not care about classes used inside like Dictionary,L...