Relative Content

Tag Archive for coding-style

Should I use C style in C++?

As I’ve been developing my position on how software should be developed at the company I work for, I’ve come to a certain conclusion that I’m not entirely sure of.

Using ‘new’ in a projection?

I wish to project a collection from one type (Something) to another type (SomethingElse). Yes, this is a very open-eneded question, but which of the two options below do you prefer?

Pythonic use of the isinstance function?

Whenever I find myself wanting to use the isinstance() function I usually know that I’m doing something wrong and end up changing my ways. However, in this case I think I have a valid use for it. I will use shapes to illustrate my point although I am not actually working with shapes. I am parsing XML configuration files that look like the following:

Question on refactoring and code design

Suppose, I have a class with a constant static final field. Then I want in certain situations that field to be different. It still can be final, because it should be initialized in constructor. My question is, what strategy I should use: