class-design

C++, preventing class instance from being created on the stack (during compiltaion)

I know there are methods to prevent a class from being created on the heap, by preventing the user from using the new and delete operator. I am trying to do just the opposite. I have a class that I want to prevent the user from creating an instance of it on the stack, and that only instances instigated using the new operator will compile...

How to start with class design for an enterprise application?

How can i start with the class design before starting the development of a large application (both WinForm and WebApp). What are the initial 'be-careful' things i should check before designing the class structures? How to identify the usage of interfaces, abstract classes, delegates, events etc in my application design? ...

Is it accepted to use a private method instead to avoid virtual members in constructor?

AFAIK, It's agreed that accessing virtual members from constructor is a dangerous practice. Can we overcome this through using an additional step, a method, to make required initialization? like the following: public class EntityAlpha { public virtual string Value { get; protected set; } public EntityAlpha(string value) { ...

Question About Which Design Pattern To Use

Given two classes: First class performs AES encryption / decryption and returns encrypted / decrypted data given a certain key and chain. Second class gathers data to be encrypted and then passes it to the encryption / decryption class. Is it proper design to call directly the encryption class from the class that gathers the data or s...

Create object connection in iphone and xml

Hello, I need help with this. I developing an iphone app and I need to connect to the server from diferents views. So I was thinking like in java or C, I mean, A possible solution is to create a class and embed the connections for the app. I write an example: int ObjServer.ValidateUser(user:string,passwd:string) NSMutableArray ObjServ...

Redeclaring a class on update

Hey, I am having a small problem when it comes to redeclaring a class. I made an update function that calls to a remote server, gets the files/classes, and updates it on the current server. The problem is I have to use a class the has been declared already because the new class contains features that have been updated. I've been trying...

Design(How-to) of classes containing collections of other classes

Hi Everyone, How to design classes involving collections of other classes? General Example: A Workspace contains number of Projects . A Project contains large number of Resources . Each Resource may contain large number of Files. So here the classes identified can be Workspace,Project,Resource and File. Workspace will have list ...

SOA WCF class design for collections of objects, or "has-a" object situations.

We are designing an object model from scratch for an application that will expose data via WCF. We are wondering about how to handle the case where objects that have a collection of objects within them. For example, a contact object with a collection of address objects. contact - list<address> Should we have a wrapper object, somethi...

How best design a scalable class?

Hi, what I mean by that is: I basically have a class that has too many properties and functions now. To remain performant and understandable, it needs to shrink somehow. But I still need all those properties and methods somewhere. It's like this right now: class Apple float seedCount; ... ...about 25 variables and properties here...

new types may not define a return type - C++

I am confused I think on C++ class structure. I have a .h called FxMathFunctions.h and a .cpp called FxMathFunctions.cpp the .h starts like: class FxMathFunctions { public: FxMathFunctions(); ~FxMathFunctions(); and in the .cpp I have: #include "FxBasicTypes.h" #include "FxMathFunctions.h" FxMathFunctions::F...

If you could substantially alter Java's classpath libraries, whichdifferent decisions would you make?

If you had the chance to significantly change/update Java's classpath libraries, which things would you add/update/change/deprecate/remove? ...

Creating java inline(?) methods

I'm not sure what it's called exactly, but I was wondering how you can create a class which you can call multiple methods on in one call. For example, using an android class but it doesn't really matter, you can call all of the class' methods at once: AlertDialog.Builder().setItem().setTitle().setPositiveButton().setCancelable() ...etc...

design workflow/flowchart representation in python ?

In my web application I have wizards with many next previous buttons and choices ( kind of flow chart with events and options ). Wizard do not run in one go, but may wait for external event, user come later or next day to carry on with that wizard. Currently I am manually writing code ( hard coded ) for each states of a wizard ( or a flo...

Python object oriented model

I have something like the follwing. A person having many colors of cars of the same model belonging to some state. I have designed a person class as having attributes person name, car model, car year, car state, and car color as attributes. And color should be a list as a person can have many cars of different colors but of the same mo...

Can I force a dependency between namespaces in C#

Can I restrict classes from a specific namespace from referencing classes in another specific namespace? Both namespaces exist in the same .NET assembly. Example: namespace LegacyCode { class LegacyClass { ... } } namespace NewCode { class NewClass {...} } I do not want classes from 'NewCode' to be able to reference classes ...

Python - "object layout"

Hi, can somebody describe the following exception? What is the "object layout" and how it is defined? Thanks Traceback (most recent call last): File "test_gui.py", line 5, in <module> suite = AlgorithmEngine('gui_suite') File "/home/honza/Research/Voiar/algorithm.py", line 169, in __init__ self.algorithms = self._initAlgorit...

Should I be using inheritance?

This is more of a subjective question, so I'm going to preemptively mark it as community wiki. Basically, I've found that in most of my code, there are many classes, many of which use each other, but few of which are directly related to each other. I look back at my college days, and think of the traditional class Cat : Animal type exam...

Class design: Last Modified

My class: class ManagementReview: """Class describing ManagementReview Object. """ # Class attributes id = 0 Title = 'New Management Review Object' fiscal_year = '' region = '' review_date = '' date_completed = '' prepared_by = '' __goals = [] # List of <ManagementReviewGoals>. __objecti...

Unit testing: More Actions than Expected after calling addAction Method

Here is my class: class ManagementReview(object): """Class describing ManagementReview Object. """ # Class attributes id = 0 Title = 'New Management Review Object' fiscal_year = '' region = '' review_date = '' date_completed = '' prepared_by = '' __goals = [] # List of <ManagementReviewGoals...

ActionScript 3 - Returning/inspecting class value on declaration

Hello there, I'm wondering if is there any way to mimic the same behaviour we have for top level classes in AS3 for example: var myArray:Array = [1,2,3,4]; trace(myArray) // [1,2,3,4]; As you can see it returns the own object when tracing it. but if I create my own class that extends Array I get var queue:Queue = new Queue([1,2,3,4]...