Tag Info

New answers tagged

0

There are times when it would be helpful to be able to define a data type that would hold a reference to an immutable object, but would behave as an immutable object, rather than a reference, such that code written as: thing.foo(bar); would compile as a call to a static method: classOfThing.do_foo(thing, bar); where the static method could then handle ...


0

Depending on your scenario, you either would expose your collection as a ReadOnlyCollection (or the like, depending on your programming language), or you would use an ObservableCollection (that has events for add, remove, etc), which will allow you to react to changes. Consider if the latter is really necessary though. In most scenarios you would go the ...


1

It is good practice not to expose contained collections directly to clients. There is a list of "standard" methods that you typically provide on the containing class to manage the relationship (get all, add, remove, etc.). In theory, it's advised that you don't ever return the actual collection to the client, rather an immutable copy of it containing the ...


0

I will take the risk and assume that you have modeled the data as close to the source as possible. In this case: The List messages is just a structure, and yes it has a lot of method that you can use, but this methods are technical methods, normal operations on a List class. You want to create methods in the Command class that are more human readable by ...



Top 50 recent answers are included