patterns-and-practices

Using Microsoft's Application Blocks

I haven't done a lot of .NET programming, but I have examined a few of the application blocks published by Microsoft's Patterns and Practices group. I was wondering how these are typically used: Linked directly into applications Source added into applications and built with them, perhaps with some customizations Sample code used as re...

Which Design Pattern is best for Iterative development?

Is there such a thing as having the most prefered design pattern for building applications in TDD or the iterative mode? ...

A good pattern/solution to the social web user problem of point whoring?

Take any social website like digg or stackoverflow that lets users reward points for stories/questions/etc. somehow. What happens is quite similar to the process that lead to the rise of tabloid newspapers that feed only headlines and no content to its readers. Users are usually smart enough to figure out strategies to maximize their p...

Least favourite design pattern

OK, I'm not looking for anti-patterns - I'm looking for things that aren't really patterns, or perhaps patterns that have been abused. My personal least favourite is the "Helper" pattern. E.g. I need to create a SQL query, so call SQLQueryHelper. This needs to process some strings, so it in turn calls StringHelper. Etc., etc. See - th...

Business Entity Loading Pattern

The project I'm working is using n-tier architecture. Our layers are as follows: Data Access Business Logic Business Entities Presentation The Business Logic calls down into the data access layer, and the Presentation layer calls down into the Business Logic layer, and the Business entities are referenced by all of them. Our busine...

How to properly use Struts ActionForms, Value Objects, and Entities?

I've inherited a large Java app that uses Struts, Spring, and Hibernate. The classes and interfaces I deal with daily are: Struts Actions, Struts ActionForms, Value Objects, Service Interfaces and Implementations, DAO Interfaces and Implementations, and Entities. I'm pretty clear on the how and why of most of these, except I'm unsure abo...

What are some possibly unique development standards in your country?

What are some possibly unique development standards in your country? In general Information on the internet is focused around practices, standards and current programming tendencies in western countries, specifically the U.S.A. However that tends to be "biased" as one might say. So it'd be fun if developers overseas could compile some s...

Why do people use __(double underscore) so much in C++

I was having a look through some open source C++ code and notice a lot of double under scores where used in the code, mainly at the start of variable names. return __CYGWIN__; Just wondering is there a reason for this, or is it just some people code styles? I would think that I makes it hard to read. ...

PHP Idioms?

I'm looking to improve my PHP coding and am wondering what PHP-specific techniques other programmers use to improve productivity or workaround PHP limitations. Some examples: Class naming convention to handle namespaces: Part1_Part2_ClassName maps to file Part1/Part2/ClassName.php if ( count($arrayName) ) // handles $arrayName being u...

Good Book for Patterns and Practices

Can anybody recommend a good book on Patterns and Practices in C#? I have been having trouble getting my head around some of these ideas and would like to find a good off-line resource. ...

Using hash functions for file storage?

A common technique for storing a lot of files/blobs in a filesystem is to use a hash function to determine the filepath; eg hash(identifier) -> "o238455789" -> o23/8455/789 (there is often a hash-collision strategy too) Does this technique have a name (is it a 'pattern'?) so that I may find it with a search of ACM Digital Library or sim...

Export a Unity container information to xml configuration

In Microsoft Unity you can configure a container from an existing XML configuration but is there a way to do the opposite? From an initialized container export the corresponding XML configuration? ...

StringLengthValidator - localization not working

I am validating input to my ASP.NET application using StringLengthValidators, and using the ValidationSummary control to display the error messages. To localize the application, the StringLengthValidators have the MessageTemplateResourceName and MessageTemplateResourceType attributes set. The first time the validator runs, it picks up...

Getting partially trusted callers error with Microsoft.Practices.EnterpriseLibrary when run exe using UNC path?

I have created a Console App that when I run locally from the command line it works fine. And it logs to a local file. When I copy it to another machine and try to run from the command line ie //AnotherServer/d$/Apps/MyExe I get this error. An error occurred creating the configuration section handler for loggingConfiguration: That ...

Silverlight (3) best practices

Hi there, I'm planning a greenfield project using silverlight 3. I was wondering if there are anything like the "smart client software factory" for silverlight... Cheers, Ali ...

Data types between the Service (Application/Controller) and UI layers

Consider the common layered architecture of: UIService/Application/ControllerDomainPersistancy What should be the types between the Service and the UI layers? Should the return types of the methods in the Service layer be primitives? Can they be objects from the Domain layer? The motivation: We are building a forum system. Somewhere ...

Prism (Silverlight)

either I'm missing something or the (patterns & practices Composite Application Guidance for WPF and Silverlight) doesn't come with any templates or "guidance packages" to generate code. could someone confirm if I didn't install it properly or it is totally different from SCSF and doesn't have any codegen in it? ...

Front Controller vs. Façade pattern

Okay, I have done a bit of searching online and found this thread, but it still does not quite clear it up for me. What exactly is the difference between a Front Controller Pattern and a Façade pattern? As I understand it so far: A Façade pattern does not contain any business Logic, but merely centralizes access to multiple objects. A...

The proper way of raising events in the .NET framework

Currently "Avoid checking for null event handlers" is at the top of the answers to the post titled Hidden Features of C# and it contains severely misleading information. While I understand that Stack Overflow is a "democracy" and the answer rose to the top by virtue of public voting, I feel that a lot of people that up-voted the answer ...

What is the proper etiquette for handling potentially reusable legacy code in large projects?

I have been wondering what is the best way to tackle this situation. Is the best way to leave the old code in a comment block in case someone decides to add that functionality into the project again, or should this code be deleted for the purposes of keeping the source code clean and readable? ...