What is the difference between a Singleton pattern and a static class in Java?
How is a singleton different from a class filled with only static fields? ...
How is a singleton different from a class filled with only static fields? ...
Hi All, In this page: http://docs.jboss.org/hibernate/core/3.3/reference/en/html/transactions.html I have read that: "A unit of work is a design pattern described by Martin Fowler" Did Martin Fowler discovered this pattern before hibernate boys and is Martin the only source of describing this pattern? Regards ...
Hi all, i have a parent entity Service and a child ExtendedService in a SINGLE_TABLE inheritance. A third entity ServiceCollector need to include both entites Service and ExtendedService. This is a fixed requirement, and with this design i can realize it using polymorphism. THE PROBLEM: Very often i need to retrieve ONLY the parent cla...
Hi all, I'm creating an interface for "PickupPoints", Each pickup point needs to be able to return all pickup points found and the pickup point details and maybe in the future more information. That's okay with the code below: <?php interface iPickupPoint { public function getPickupPoints($countryCode, $postalCode, $city); pub...
hi, I need to build a data access layer and I am looking for the right design pattern. what I need is: object mapping: it shouldn't be too complicated and not generic. i have a lot of lookup tables and i need to a good way to load them. I don't care about starting time (when the program starts up), what I care is to minimizing the n...
Short question I have one C++ domain model. It has some methods used by the internal API as well as other public methods. I don't want to expose those API methods. I'm thinking of using the proxy pattern to hide those methods. Do you think this is a good idea? Is there some design pattern to achieve this? Long example Let's say there'...
Hello all, I am designing a simple web based application. I am new to this web based domain.I needed your advice regarding the design patterns like how responsibility should be distributed among Servlets, criteria to make new Servlet, etc. Actually I have few entities on my home page and corresponding to each one of them we have few opt...
Hey there, I have a design question about the communication between the model and the presenter in the MVP design pattern -- or more accurately its derived form the passive view. Let's assume the following simple GUI as an example: I have a window where my view is a list and there is the possibility to open a file dialog to select a fi...
I've been learning the adapter and facade design patterns for an upcoming junior development role i'm applying for, as i'm expecting to be asked what i know about the pattern and times i've used it. While the pattern itself seems straight forward - i'm struggling to think of a practical use i could use it for in a personal project. So c...
Hi, I fight with me for some days about asking this question. Its pretty plain and simple: If you have an application with a GUI totally working on 2D drawing, what should be the best practice to handle what to draw and where to touch?! Some example for better understanding: I have a game with a map. On this map I can build houses an...
So I am using ViewModels to pass data from/to the web forms in my MVC application, as seems to be recommended practice from what I have read. My question is what is the normal approach to then map the ViewModel into an actual domain entity? I'm guessing I should probably add a 'GetObject' method to my ViewModels so I have something lik...
I've been learning about the Model-View-Controller paradigm ("MVC"), but I'm quite confused since some tutorials contradict other tutorials. My current understanding of the process looks something like this: Router / Dispatcher / Front Controller: Though not specifically referenced in the "MVC" name, the Router is still a very import...
This is a repost of another thread i created. I think my first post was a little rhetorical in nature so it was closed so hopefully i can word my question better. There seems to be a push by some of the industry heavy weights to recommend using an ORM over the repository pattern and building your on DL Layer. So in your application lay...
NOTE: Please ignore my use of MultivaluedMap instead of multiple vargs String...args. Is there a standard way in java of doing this? What I have is a resource, that is returned from a remote server. But before each query, the remote connection must be open, and after the returns are returned - it must be closed. So a natural way of d...
Hi, I am working on a small android project where it is necessary to share some data amongst several activities and a service that runs in a separate process. I would just like to know what are my options in terms of sharing data? Application class? IPC? File-based? Broadcasts? Thanks guys! ...
Is it possible to have an index on the righthand side of a ListView? This is possible on the iPhone where running down the righthand side the alphabet is shown. Touching a letter on the alphabet brings one to the beginning of the items in the ListView that start with that letter. Is there built-in code in Android for this functionalit...
So I'm brainstorming some stuff with a coworker right now with regards to backend API we're in the process of concepting out. It's a pretty straightforward read API, where a client requests certain data from a server and a server replies with that data. We're just brainstorming ideas at the moment, and one "idea" that came up was a sort...
I have a design problem I'd like to solve. I have an interface, lets call it IProtocol, which is implemented by two separate classes. We're looking at over 600 lines of code here. The vast majority of the stuff they do is the same, except for some specific areas, like DiffStuff(); Current structure is something like this: public clas...
Looking at the following (simplified) hierarchy of classes: > Email (base class) > SimpleEmail extends Email > HtmlEmail extends Email I need to decorate Email.send() to add throttling functionality. I need to instantiate SimpleEmail, HtmlEmail or other similar subclasses of Email. What should this pattern look like exac...
So from what I've known, if I do an AsyncTask inside an Activity, the task may be killed when user quits the Activity before it is finished. One solution I've seen is using IntentService, which the system will try hard not to kill. My problem is that IntentService only uses one background thread to run all the tasks one by one. I have s...