patterns-and-practices

How much documentation do we need and when should we write it?

This question is inspired by the following sources: Clean code by Robert C. Martin Agile Principles, Patterns, and Practices in C# by Robert C. Martin and Micah Martin What is software design? by Jack W. Reeves My current project (where we should comment everything in the code) Mr. Reeves states in his paper that the code is the desi...

The 10 Commandments of Programming...

...or programming related activities There's a certain text (The Bible) which suggests that there were, at least at one time, a list of 10 rules (The 10 Commandments) that if followed you would be considered, well, "good". If such a list existed for programming, what would it be? I'm thinking in terms of languages (or language types) t...

What's the best way to reverse communicate between view controllers?

I've been thinking about this and have read through another stackoverflow question regarding the best recommended way to communicate between view controllers. However, the question/answer for that doesn't seem to address the best approach for the reverse behavior. i.e. to pass data from ParentController to its ModalController, we could ...

Best practice when using functions/objects and database - general question

I have this question on and of for a year or two, but it is so nonspecific, and my native language is not English, so I don't know how to ask to be precise and everybody will understand what is my dilemma. It is even more valid if using objects but for the sake of simplicity I'll make a simple example (theoretical) with a function and d...

Composite Application Block - Is there a suitable replacement available?

I have two very large WinForm applications built on the now dead Composite Application Block ("CAB") from Microsoft Patterns & Practices. I was an earlier adopter and jumped in first to embrace and use CAB. Well, now that it's truly dead I'm starting to think more and more about the future and what framework I can migrate to. What I l...

Using switch instead of merge

At this moment, I am the only person working on a project in svn. To stay legit, I am suppose to make changes to a branch and then merge those changes into trunk: so my branch and trunk are basically identical. Currently I have two working copies, one for the branch and one for trunk. I make the changes to the branch working copy and ...

Common functionality recommendations for a small-business site

So a friend of mine has a small business, where he sells paper products, as well as custom posters, banners, and the like. He doesn't have a website, so he's hired me to create one for him, where users can place orders, check the status of their order, etc. Other than his requirements, I'm trying to come up with other common functionali...

What are JTA best-practices and anti-patterns?

Hi, I'm looking into JTA and I'd appreciate hearing about best-practices as well as anti-patterns for multi-threaded applications. Thanks, Ittai ...

Is it proper TDD practice to design your model before you write tests, or write tests that design your model?

I am building a DDD system and we have all the requirements on paper for the system already set. There is a disagreement on how we go about building our domain model that I need an opinion on. My preference is to take the requirements and sketch out a basic domain model with the outline for the classes, their properties and behaviors a...

Why everybody hates ViewData?

I wonder, why everybody hates ViewData so much? I find it quite useful and convenient. I tell you why: typically every controller action has it's own ViewModel, so it's used only once and I find it very tedious to modify ViewData class every time I need to add extra portion of data to view (adding extra field to class usually leads to m...

When Expando Class should be used in Google App Engine Apps?

What are the applications for Google App Engine Expando Class? And what are the good practices related to it? ...

SCSF Calling services asynchronously

Hi guys, are there any best practices for calling SCSF services asynchronously? Particularly I'm interesting in: Executions of requests in background; Cancellation support; Reporting progress. Currently I came up with two scenarios: Listener Service which listens in background for real-time updates and displays received data in g...

How to use java.sql.Timestamp as real java.util.Date with JPA

I have a problem about the management of dates with milliseconds. I understand the need to use the TIMESTAMP to store milliseconds: @Temporal(TIMESTAMP) @Column(name="DATE_COLUMN", nullable = false) @Override public java.util.Date getDate() { return this.date; } But if I can't compare this date to another instance of java.util.Date, u...

What circumstances should someone "try...catch"? Does this apply to libraries?

Suppose you're designing an application (WebApp, Desktop, anything) and you need to define exception handling for the code. Since you want to make things reusable, what logic should you follow when handling exceptions? Are there any patterns to follow? For example, if some DLL is going to use the network and the network is unreliable, ...

How do you start knowing when to write code?

I've been a programmer for a few years now and I've noticed that my productivity increases and error rate decreases the less code I write. I favor collections over writing my own data structures and I've utilized libraries from various sources where I can (python packages, codeplex, etc). I'd like to take it a step further though and l...

benefits of a static class

Possible Duplicate: What is the use of a static class What are the benefits of declaring a static class? public static class MyStaticClass { } Are there any other than "it can't be instantiated"? Why else would you want a static class, for what reasons should a class be static? Is "any class should be declared as static unl...

What type should I use for an index variable.

This is a best practices question. I am making an array type * x = malloc(size*sizeof(type)); AFAIK sizeof gives a return value of size_t. Does that mean that I should use a size_t to declare, or pass around size? Also when indexing the array should I also use a size_t for the index variable? What is the best practice for these th...

Searching childs

Hello I have class A. Class A is responsible for managing the lifetime of B objects and it contains container of B objects that is map<BGuid,B>, and each B object contains container of C objects which is map<CGuid,C>.I have one global A object for the entire application. I have the following problem: I have CGuid object and I want to u...

How to design a unit test for generating a PDF document?

I'm late to the party with regards to using unit testing... trying to figure best practices and the such. My question is, given a class which is responsible for generating a PDF (or Doc/Html/Xml/etc.), how would I go about testing the final output file is correct? I figure a text based file (xml), I could just see if the strings match,...

Best practise: Preloaders in Flash?

I'm a bit curious.. I'm working on an application that loads dynamic data externally - this can take from one second up to several minutes depending on the user's connection speed. Should I make a preloader at the start of the application and load in every data or make X preloaders and show them for every page/part of the application w...