The tag has no wiki summary.

learn more… | top users | synonyms

3
votes
2answers
200 views

Which programming idiom to choose for this open source library?

I have an interesting question about which programming idiom is easier to use for beginner developers writing concrete file parsing classes. I'm developing an open source library, which one of the ...
0
votes
3answers
72 views

clone() only partially doable; how to react?

Suppose we have a class-hierarchy whose base class B requires a clone() method to be defined in its derivations. Whilst this works perfectly for most of them there is this one derivation X that holds ...
5
votes
1answer
109 views

Why are F# exceptions generally not suffixed with 'Exception'?

In .NET, it is idiomatic to suffix exception types with Exception. But most, if not all, sources I have seen for custom exception types in F# don't follow this idiom. Most seem to use the suffix ...
0
votes
0answers
33 views

Is there a good idiom for handling an in-line startActivityForResult

I have a bunch of Java code that looks something like this. //Global boolean something_result; Monitor something_monitor; // Some class on worker thread Intent intent = new ...
0
votes
2answers
232 views

help me understand Rails and attributes as class methods

This is from the Hartl Rails tutorial. We are automatically logging in a user in the process of creating that user with a callback to #create_remember_token. It works great but there are some things, ...
3
votes
2answers
278 views

Intersection of geometric entities

I was trying to design a small C++ geometric API for learning purposes, but came across a problem when dealing with intersections of geometric entities. For example, the intersection of a line and a ...
4
votes
6answers
1k views

Coding style for chained function calls

A common thing you need to do is to take a value, do something with it by passing it to a function, and then do some more with the return value, in a chain. Whenever I run into this type of scenario, ...
4
votes
1answer
276 views

Object oriented wrapper around a dll

So, I'm writing a C# managed wrapper around a native dll. The dll contains several hundred functions. In most cases, the first argument to each function is an opaque handle to a type internal to the ...
12
votes
5answers
818 views

What problems can arise from emulating concepts from another languages?

I've read many times on the web that if your language doesn't support some concept, for example, object orientation, or maybe function calls, and it's considered a good practice in this other context, ...
3
votes
1answer
609 views

Dummy float values to force floating-point operations

It is common to use idioms such as: x/60.0 to force a floating-point division when x is an integer in languages which do not have distinct operators for integer and decimal division. Is this an ...
2
votes
4answers
2k views

C++ Iterator lifetime and detecting invalidation

Based on what's considered idiomatic in C++11: should an iterator into a custom container survive the container itself being destroyed? should it be possible to detect when an iterator becomes ...
5
votes
3answers
346 views

Filesystem like permissions for C++ type-members

Abstract (tl;dr) Please read the full question, this is awfully simplified: How can unix file permission style restrictions be applied to inter-type data/control flows, allowing fine-grained access ...
2
votes
3answers
439 views

design pattern for describing a variable subpart of a config file

Suppose I have an XML config file like the following: <myapp> <settings/> <output> <mailto>mail service configuration parameters</mailto> ...
10
votes
3answers
913 views

What is the equivalent of Josh Bloch's “Effective Java” for Objective-C/Cocoa? [closed]

I'm a newcomer to Objective-C and Cocoa but a reasonably experienced Java programmer. When I was starting out, reading Josh Bloch's Effective Java made me a 20% better Java programmer overnight. As ...
32
votes
10answers
3k views

Difference between Idiom and Design Pattern?

What is the difference between idiom and design-pattern? It seems that these terminologies overlap somewhere; where exactly, I don't know. Are they interchangeable? When should I use what? Here is a ...
9
votes
7answers
2k views

What is idiomatic?

I understand an "idiom" to be a common operation or pattern that in a particular language is not simplified by core language syntax, such as integer increment: i = i + 1; In C++, this idiom is ...
5
votes
3answers
747 views

When we say “sanity” when referring to user input, are we talking about the cleanliness of the input or whether or not it is sane?

I often hear people say they "sanitize input," which would mean make it clean. I understand this to mean "clean of potentially damaging contents," where the function that does the sanitizing would do ...
2
votes
1answer
829 views

Best resources for learning idiomatic PHP [closed]

My experience has primarily been in Java, but I'm working on a PHP project and conscious of my lack of knowledge of idiomatic PHP. What resources (online or print) will help me avoid making the ...
14
votes
11answers
2k views

Does programming knowledge have a half-life? [duplicate]

In answering this question, I asserted that programming knowledge has a half-life of about 18 months. In physics, we have radioactive decay which is the process by which a radioactive element ...
6
votes
4answers
816 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 ...
4
votes
2answers
535 views

How to program for constraints/rules

First the background, during interviews in the past, many times I have been asked to design some or other variation of card game as programming puzzle, and I have tried to design it in OO way, but I ...
14
votes
6answers
1k views

Representing business rules with exceptions

I know it is expensive but (IMO) I believe it is a very good practice. I'm talking about rules like say, you can't save an Invoice if you are not a sales person... so in that case throwing an ...
8
votes
2answers
1k views

What does 'opinionated software' really mean?

I've seen a lot of other framework/library developers throw the phrase 'we write opinionated software' around, but in practical terms, what does that really mean? Does it mean that the author of the ...