Top "Code-design" questions

C++: How to design a utility class?

But I don't know if I should go for static methods, just a header, a class, or something else? What …

c++ utilities code-design
Multiple If-else or enum - which one is preferable and why?

Here is the original code: public class FruitGrower { public void growAFruit(String type) { if ("wtrmln".equals(type)) { //do watermelon growing …

java enums if-statement code-design
When is a class too long?

When is a function too long? is a subset of this question, I think. What are a few good metrics …

oop code-design
java generics - cast to List<SomeType> issues unchecked cast warning while cast to SomeType not

Why this : public <T> List<byte[]> getData(T data) { Location loc = (Location) data; // ... } does not generate …

java generics casting type-safety code-design
How and when to dispose/garbage collect a singleton instance

I am using a Singleton instance created out of a nested class. This instance holds some static collections which are …

c# garbage-collection singleton idisposable code-design