A property, in some object-oriented programming languages, is a special sort of class member, intermediate between a field (or data member) and a method. Properties are read and written like fields, but property reads and writes are (usually) translated to get and set method calls.

learn more… | top users | synonyms

1
vote
0answers
51 views

Getter Setter conventions [closed]

In C# I am creating properties in different ways. Like this: public Dimension X { get; set; } and like this: ...
1
vote
1answer
64 views

How to make a class aware of the container class? [closed]

I would like to group some property from the class UserParameter into a subclass called MySubClassPar. Then I will add a property of type MySubClassPar to the UserParameter. All this for the SRP. The ...
10
votes
7answers
2k views

Inefficient code inside of getter?

I have two lists of the same type and I want to be able view a list of both lists: ...
2
votes
1answer
42 views

Create object-properties from an array

I'm writing a simple table-oriented storage for objects. The schema of a table is stored in the columns-array and the data in the ...
2
votes
1answer
71 views

“Property Container” design-pattern

I've tried to write my Property Container design-pattern implementation. Could anybody, please, tell me, if this code is really what I intended to write (follows ...
5
votes
1answer
85 views

How to name a read-only Collection property

I think good naming is an important part of maintainable and good usable code. One rule we have for that is that properties must start with a capital letter. We have an API here which can be ...
6
votes
3answers
148 views

How to refactor this code to get a source from property files?

I want to get the source of these files, but I don't know if I'm efficient. I get the source of the file, put the source in a list, so I put this in a ...
10
votes
2answers
173 views

Best way to handle elements of a private array

This feels like a simple question, but I'm wondering what the best way would be to manage the elements of a private, fixed-size array. Context: I'm making a simple particle engine, and my ...
3
votes
1answer
48 views

Generic Property class

Some time ago I wrote a little property class for a then abandoned project. I just stumbled over it again and I would like to know if the design is using good, efficient C++. ...
5
votes
3answers
1k views

Grouping elements in array by multiple properties

During work, I was given this task: to group elements with similar properties in the array. In general, the problem is as follows: ...
44
votes
9answers
3k views

Mutually exclusive properties

The question is probably quite simple, but I would like to hear what drawbacks we will have with our code. So, we had a simple implementation and interface for it: ...
2
votes
1answer
60 views

Property getter implementation

I always see something like this: - (NSMutableArray*)items { if (_items == nil) _items = [NSMutableArray array]; return _items; } Recently I ...
1
vote
1answer
226 views

Recursive java.util.Properties references

Background A subclass of java.util.Properties attempts to recursively resolve configured properties: ...
8
votes
3answers
389 views

Class with a sometimes unused property

From times to times I stumble over the following situation: I have got a class with a property that's only used if another property has a particular value, for instance: ...
2
votes
1answer
144 views

Is it correct to use delegates as properties?

I need to create a class with two properties: LogOutput ExceptionOutput These properties (of type ...
2
votes
1answer
303 views

My implementation of javascript class library

I'm reading a book called JavaScript Web Applications. In first chapter, it introduces an implementation of class library. Here's an intermediate version: ...
2
votes
4answers
357 views

Is there anything wrong with this unusual NSMutableArray setter?

This behaves to an outside observer mostly like @property (copy), except it has the very nice property of automatically performing any side effects that may exist ...
3
votes
2answers
408 views

Immutable pure data classes with public setters on properties

I'm putting together some classes as a model for some information (that I'm currently pulling from a website). The classes are implemented in C# - because in the current version of F# there are no ...
7
votes
1answer
2k views

C#-like class properties

I am currently developing a new breed of 3D engine for my upcoming thesis and I really liked the C# properties, but now I am on C++11 for obvious reasons. Since I couldn't find it elsewhere, I tried ...