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

3
votes
1answer
58 views

Correct practice for Python properties that depend on other attributes

When a property is essentially a boolean value for whether or not an attribute exists or is set a certain way, is it more appropriate to create an object that does not list the option attribute in its ...
4
votes
1answer
67 views

Downloading and Loading Remote Game Assets

On advice from an answer to my previous question, I have written some code that will allow my game balance properties to be loaded from a remote server. Right now I am just hosting the raw property ...
2
votes
2answers
104 views

DataTable to given type T simple mapper

I threw this together and would love any suggestions on how to improve on this simple DataTable to given Type T mapper. Anything ...
13
votes
3answers
831 views

Using C# properties for simple operations, where should I draw the line?

Should I be putting Linq statements inside of an objects properties? Is that a best practice or is that a no no? Also if that is ok, where do I draw the line with this? I assume db access is ...
3
votes
1answer
44 views

Updating properties and states

I am rewriting a VB.NET application in C#. This code was originally done in 50 lines and I am trying to clean it up. As you can see I have gotten it down to 10 but I still feel its ugly. I want to ...
3
votes
1answer
57 views
6
votes
2answers
292 views

How to Make Strongly-typed References to Web.Config?

Let's say I have a configuration file with a property in it: <add key="LoadedCode" value="L" /> I know I can reference this using the ConfigurationManager: ...
1
vote
1answer
70 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
56 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
115 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
110 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
168 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
191 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
55 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++. ...
7
votes
3answers
6k 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: ...
46
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
63 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
348 views

Recursive java.util.Properties references

Background A subclass of java.util.Properties attempts to recursively resolve configured properties: ...
8
votes
3answers
403 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
171 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
317 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
400 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
522 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 ...
8
votes
1answer
3k 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 ...