How far should I expose this status enum?
I wrote a little app to manage an arbitrary series of tasks (e.g., call a SQL sproc and capture out-vars, run another app, run an SSIS package) with dependencies between tasks. Each task has a status (waiting to start, failed and waiting to retry, failed and abandoned, succeeded, etc.). Internally, each Task
object has a field of the TaskStatus
enum type. There’s a TaskManager
object which starts tasks and monitors their successes and failures, and a Dashboard
WinForm which displays progress.
is ‘protected’ ever reasonable outside of virtual methods and destructors?
so, suppose you have some fields and methods marked protected (non-virtual). presumably, you did this because you didn’t mark them public because you don’t want some nincompoop to accidentally call them in the wrong order or pass in invalid parameters, or you don’t want people to rely on behaviour that you’re going to change later.
JavaScript objects and Crockford’s The Good Parts
I’ve been thinking quite a bit about how to do OOP in JS, especially when it comes to encapsulation and inheritance, recently.
What is the use of Association, Aggregation and Composition?
I have gone through lots of theories about what is encapsulation and the three techniques of implementing it, which are Association, Aggregation and Composition.
How to TDD test that objects are being added to a collection if the collection is private?
Assume that I planned to write a class that worked something like this:
What should be allowed inside getters and setters?
I got into an interesting internet argument about getter and setter methods and encapsulation. Someone said that all they should do is an assignment (setters) or a variable access (getters) to keep them “pure” and ensure encapsulation.
Architecture Best Practice (MVC): Repository Returns Object & Object Member Accessed Directly or Repository Returns Object Member
Architecturally speaking, which is the preferable approach (and why)?
Is there a database programming language with encapsulation to prevent the injections?
One of things that annoys me about SQL is that it can’t think in terms of objects and it’s lack of encapsulation makes me constantly have to escape commands to prevent injections.
How important is encapsulation? [duplicate]
This question already has answers here: When are Getters and Setters Justified? (14 answers) Closed 11 years ago. As a student in programming, I learned that encapsulation is one of the most important principles of object-oriented programming. However, I only follow that principle when I feel like it suits my purpose. I sometimes leave internal […]
Immutable vs mutable object as returned parameter for class method [closed]
It’s difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago. There is a class method (static method) in […]