The tag has no wiki summary.

learn more… | top users | synonyms

48
votes
2answers
4k views

Are there any OO-principles that are practically applicable for Javascript?

Javascript is a prototype-based object oriented language but can become class-based in a variety of ways, either by: Writing the functions to be used as classes by yourself Use a nifty class system ...
35
votes
11answers
4k views

Are error variables an anti-pattern or good design?

In order to handle several possible errors that shouldn't halt execution, I have an error variable that clients can check and use to throw exceptions. Is this an Anti-Pattern? Is there a better way to ...
29
votes
4answers
8k views

Developing a feature which sole purpose to be taken out?

What is the name of the pattern in which individual contributors (programmers/designers) developed an artifact for the sole purpose is to serve as a diversion so that management can remove that ...
19
votes
12answers
3k views

What design patterns are the worst or most narrowly defined? [closed]

For every programming project, Managers with past programming experience try to shine when they recommend some design patterns for your project. I like design patterns when they make sense or if you ...
19
votes
4answers
2k views

Is “convention over configuration” not violating basic programming principles?

I was looking at the WPF MVVM framework Caliburn.Micro and read that a lot of standard things are based on naming conventions. For example, automatic binding of properties in the View to properties ...
17
votes
9answers
692 views

What to do as a new team lead on a project with maintainability problems?

I have just been put in charge of a code project with maintainability problems. What things can I do to get the project on a stable footing? I find myself in a place where we are working with a very ...
16
votes
4answers
2k views

What is “lambda” code?

I have recently heard people talk about code being "lambda". I have never heard of this phrase before. What does it mean?
14
votes
5answers
998 views

Combining getters and setters

JavaScript libraries such as jQuery, combine 'getters' and 'setters' in the programming interface for example: $('element').css({'color','blue'}); will set the color or $('element').css(); ...
12
votes
4answers
672 views

Is it bad practice to allow user defined fields?

Generally speaking, is it considered bad practice to allow for user created fields in a database for a webapp? For example, I am making a home inventory webapp for my wife, and she is going to want ...
12
votes
2answers
1k views

Is using the new System.Tuple class bad design?

I like the concept of System.Tuple in that it allows me to return multiple parameters in a single function call without instantiating a new class, however does this defy any good programming practices ...
11
votes
4answers
698 views

When and for what purposes should the const keyword be used in C for variables?

While getting my code reviewed here the issue of using the const keyword came up. I understand that it is used for implementing read-only behaviour on variables. I am confused about what are the ...
11
votes
1answer
2k views

How to choose between using a Domain Event, or letting the application layer orchestrate everything

I'm setting my first steps into domain driven design, bought the blue book and all, and I find myself seeing three ways to implement a certain solution. For the record: I'm not using CQRS or Event ...
10
votes
3answers
1k views

What is the pattern name for using method chaining to build an object?

I frequently use a pattern where I using method chaining to setup an object, similar to a Builder or Prototype pattern, but not creating new objects with each method call, instead modifying the ...
10
votes
9answers
1k views

Is this an anti-pattern?

I've seen this a lot in our legacy system at work - functions that go something like this: bool todo = false; if(cond1) { ... // lots of code here if(cond2) todo = true; ... // some other ...
9
votes
8answers
642 views

When does 'optimizing code' == 'structuring data'?

A recent article by ycombinator lists a comment with principles of a great programmer. #7. Good programmer: I optimize code. Better programmer: I structure data. Best programmer: What's the ...
8
votes
7answers
730 views

Is it appropriate for a class to only be a collection of information with no logic?

Say I have a class Person that has instance variables age, weight, and height, and another class Fruit that has instance variables sugarContent and texture. The Person class has no methods save ...
8
votes
3answers
538 views

How to migrate my thinking from C++ to C#

I am an experienced C++ developer, I know the language in great details and have used some of its specific features intensively. Also, I know principles of OOD and design patterns. I am now learning ...
8
votes
2answers
444 views

Is implementing an interface defined in a subpackage an anti-pattern?

Let's say I have the following: package me.my.pkg; public interface Something { /* ... couple of methods go here ... */ } and: package me.my; import me.my.pkg.Something; public class SomeClass ...
8
votes
2answers
252 views

Low coupling processing big quantities of data

Usually I achieve low coupling by creating classes that exchange lists, sets, and maps between them. Now I am developing a Java batch application and I can't put all the data inside a data structure ...
8
votes
5answers
603 views

Designing a robust architecture for multiple export types?

I'm looking for patterns or architectural guidance for an upcoming feature I'm designing. Basically, it's an export feature with multiple export targets, and I'm looking to find a way to make it ...
7
votes
4answers
5k views

Is it a good practice to create a ClassCollection of another Class?

Lets says I have a Carclass: public class Car { public string Engine { get; set; } public string Seat { get; set; } public string Tires { get; set; } } Lets say we're making a system ...
6
votes
4answers
577 views

Structured code vs Duplicate code. Modifiability [duplicate]

I have noticed that my classmates write unstructured code with a lot of duplication. And their solutions of the same tasks often contains more then three times more lines than my project. But when ...
6
votes
3answers
186 views

Holding mutable data in a single place

Given a mutable property, it generally makes sense to only hold/store that property in a single place. When the data needs to change you only need to update a single field, and you can completely ...
6
votes
4answers
586 views

Should injecting dependencies be done in the ctor or per method?

Consider: public class CtorInjectionExample { public CtorInjectionExample(ISomeRepository SomeRepositoryIn, IOtherRepository OtherRepositoryIn) { this._someRepository = ...
6
votes
2answers
2k views

Storing and maintaining serialized objects in C#

What are the best practices to store and maintain serialized objects in C#? Any strategies or patterns that apply? What I have come to believe so far is this: Prefer Json over XML, both for space ...
6
votes
4answers
737 views

How does one learn to program (and think) the Ruby way? [closed]

Why I Ask this Question: I've just starting to learn Ruby (and by extension IronRuby since I work in the Microsoft world). I picked up IronRuby Unleased to teach me the basic syntax of Ruby, and any ...
6
votes
1answer
103 views

Dangers when implementing features as plugins [closed]

What kind of problems have you encountered when building plugin interfaces for your application? And how did you resolve them? Background I want to refactor an application so that various features ...
5
votes
2answers
650 views

Is sticking to one language on a particular project a good practice?

I'm developing a pipeline for processing text that will go into production. The question I keep asking myself is: should I stick to one language for the project when I'm looking for a tool to do a ...
5
votes
4answers
305 views

Is it normal to write all logs into a single file?

Our teamlead said that many files much worse than a single, despite of we are working on a big project. He argued that our customers could more easily send logs to us if there will be just a single ...
5
votes
5answers
2k views

Database connection - should they be passed as parameter?

We have a system whereby the database connection is get once using a common method, and being pass throughout the relevant class to be used. There are doubts that passing the database connection as a ...
5
votes
2answers
637 views

Returning an IQueryable from an IRepository

Using the Repository pattern, is it proper to return an IQueryable of a data set (table), for generic usage? It is very handy in many cases, especially when using external libraries that leverage ...
5
votes
6answers
426 views

What are best practices when switching between projects/coming back to projects frequently?

The nature of my job is that I have to switch back and forth between projects every few weeks. I find that one of the biggest impediments to my productivity is the ramp-up time to getting all the ...
5
votes
3answers
222 views

How to represent (enum) types in a public API

I am working on a simple API that I want to use for my own client, and to open to the public in the future. I have "Item" objects which can have different "types". The type is a C "typedef enum", for ...
5
votes
2answers
1k views

When is Efferent / Afferent coupling good or bad

I have a software patterns exam this week and one of the topics we are to study is Efferent and Afferent coupling. I understand a package has a high Ce (efferent coupling) if it depends on a number ...
5
votes
4answers
442 views

How to apply one of the OOP concepts (Closed for Modification and Open for extension)?

Days before, I created Question, Quiz, and Main classes. One Quiz has one or more Questions. From the main class I first create Question objects (the constructor accepts an array of numbers). The Quiz ...
5
votes
1answer
121 views

Checking members and instantiating in properties

Consider this: public MyClass { private Resource _myResource; public Resource MyResource { get { if(_myResource == null) { ...
4
votes
2answers
883 views

When is it worthwhile to replace working mature code with frameworks+patterns

I fear that frameworks in many cases have become a fashion or trend and are being abused. In many ways people are sacrificing speed just because they want to keep up with every single lib that comes ...
4
votes
4answers
894 views

Exceptions vs ErrorCodes when working with devices

Out team is at the cusp of a new project. One of the components at the boundary of the system is the component which interacts with a printer through an external COM component (referenced as a usual ...
4
votes
4answers
383 views

What determines when an application requires mvvm?

I'm developing mobile applications for Windows Phone 7. This application calls some web services and occasionally sends responses out via web services. I recently started looking into MVVM and noticed ...
4
votes
3answers
3k views

What is good programming practice for structuring java project?

I have a Java project that is getting to be relatively large (a few thousand lines in all, I'd say). It's definitely a lot larger than what I've dealt with before, being that I am still a relatively ...
4
votes
1answer
166 views

Rapid code analysis

I have recently moved to a new company where I am tasked (in part) with evaluating the existing code base and coming up with patterns and best practices. Our development team consists of around 20 ...
4
votes
3answers
509 views

Architectural Patterns for a Game

So I've got a solution that contains a few big projects, which I'm trying to break down into smaller projects with more isolated responsibilities. This is a game I'm tinkering with -- I'm mainly a LOB ...
3
votes
3answers
490 views

Why is quantity in software still written as “1 result(s)”?

Lately, I've been noticing that a lot of software, be it a website, a client application, or a video game, often write a representation of quantity as follows: "1 result(s)". Now, I can understand why ...
3
votes
1answer
296 views

What is the pattern called when getters take responsibility for the setting?

I've been heavily using a pattern for years now, but I don't know what it's called. It looks like this.... class xzy { public function getFoo() { if ( undefined(this.foo) ) { ...
3
votes
3answers
413 views

When do you use new technology and complicated design principals in an LOB app (using WPF)?

I'm building an LOB app for a very big and serious client, the app itself is not big but my client is so I have to get it right. I'm generally tempted to always use the latest stuff out there and ...
3
votes
3answers
799 views

New Silverlight app. MVVM. RIA Services vs CSLA

Another 2 days of reading and watching demos and here we go. For my enterprise LoB Silverlight app I'm going to use: Prism for UI aspects and modularity. MVVM pattern (using Prism) ??? to bring ...
3
votes
2answers
164 views

How to abstract transition between Views?

Our team is developing an application using WPF with MVVM. We want to make ViewModels reusable. With this intention we want to abstract the transition logic between Views (ViewModels, we use ...
3
votes
2answers
588 views

What is the middleware pattern?

Here's a Ruby poject that implements the middleware pattern. From the description, I have no idea what the pattern is, what it's useful for, and why other solutions wouldn't work as well. What is ...
3
votes
1answer
287 views

Reading from a file and inserting into a database, a good practice

I am making an Android application which reads several JSON files and inserts the read information into tables in my database. For instance, there are three files: countries.json { ...
3
votes
1answer
170 views

Naming a sending/receiving module. Does the pattern have a name? [closed]

I'm working on a simple piece of functionality (actually a ruby gem, but that is beside the point) which can be used to receive and persist incoming messages send and persist outgoing messages ...