class-design Questions
9
Solved
I've used try and catch statements as an easy way to keep my code running without things crashing (I would wrap everything in a big try). Recently, I've wanted to start using try and catch statemen...
Hundredth asked 14/2, 2011 at 20:36
3
Solved
So I'm not actually sending arguments, but setting a class variable to a certain value, then using it again in another method. Is this the "best practice" way to do things? If not, I'd be intereste...
Strathspey asked 11/2, 2011 at 16:23
2
Solved
I am trying to create a function that is passed a parameter x and returns a new class C. C should be a subclass of a fixed base class A, with only one addition: a certain class attribute is added a...
Astrea asked 1/2, 2011 at 2:28
2
Firstly yes - this is subjective.
I have noticed lately a few libraries seem to be using the let the user tag listener methods in some class as listeners using different annotations to note diffe...
Witness asked 29/1, 2011 at 10:9
3
Solved
Immutable classes are great but there is one big problem i cant think of a sensible way to solve - cycles.
class Friend {
Set<Friend> friends();
}
How does one model Me having You as a fr...
Benedictus asked 29/1, 2011 at 1:29
5
Solved
My questions are:
When should we use value types and when reference types?
What are the advantages and disadvantages of one over other?
What if one uses reference types everywhere? Is there any h...
Hashim asked 19/1, 2011 at 18:36
2
Solved
I'm trying to understand a bit how Python (2.6) deals with class, instances and so on, and at a certain point, I tried this code:
#/usr/bin/python2.6
class Base(object):
default = "default value...
Leprosarium asked 21/1, 2011 at 20:59
3
Solved
I am looking for some class structure help. Lets say I have a class called Dog holds information about the dog (name, weight, type) but because there could be multiple dogs, I would also like a cla...
Angele asked 19/1, 2011 at 15:14
2
Solved
I have the following class structure:
public class Team {
...
}
public class Event {
}
public abstract class Fixture<T extends Team> implements Event {
...
}
public abstract class Fore...
Pearlypearman asked 15/1, 2011 at 17:10
5
Solved
I'm interested in objective analysis of which is more performant; calling instance methods of a singleton class or methods of a static class. I've already seen this so I'm not looking for a discuss...
Farlie asked 5/8, 2010 at 19:48
3
Solved
Those of us who have seen the beauty of STL try to use it as much as possible, and also encourage others to use it wherever we see them using raw pointers and arrays. Scott Meyers have written a wh...
Welfarism asked 9/1, 2011 at 16:30
4
Solved
What is the best way to share data between separate classes in Java? I have a bunch of variables that are used by different classes in separate files in different ways.
Let me try to illustrate a ...
Wristlet asked 12/12, 2010 at 0:37
3
Solved
In this thread I found some interesting moment, If class uses only as superclass there isn't rule to make it abstract. Why so?
Thanks
Routinize asked 30/11, 2010 at 6:57
2
Solved
Possible duplicate: why-is-java-lang-throwable-a-class
Hi! I doesn't understand why Throwable isn't abstract class. I see only one use case for these: in logging systems for figure out call hierar...
Endothermic asked 29/11, 2010 at 17:19
5
Solved
I'm looking for a solution for this problem in C or C++.
edit: To clarify. This is on a linux system. Linux-specific solutions are absolutely fine. Cross-plaform is not a concern.
I have a service...
Rigging asked 24/11, 2010 at 16:31
7
Solved
Please have a look at the two simplified examples of designing a class aggregation below.
Solution 1
Header
// need include, forward declaration is not enough
#include "door.h"
class CGarage
{
...
Sepaloid asked 23/11, 2010 at 11:52
4
Solved
I am college student (computer science) and have just started a C# programming class.
For our assignments I have been using a class called "Display" where I put any console output that could be use...
Oakum asked 21/11, 2010 at 10:5
6
Me and a colleague are having a debate:
We have a singleton class that is used at multiple places in our code base.
Originally, the class was designed in such a way that you could get the class o...
Loralyn asked 5/11, 2010 at 21:28
2
Solved
I have 2 classes: DataObject and DataElement. DataObject holds pointers to (only) DataElements, and a DataElement contains pointers to several types, among which a DataObject.
This used to be no p...
Twig asked 25/10, 2010 at 16:2
5
Solved
Possible Duplicate:
How will I know when to create an interface?
I'm wondering about the point of using an Interface.
Do you use Interfaces? If so, when do you decide to use them an...
Birddog asked 19/10, 2010 at 18:12
4
Solved
I am supposed to write a simple Cinema Booking System, which allows a customer to make reservations for movies.
The Cinema consists or different theatres, with different amount of seats, price and...
Robinrobina asked 17/10, 2010 at 1:33
6
Solved
I am in a classic design dilemma. I am writing a C# data structure for containing a value and measurement unit tuple (e.g. 7.0 millimeters) and I am wondering if I should use a reference type or a ...
Perreira asked 6/10, 2010 at 13:15
11
Solved
If I create a class MyClass and it has some private member say MyOtherClass, is it better to make MyOtherClass a pointer or not? What does it mean also to have it as not a pointer in terms of where...
Radial asked 6/10, 2010 at 10:11
5
Solved
Or in more specific words, is it "ok" to not be relying on setters and getters?
I'm dealing with a class that checks the availability of rooms and sets public properties of which there are more th...
Konstanze asked 8/2, 2010 at 21:40
5
Solved
Currently I'm in the process of writing a client class that utilizes DNS, Sockets, and SSL among other classes that love to throw exceptions. Other people will be implementing this class, so I was ...
Engaging asked 9/8, 2010 at 19:42
© 2022 - 2024 — McMap. All rights reserved.