A discussion has come up in my office about the use of ternary operators. There are two sides to this discussion.
Side 1) That ternary operators are easy to write and read, therefore convenience is a net cost-savings.
Side 2) That ternary operators are difficult to maintain because they require excess code-churn should they ever need t...
First of all, I apologise for the vagueness of the question title and if this has been asked elsewhere already. I struggled to find a similar answer due to the amount of other 'what is this pattern called' questions.
I've got the following abstract class:
public abstract class PositionProvider<T> : DalProvider<T>, IDalProvider
whe...
I'm working on an ebook on GitHub on TDD JavaScript and I'm wondering if I'm missing any popular inheritance patterns. If you know of any additional patterns I'd love to see them. They should have the following:
Time tested - used in real apps
Source code should be supplied. Should be as straight forward and pedantic as possible.
Of co...
I've caused myself a bit of an issue with my Data Access Layer. In this particular instance, I have a table that contains potentially 5 types of 'entity'. These are basically Company, Customer, Site, etc. The type is dictated by a PositionTypeId within the table. They're all in the same table as they all havethe same data structure; Posi...
I'm writing a bunch of data out from a java application that gets consumed by the end user it could be to a file, console, or an arbitrary listener. It would be nice to allow the user to specify how they want to consume this data. What approach have people taken to this sort of problem, is there a good open source solution? I could see s...
Hey everyone,
I was wondering if I could get your thoughts and advice as to what would be the best/most advantageous design pattern for a networked Tic Tac Toe game?
I have been looking at the following design patterns: Factory, Abstract Factory, Singleton, Prototype, and Builder.
In your experience, which would be the best to use, an...
I've used a fair amount of dependency injection, but I'd like to get input on how to handle information from the user at runtime.
I have a class that connects to a com port. I allow the user to select the com port number. Right now, I have that com port parameter as a constructor argument. The reasoning being that the class cannot funct...
I'm not sure if there is merit to this question or not, but are there any best practices and anti-patterns specific to Google Guice?
Please direct any generic DI patterns to this question.
...
hey
I have a collection of ReportColumns in a Report object.
The ReportColumns has a DisplayOrder field which sets where abouts in the report the column is displayed. these columns are re-orderable in the designer ui and i can write some hacky code to change the order of them - but was wondering if there's anyway in nhib to take care o...
Why does Fowler PoEAA p. 498 define the null-object pattern in the following way (sample shortened, language is c# but doesn't matter):
public class Customer
{
public virtual string Name {get; set;}
}
public class NullCustomer : Customer, INull
{
public override Name
{
get { return "ImTheNull";}
// setter ommitted
}
...
We have a very nice GoF book (Design Patterns: Elements of Reusable Object-Oriented Software) about patterns in Object Oriented Programming, and plenty of articles and resources in the web on this subject.
Are there any books (articles, resources) on patterns(best practices) for functional programming?
For dynamic programming in langua...
Hello, I have been looking for a good PHP MVC framework that is interested primarily in speed, security, and implementing the MVC design architectural style.
Some of the biggest beefs I have with a lot of the mainstream MVC frameworks out there is that they:
put view logic in controllers, or do things like:
controller: $form = "a for...
What is the difference between Builder Pattern and Flyweight Pattern in terms of usage, as both of them deals with large number of objects?
...
We are working on an image processing project using C# and EmguCV. Our team is composed of 3 people. To make faster progress, the 3 of us work on different sub-problems or experiment with different algorithms at the same time.
Currently each of us creates a function that contains the major code we are working at and all of us make chang...
I am doing an anti-virus project by disassembling its code and analyzing it.
So i want a list of the Suspected Malicious pattern codes, so i can observe which is suspected and which is not?
so i want a list of suspected patterns only.
Thank You for your Help.
Abdelrahman.
...
My understanding of a factory is that it encapsulates instantiation of concrete classes that all inherit a common abstract class or interface. This allows the client to be decoupled from the process of determining which concrete class to create, which in turn means you can add or remove concrete classes from your program without having t...
I'm using the following command in my web application to find all files in the current directory that contain the string foo (leaving out svn directories).
find . -not -ipath '.*svn*' -exec grep -H -E -o "foo" {} \; > grep_results.txt
How do I find out the files that doesn't contain the word foo?
...
Hi,
I know there are many popular and useful Design Patters.
Are there something like them for debugging scenarios? Maybe not patterns but methodologies which are categorized and that can be used repeatedly for similar cases.
Any idea?
thanks.
...
I have been getting more involved with WPF for about a year now. A lot of things are new and sometimes it is hard to get my head wrapped around it.
At the same time I am rereading the GOF Design Patterns book.
A few times I would stop in the middle because I would realize that a certain pattern is the very one used in some WPF functio...
If I need a string to match this pattern: "word1,word2,word3", how would I check the string to make sure it fits that, in PHP?
I want to make sure the string fits any of these patterns:
word
word1,word2
word1,word2,word3,
word1,word2,word3,word4,etc.
...