|
That's just as well. I often like to ask experienced programmers how they do it, and the answer I've often got was 'pencil and paper' The reason is simple: there's always some tidbit of information you want to add and don't know how to using a specific type of diagram, so the easiest way is just to do it in the way you're most comfortable with.
As I said, my main reason for using class diagrams is that it generates code as well. but I still use pencil and paper quite a lot.
|
|
|
|
|
Start using UML, it's very simple and the key point is it is a very common method for system modelling and understandable by computer professionals and laymen alike. If you use something like UMLet[^], my personal choice and it's free, you'll find it very easy to draw diagrams and will soon get the hang of it.
Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
|
|
|
|
|
Hi,
I'm in the process of defining some classes for the elements in a type of listbox control. I'm thinking about having a parent class from which, each element inherits, with common information such as ID, title etc. But the individual elements in the list will have properties that are specific to their own type. Some will have a fileName attribute while others wont.
The parent class is handy for sorting operations and other generic tasks, but I will need to differentiate between the instances at some point in my code. Should I have a type attribute in the parent class to tell me what attributes to read for a specific instance? I don't wan't to have virtual members in my parent class that are only meaningful for some instances.
Maybe the elements don't have enough in common to warrent inheritance?! BTW, I will not have access to reflection techniques to tell me which type and instance is. Unmanaged C++ to be exact.
Thanks.
|
|
|
|
|
lclarsen wrote: Should I have a type attribute in the parent class to tell me what attributes to read for a specific instance
Down this path lies insanity. I am afraid I go back to my database for my entity definitions, if I can make a view of it then I ain't gonna build it. Taking the attributes structure too far is really difficult to support, you almost need a data dictionary just to find out what you are looking at.
I must admit I rarely use inheritance, possibly b/c I don't automatically see the connection between objects.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
lclarsen wrote: The parent class is handy for sorting operations and other generic tasks, but I will need to differentiate between the instances at some point in my code. Should I have a type attribute in the parent class to tell me what attributes to read for a specific instance? I don't wan't to have virtual members in my parent class that are only meaningful for some instances.
The code should be using helper-methods from the object, and not refer to specific properties directly.
Take the <a href="http://msdn.microsoft.com/en-us/library/system.icomparable.aspx">IComparable</a>[<a href="http://msdn.microsoft.com/en-us/library/system.icomparable.aspx" target="_blank" title="New Window">^</a>] interface; it's the object's that tell the Sort method how to compare the items in order to sort them.
Bastard Programmer from Hell
|
|
|
|
|
lclarsen wrote: don't wan't to have virtual members in my parent class that are only meaningful for some instances.
I understand your concern here, but it reminds me of a cooking expression. If you are going to make an omelet, you have to break some eggs. Yes the parent will need to implement a 'default' implementation for each, but that is just the nature of the beast.
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
|
|
|
|
|
That's where we separate concerns using interfaces. It's not required for the base to implement all members, we can implement interfaces at a higher level. That way we don't force a specific set of members up the inheritance-chain, and still have the luxury of interacting with a part of the inheritance-set using a common interface .
Bastard Programmer from Hell
|
|
|
|
|
Chris,
I guess I was hoping you could offer some powdered eggs or something, so I wouldn't have to break any
Anyway - the conclusion seems to be there isn't really any perfect solution to this. I somehow suspected that. Thanks for the input everyone
|
|
|
|
|
You can use interfaces to get around the problem. Each of the child classes implements an interface that it needs to support. And then you can use code like this to check if you need to call some method on the child items.
ItemBase item = listControl.Items[x];
if (item is IFileItem) {
IFileItem fileItem = item as IFileItem;
fileItem.Save();
}
|
|
|
|
|
lclarsen wrote: I'm in the process of defining some classes for the elements in a type of listbox control.
This is a display problem.
lclarsen wrote: The parent class is handy for sorting operations and other generic tasks, but I will need to differentiate between the instances at some point in my code.
This looks like it isn't a display problem.
So two possibilities exist.
1. The logic really has nothing to do with the display problem. So what is the problem?
2. The logic is about display. Then it is simple, don't mix display logic and business logic.
|
|
|
|
|
The question I always ask myself to find out what kind of relationship two objects really have, is whether it's a 'is a' or 'has a' relationship. E. g. a Mercedes 'is a' car, so it inherits all methods and properties of a generic car. And it 'has a' three-pointed star. You wouldn't inherit a 'Mercedes' from a three-pointed star, would you?
Your case sounds more like a 'has a' relation ship, in that all the other classes 'have' an ID, title, etc.. The obvious way would be to just let every class have these members, but if all classes are going to have the same 3 or 4 member variables, then chances are these belong together in a class of it's own. or maybe just a struct:
struct ID {
int id;
std::string title;
};
class MyDialog {
ID id;
};
class MyButton {
ID id;
};
Now you need to decide if that is sufficient for the operations you want for these classes. You will get a bit of redundance this way: e. g. accessors for each class that uses ID. But I see no reason to have virtual methods or inheritance.
|
|
|
|
|
sexy girlï¼video for adult ï¼ more than 30 videos.http://sharecash.org/download.php?file=2531204
|
|
|
|
|
Hi,
I have a conflict while designing a tree, with each child has the option of getting deleted individually.
I have designed a tree view with say some 5 children to it, each having the option of getting deleted. At the same time for the whole tree view, I have the option of Saving the changes performed to the tree and Reset them to previous state.
I need a suggestion, is it wise to restore a deleted child, during the RESET of the tree view? I can foresee a design flaw in this.
Thanks
Ambe
|
|
|
|
|
I rarely have to support UnDo/Restore/Oops functionality as it has very limited use in LOB work. I usually take a copy of the data before loading the tree, if the user wants to cancel changes simply reload the tree from the copy. I do not allow them to undo past a save so after a save I update the copy with the current data.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I total agree with this method. That is how I do it. Makes the logic a lot easier and usually makes the user happy.
|
|
|
|
|
Ambe wrote: I have designed a tree view with say some 5 children to it, each having the option of getting deleted. At the same time for the whole tree view, I have the option of Saving the changes performed to the tree and Reset them to previous state.
I need a suggestion, is it wise to restore a deleted child, during the RESET of the tree view? I can foresee a design flaw in this.
Not during the reset, but after. I'm usually copying the complete internal state into a Memento-pattern, simply restore from there when required. Yes, users can undo after they saved, marking the document dirty again.
Bastard Programmer from Hell
|
|
|
|
|
Hello all,
I have been assigned a task to work with few in-house developers in developing our internal Employee Portal which include, Time Tracker System, HR Portal, Performance Tracker and Asset management System, All deployed on one Windows Small Business Server.
The requirements gathering and documentation is almost done and we are about to start working on core development.
However, as I lack a project level knowledge while developing web applications. Can I get help on what best practices should I be implementing even from the database design stage?
The application is intended to be interacted by close to 200 people and half of them concurrently, at times. Most of the data tables are expected to be use by different modules of the same application.
Any help with guidelines to be followed while designing the database and application layers, will be greatly appreciated.
You can send me an email sunilsasadm@gmail.com
Thank you
|
|
|
|
|
First off I would look for an existing package and see if it meets your requirements.
If between you and Sunil Kokkiligadda wrote: few in-house developers you do not have any architecture skills I suggest getting in a consultant to do the initial work for you, at least the data structures. You are not going to be able to build such an application from forum support.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
My rates are pretty competitive if you need some professional help...
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
Can I have a detailed info on the services, in this context, that you can provide and your price?
You can send me a personal email.
|
|
|
|
|
I was being sarcastic.
BTW: you shouldn't put your email address in a post: you'll get spammed.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
tart
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
It doesn't take a Sherlock level of intelligence to jump on an opportunity like that. (useewhatididthar?)
I personally commend him!
Don't forget to rate my post if it helped!
"He has no enemies, but is intensely disliked by his friends."
"His mother should have thrown him away, and kept the stork."
"There's nothing wrong with you that reincarnation won't cure."
"He loves nature, in spite of what it did to him."
|
|
|
|
|
Hi sunil,
Back end plays major role in any application. So while you are developing the Employee Portal ,take help from the experts and start learning from it.
Hope you will be good DB Designer.
Regards,
Srinivas
|
|
|
|
|
I currently working on a project in MVC .net and I found my self asking how far is to far for separation of concerns? A little back history. The project I am working on is separated into business logic, data access, and business entity layers. It is a web app that is developed using the MVC pattern so it also has Controllers and Views. We are currently using our business entity objects as our model for this project. But now one of the developers I work with wants to implement view models that inherit from the business entities. 99.9% of the time the view model will just be an empty class that inherits from the business entities. I am against using adding another layer to the app and I want to find out what some other peoples opinions are.
|
|
|
|