I have been thinking and learning a lot about forms lately trying to add advanced extensions to the Spree ECommerce Platform: Subscriptions, Events, Donations, and all kinds of Surveys.
Every example I have ever encountered (in blogs, in the docs, in screencasts, in source code, etc.) make forms out of Models, but they never go to anyth...
Hi all,
I have the following DB model:
**Person table**
ID | Name | StateId
------------------------------
1 Joe 1
2 Peter 1
3 John 2
**State table**
ID | Desc
------------------------------
1 Working
2 Vacation
and domain model would be (simplified):
public...
Who has the responsability
Who has the responsibility to start and finish the Unit of work in a MVC architecture?
...
All,
I was wondering if anyone knew a better patten than:
array_of_hashes.map { |hash_from_array| hash_from_array[:key] }
for retrieving an array of values with a specific key from an array of hashes containing that key.
...
Hi,
I been building my first ASP.NET MVC application and so far am getting to grips quite well with it I think. Some of the concepts are still fuzzy (routing) but I have an idea.
One of the things we do with our WebForms apps is to route navigation through an Application Controller [Fowler] to handle our page navigation based on the cu...
I'm trying to follow the MVP (specifically Passive-View) pattern in a java swing ui application.
The basic design of the application reminds a wizard control. The screen is divided to two main parts:
an active view.
a static navigation bar, with navigation buttons.
The user can use buttons to change the active view, but the bar is ...
Hi all,
consider the following simplified example:
public class Ticket
{
public int Id;
public TicketState State;
public Ticket()
{
// from where do I get the "New" state entity here? with its id and name
State = State.New;
}
public void Finished()
{
// from where do I get the "Finished" state e...
I'm trying to understand how to implement replaceable components, or a service provider interface, in the .NET world. I suspect that I just don't know the appropriate terminology to search for.
Specifically, I'm playing around with a Matrix class that has different backends. At its simplest, a matrix provides two-parameter get and set...
For example, I have window (non-document model) - it has a controller associated with it. Within this window, I have a list and an add button. Clicking the add button brings up another "detail" window / dialog (with an associated controller) that allows the user to enter the detail information, click ok, and then have the item propaga...
I have a class that has dependencies that I've wired up with Ninject.
public interface IFoo {}
public class MyObject {
[Inject]
IFoo myfoo;
}
In the real implementation I'm using property injection, but just to quickly illustrate, I'll inject on the field. As I understand, instead of newing instances of MyObject, in order ...
I have been trying to stick to the TDD approach. So I have made some tests and they all fail. Now I am implementing. But now that I am implementing I have seen that the methods are too simple to fail. In particular I have implemented the observer pattern and all that happens is that I notify all the registered observers. So use a for eac...
Hello everybody,
What are the pros and cons of using static repositories in an ASP.NET MVC application?
Wouldn't it be better to have all the methods available all the time -> means that the class get's instantiated only once instead of having multiple controllers referencing to the same repository class and its methods?
Or do I get s...
Hello,
I have these two classes and the class Retrodoc needs to know the versionPath() to execute its method run($versionId). So what is the best modelization? Do I instanciate Version in the method and then I can use the method getVersionPath()?
Thanks in advance.
...
Usually when using dependency injection, unit (and other) tests are responsible for creating/mocking dependencies of the system-under-test and injecting them.
However, sometimes the test itself has dependencies, or needs to inject dependencies into the SUT that it can't itself create. For example, when testing classes which interact wit...
I'm learning about MVVM and one of the things I don't get is how the model and the view model are supposed to communicate. I also don't understand whether they are separate classes, composite classes, or whether the ModelView is supposed to inherit from the model.
I need to get some data from a web service, so I think the model should b...
Hi!
I'm writing a component that reads data from a vehicle CAN-bus and offers a subscribe-interface to be used by the upper layer components. Part of the interface is that the subscriber can define a time of which a certain frame is considered to be timed out, and when that occurs the subscriber is notified.
Since the load of the bus ...
I have never used Factories before for the simple reason, I don't understand when I need them. I have been working on a little game in my spare time, and I decided to implement FMOD for the sound. I looked at a wrapper designed for OpenAL(different sound setup) and it looked something like...
SoundObject*
SoundObjectManager*
SoundObject...
I'm commonly working on GUIs where I want to directly prevent a user from doing things they should not be able to do by disabling controls on a form. For example maybe I don't want the "Process Widgets" button to be enabled unless the user currently has a "Widget Project" open in the application? Or the "Cancel Processing" button only be...
I'm using a repository pattern for my data access. So I basically have a repository per table/class. My UI currently uses service classes to actually get things done, and these service classes wrap, and therefore depend on repositories. In many cases my services are only dependent upon one or two repositories, so things aren't too crazy....
Say I have a singleton-ish, factory-ish, reflection-ish class that receives some input, and spits back a new instance of a concrete implementation of some interface. What kind of design is this? Is there a better way to do what I want?
Here's some code to illustrate the point:
using System;
using System.Collections.Generic;
// stat...