Efficient way to implement singleton pattern in Java?
Ccna final exam - java, php, javascript, ios, cshap all in one. This is a collaboratively edited question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
Sunday, June 10, 2012
Efficient way to implement singleton pattern in Java
Friday, June 8, 2012
Overengineering - How to avoid it
Sometimes I find myself designing my classes for a certain project. I start with some entities, some interfaces, but after some time I think:
Sunday, June 3, 2012
What is the right pattern for using JQuery Ajax and ASP.Net Mvc?
I'm very new to both the Mvc framework as well as JavaScript and JQuery. I'm trying to understand the right way to structure Ajax calls.
Friday, May 25, 2012
Examples of GoF Design Patterns
I am learning GoF Java Design Patterns and I want to see some real life examples of them. Can you guys point to some good usage of these Design Patterns, preferably in Java's core libraries?
Tuesday, May 15, 2012
Static methods: are they still bad considering PHP 5.3 late static binding?
If you search on the reasons why static methods are bad the first thing you find it is because you can't override it when you are unit testing.
Wednesday, May 9, 2012
How to improve the builder pattern?
Motivation
Recently I searched for a way to initialize a complex object without passing a lot of parameter to the constructor. I tried it with the builder pattern, but I don't like the fact, that I'm not able to check at compile time if I really set all needed values.
Monday, May 7, 2012
How can plugin systems be designed so they don"t waste so many resources?
I am trying to build a basic plugin system like the kind you often find in a CMS like WordPress. You have a folder of plugins which tie into the main system's operation through event notifications using an Observer or Event design pattern.
Thursday, May 3, 2012
Which jQuery plugin design pattern should I use?
I need to build a jQuery plugin that would return a single instance per selector id. The plugin should and will only be used on elements with id (not possible to use selector that matches many elements), so it should be used like this:
Thursday, April 5, 2012
Design Patterns used in the jQuery library
jQuery is highly focused on the DOM and provides a nice abstraction around it. In doing so, it makes use of various well known design patterns which just hit me yesterday. One obvious example would be the Decorator pattern. The jQuery object provides new and additional functionality around a regular DOM object.
Wednesday, March 7, 2012
Is it bad practice to make a setter return "this”?
Is it a good or bad idea to make setters in java return "this"?
Friday, January 13, 2012
Strategy pattern in Symfony2
I'm trying to build simple service for rendering various types of pages. Basic concept is having something like: