Tagged Questions

1
vote
3answers
220 views

how to nicely use constant std::string in c++

In my current code project, there is an awful lot of constant strings I use to print out error messages. Hardcoding such strings is generally considered to be bad practice. Now I'm searching for a ...
9
votes
9answers
429 views

Passing member variable as a method parameter

In a project, I've found a code like this: class SomeClass { private SomeType _someField; public SomeType SomeField { get { return _someField; } set { _someField = value; ...
6
votes
3answers
302 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 ...
3
votes
2answers
162 views

How to go about bring up the topic of bad programming practices with colleague [closed]

Possible Duplicate: How do I approach a coworker about his or her code quality? My development colleague is producing numerous blocks of code which I am a bit concerned doesn't really make ...
8
votes
7answers
416 views

Keep my classes and methods as small as possible?

A few days ago, I was talking to a Software Engineering PhD candidate and at some point she said to me: Keep your classes and methods as small as possible And I wonder if this is always a good ...
22
votes
7answers
765 views

How can I learn to effectively write Pythonic code?

I'm tired of getting downvoted and/or semi-rude comments on my Python answers, saying things like "this isn't Pythonic" or "that's not the Python way of doing things". To clarify, I'm not tired of ...
37
votes
10answers
3k views

Should I reuse variables?

Should I reuse variables? I know that many best practice say you should not do it, however later when different developer is debugging the code and have 3 variables that look a like and only ...
16
votes
13answers
139 views

How to name parts of your program as a non native English speaker [closed]

Possible Duplicate: Do people in non-English-speaking countries code in English? I am from the Netherlands and we speak Dutch. I have worked on quite a few projects now in various ...
2
votes
5answers
378 views

Minimising little coding mistakes

I make a fair amount of small mistakes when I code (things such as getting an angle bracket to the wrong direction). It adds a fair amount of time to my coding because I have to debug several times ...
9
votes
5answers
444 views

Why have a method that returns a bool/int and has the actual object as an output parameter?

I see the following code pattern all over the place in my company's codebase (.NET 3.5 application): bool Foo(int barID, out Baz bazObject) { try { // do stuff bazObject ...
6
votes
5answers
287 views

How do you get consistency in source code / UI without stifling developer's creativity?

We have a small team (2-3) of programmers writing a program with a lot of forms and dialogs. We have a problem where we cannot keep good consistency in what we write, or how we write it. The latest ...
8
votes
6answers
757 views

What should my “code sample” look like?

I've just had quite a good phone interview (for a CakePHP-related position, not that it's especially important to the question). The interviewer seemed to be impressed with my resume and personality. ...
9
votes
10answers
2k views

What's wrong with circular references?

I was involved in a programming discussion today where I made some statements that basically assumed axiomatically that circular references (between modules, classes, whatever) are generally bad. ...
20
votes
9answers
966 views

What is the best written code you ever have seen on a public project? [closed]

What project follows what every programmer says about programming best practices? What project has good comments documenting the code properly and has good, clean, elegant and readable style, unit ...