Hey All,
What type of pattern would you recommend for a "multiple input, single output" situation. In other words, I have many different methods that I would like to call to send messages along a single serial port. What are the various patterns available to me and what are the tradeoffs involved in each. I know this is short on specif...
For example:
class Tree
has_many :apples
end
class Apple
belongs_to :tree
end
class ApplePresenter
presents :apple
def name
@apple.name.upcase
end
end
class TreePresenter
presents :tree
def apples
present_collection @tree.apples
end
end
Using this, there's no need to duplicate the ApplePresenter methods a...
Hi,
I am developing an api layer for my application. I have designed a structure and need some advice/feedback for it. You can find the basic implementation of the structure at the bottom.
Here are my requirements for the structure:
Response from API commands may need to be formatted in different formats (JSON,XML,etc.)
Some API com...
Is there a best practice or design pattern on how web services should be authenticated. I am especially concerned about not having to pass the authentication data every time I hit the service.
...
I'm trying to come up with a reusable warning piece for the business objects in a project I'm working on. Before saving one of our business objects, sometimes we need to warn the user of what the potential impacts are. Say my business object was named "Company". Company.Delete() will get rid of the company and not really care about what ...
I can see in dom4j library a number of classes with Flyweight prefix: FlyweightAttribute, FlyweightComment, FlyweightText etc. Here is what java doc is saying in the case of FlyweightText:
FlyweightText is a Flyweight pattern implementation of a singly linked, read-only XML Text. This node could be shared across documents and elements ...
If my service encounters an error, I want that thread to return an error and terminate, but later requests should still work fine. How do I do this? If I have an unhandled exception, it will get passed back to the client, but then the service stops.
...
I can think of quite a few components that need to be created when authoring a web application. I know it should probably be done incrementally, but I'd like to see what order you usually tackle these tasks in. Layout your usual order of events and some justification.
A few possible components or sections I've thought of:
Stories (i...
I've been doing some playing around with POCO objects and EntityFramework. Because of this I have to write my own Context and Repository(s). I would like all repositories to use the same context instance so changes are shared between them. To facilitate this I coded my Context as a Singleton. This way instead of getting a new context and...
I am looking for some design patterns or best practices for configuring web page fields.
My web page has a table, which is dynamically created by my API (Wicket).
Currently all the column names are hard coded in the java but I want to make it externalizable that way I can add/remove/modify fields without modifying java code.
Also I ...
I'm creating a data access object to retrieve information from Google App Engine for a web app built on the Spring framework (first time for all).
I see a number of examples that use a Controller/webapp -> Service -> DAO -> JDO/Google-app-engine pattern.
In this pattern the DAO layer is the only one that knows about JDO, thus this laye...
Hi, I need an advice w.r.t. one of the design approach we are considering.
We are implementing a Java web service provider which acts on data in relational database. Our propose classes are:
IDAO - interface with execute() method
GetCustomerDAO and UpdateCustomerDAO implements IDAO
DAOFactory - List of DAO to be reads configuratio...
Hi All
One thing about Android development i would like to see some examples on are, separating responsibilities in Android, right now i have Activities and i feel its quite unpleasant, how i put all my event handling, UI construction/updating and communication with my data persistence into a single Activity. This makes my Activities ex...
Hi
Thanks for your valuable time.
I want to learn c++ design patterns. I searched on web but I was not getting documents which gives me better details about design patterns. I was getting good details but those were in different URL's, I required all the information in one place only so that it will be better to know what all things a...
Hello there,
i know there a lot of topics discuss design patterns, and also every one would say each pattern has it pros & cons, and every one should choose the one that most suits his needs,
but here i want from every expert to share his experience with design patterns, as for me i started a new application, and when starting in its a...
I have a design pattern I have been struggling with on how best to prevent duplicate posting of data.
Here are the steps:
Client submits data with a unique guid (client generated guid - guaranteed unique)
Server side software makes sure client guid doesn't exist yet in the DB
begins transaction
process data (can take between 1-20 seco...
I have the following piece of code:
if (book.type == A) do_something();
else if (book.type == B) do_something_else();
....
else do so_some_default_thing.
This code will need to be modified whenever there is a new book type
or when a book type is removed. I know that I can use enums and use a switch
statement. Is there a design patte...
Lately I have come across Null Object design pattern and my colleagues say it can be used to do away with the null pointer checks that are encountered throughout the code.
for e.g suppose a DAO class returns information on Customer (in a value object called CustomerVO). My main class is supposed to extract the firstName and emailId and...
I am developing an application that will be deployed to Amazon EC2. I've had a good look at membase, which is a key-value store that can scale out very easily. However, I'm not sure that you can use that as your primary (or at least, only) datastore. Ie, you will need something else that will be able to hold search-able/query-able data.
...
I originally asked this question on programmers.stackexchange.com, because I figured the answers would be too subjective for stackoverflow. However, in the comments Muad'Dib pointed this out:
this would probably be a better fit for StackOverflow ... This is a direct programming problem-related question and discusses programming so...