I’m in the process of creating a large single-page web-app using ext-js for the UI components with Rails on the backend. I’ve come to good solutions for transferring data using Whorm gem and Rails support of RESTful Resources.
What I haven’t come to a conclusion on is how to structure the UI and business logic aspects of the applicatio...
Hello Stackoverflow
I have a code design question that have been torbeling me for a while, you see I’m doing a refactoring of my website Cosplay Denmark, a site where cospalyers can upload images of them self in their costumes. The original site was done in php, Zend MVC, but my refactoring is being done in ASP.NET MVC 2.
If you take t...
Hi,
I am getting back again and again to it thinking about the best way to perform validation on POCO objects that need access to some context (ISession in NH, IRepository for example).
The only option I still can see is to use Service Locator, so my validation would look like:
public User : ICanValidate {
public User() {} // We n...
Hello, I am using .NET 2.0 & C# to develop a WinForm Mdi application. It will have a Main Window and a lot of mdi windows. I am thinking I should use which design pattern to manage mdi windows. Because I want only one instance for each window, if window is existed, I will show it on top, & otherwise I will create and show it.
Note: a md...
class Foo
{
Bar b;
List<Foo> Neighbours;
}
class Bar
{
Spam s;
List<Bar> Neighbours;
}
class Spam
{
List<string> Neighbours;
}
Each of these classes have AddNeighbour,RemoveNeighbour methods.
User can add/remove Neighbours from any of the class at random.
I want these three objects to be in sync.
How can I do ...
Me and my colleagues got into this discussion early this morning, and our opinions started to clash a bit, so I decided to get some impartial advice here.
One of my colleagues reckons that the DAO should return an object (populated bean). I think it's completely fine when you're returning a recordset with only one line, but think it's o...
I have a system which breaks a large taks into small tasks using about 30 threads as a time. As each individual thread finishes it persists its calculated results to the database. What I want to achieve is to have each thread pass its results to a new persisance class that will perform a type of double buffering and data persistance whil...
I was just looking into the source code of an existing project which uses nHibernate and found that there are interfaces created for each entity classes. E.g ICustomer for Customer class. I was just wondering what can be the advantage of this pattern as ICustomer contains mainly the properties and very few methods.
...
I am struggling to understand how I should design the error handling parts of my code. I recently asked a similar question about how I should go about returning server error codes to the user, eg. 404 errors. I learnt that I should handle the error from within the current part of the application; seem's simple enough.
However, what shou...
I've learned enough to begin writing programs from scratch, but I'm running into the problem of not knowing how to design the layout and implementation of a program. To be more precise, I'm having difficulty finding a good way to come up with an action plan before I dive in to the programming part. I really want to know what classes, met...
I'm working on a simple game design, and I wanted to break up my game objects into more reusable components. But I'm getting stuck on how exactly to implement the design I have in mind. Here's an example:
I have a Logger object, whose job is simply to store a list of messages and render them to screen. You know, logging. Originally t...
I always thought an object needs the data and the messages to act on it. When would you want a method that is extrinsic to the object? What rule of thumb do you follow to have a visitor? This is supposing that you have full control of the object graph.
...
Hi all,
I have a Category entity (class), which has zero or one parent Category and many child Categories -- it's a tree structure. The Category data is stored in a RDBMS, so for better performance, I want to load all categories and cache them in memory while launching the applicaiton.
Our system can have plugins, and we allow the plug...
I'm working on extending a framework currently implementing an Active Record pattern. The implementations provides a store/save method on the ActiveRecord class. I guess much of this implementation would be the responsibility of the unit of work implementation, like figuring out when and what object relations to save and so on?
How doe...
Background: I have enclosed (parent) class E with nested class N with several instances of N in E. In the enclosed (parent) class I am doing some calculations and I am setting the values for each instance of nested class. Something like this:
n1.field1 = ...;
n1.field2 = ...;
n1.field3 = ...;
n2.field1 = ...;
...
It is one big eval me...
I vaguely remember reading a blog entry (written by a well-known blogger I think) about how to model price changes over time, and that you could model most changes by saving two dates only (two columns in a db). The blog talked about prices on a website changing over time and how you could figure out the right price to charge knowing onl...
I am having a C# application to sync data between PC and palm devices.
There are codes written like below:
showMessage("synchronizing Table1");
Sync(destTable1,sourceTable1);
Sync(destTable2,sourceTable2);
showMessage("synchronizing Table2");
// more code
How do I separate the actual process of synchronizing from displayi...
Maybe this is simpler and more straightforward then what I'm thinking but I can't seem to find this concept on google anywhere. The concept is this:
You have a table in a database and the table has a specified number of columns. However, it has been asked of me by previous clients that there also be a set of dynamic user defined columns...
Yes, this is another question about my game engine, which is coming along very nicely, with much thanks to you guys.
So, if you watched the video (or didn't), the objects in the game are composed of various components for things like position, sprites, movement, collision, sounds, health, etc. I have several message types defined for "t...
Hi all,
I'm working on a controller that handles logins for a Web app. These logins will come from multiple clients but will all contain the same data. However, depending on the client, this data will be interpreted into common entities for our webapp differently.
For instance, we have a user code that gets sent in, and in one case we...