|
Also somehow I need to have a list of possible tags, for the parsing -private- method..
Maybe another class, TagAnalyzer?
|
|
|
|
|
If one or more private methods of a class need a variable to perform some operation on, should one methods pass it to the other as parameters or should we make the parameter a private member of the class so both methods can access it?
If we make it a class level variable then it will exist for the lifetime of the object. If we do not need it for the lifetime of the object, we are wasting resources.
If we do not make it a class level variable then we have to pass it around to methods which need it. I am not sure what the disadvantage is here.
If the class has 7 methods and 5 of them need the variable then we will pass it around to all these methods. If class level, then we will not need to pass it but it will exist for the lifetime of the object.
Should it depend on how many different methods need the variable or should it depend on whether we need its existence for the lifetime of the object?
What are your opinions? Any conventions?
CodingYoshi
Visual Basic is for basic people, C# is for sharp people. Farid Tarin '07
|
|
|
|
|
Hi,
it depends on the circumstances.
If the parameters are like characteristics of the objects, then data members would be alright.
If they are small, then having storage allocated for them for the lifetime of the object probably is irrelevant.
If they more act like operational parameters, seems to me method parameters are in order; if they are many, you may want to create a separate struct or class to hold them and pass them around easily (kind of "job ticket").
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
I'm lookin for a design-pattern that match what I need: I have class A which should hold a collection of class B or its inehrited classes. class B should be able to run functions and access properties on A and A should be able to run functions and access properties on B.
I've been suggested to pass reference of As properties to B opon construction, but I'm lookin for the design-pattern...
anyone know of any design-pattern similar to this?
Thanks alot
NaNg.
|
|
|
|
|
That is the pattern, pass A to B in its constructor. Or make B an inner class of A so only A can create it and without A its creation will be impossible. Here is a snippet:
A a = new A();
B b = a.CreateB();
public class A
{
...
public void CreateB()
{
A a = new A(this);
return a;
}
...
public class B // Or other access depending on your needs
{
B(A a)
{
this.a = a;
}
}
}
CodingYoshi
Visual Basic is for basic people, C# is for sharp people. Farid Tarin '07
|
|
|
|
|
the thing is - i was strongly advised not to hold the A class instance in Bs instance, someone told me it's bad design.
What do you think? is it that bad of a design, could there be better? or this is the best option there is?
|
|
|
|
|
I don't think it is a bad design. Like I said in assemblies this will cause problems as Assembly A will depend on B to compile and B will depend on A to compile. This is a deadlock situation. With classes, I don't see the problem. You should try to minimize coupling but you can not avoid it altogether.
.NET and Java API both have instances of classes within other classes. For example, DataSet.Tables, Table.Rows etc.
People waste way too much time on design and design patterns. Patterns are suppose to make the construction easier and not introduce complications. The best design is the simplest design.
CodingYoshi
Visual Basic is for basic people, C# is for sharp people. Farid Tarin '07
|
|
|
|
|
I would say you are looking for the Composite pattern: http://en.wikipedia.org/wiki/Composite_pattern[^].
With this pattern the quick solution is to make class A the composite and class B an component.
A more beautiful solution is to create an abstract Component class that just contains the functionality related to administering the tree data structure. You then create 2 implementations of this abstract class:
- class B that just re-uses the methods of the abstract class and adds its own functionality,
- class A that just re-uses the methods of the abstract class, but adds collection functionality and its own functionality.
A very beautiful solution is to separate specification from implementation:
- specify B's own functionality in an interface IB,
- specify A's own functionality in an interface IA,
- make an abstract class Component that contains child logic,
- make an abstract class Composite that contains collection logic,
- make a class B that inherits class Component and implements IB,
- make a class A that inherits class Composite and implements IA.
In the implementation of class B, you can now check, if the parent is of type IA, and then use the functionality of IA.
In the implementation of class A, you can now check, if a child is of type IB, and then use the functionality of IB.
You can even make interfaces for the Component and the Composite, if you go 100%.
Hope above was a little helpful. Remember, you decide your design!
Regards, Keld Ølykke
|
|
|
|
|
Hello to all readers,
I'm reading now for a while requirements-literature and the more I read, the more I'm confused.
One of my basic questions is: What is in a SRS?
a)
are there user-requirements exclusively?
(e.g. "data must be stored" )
b)
or are there only requirements for my software which are derived from the user-requirements?
(e.g. data are stored in a SQL-Database)
c)
Is any architecture/design specification/model also included in a SRS?
Does somebody have a nice link?
Best regards
modified on Sunday, May 24, 2009 1:02 PM
|
|
|
|
|
|
User Requirement and SRS (System Requirements Specification) is not the same.
There is a fundamental difference.
User Requirement is recorded in a User Requirement Specification.
Whereas in SRS, we record the system behavior and functionality. SRS focuses on the system purely and is derived from the URS (User Requirement Specification). However in SRS, we can also put any non-functional requirement like Performance requirement, Environment Requirements and so on so forth.
In SRS, we can put in User Case Diagrams, but not pure system diagrams which should be put in High Level Design Specs, Module Specs or Low Level Design specs.
Hope this clear your doubts. Any queries, please feel free to contact me.
|
|
|
|
|
Thank you for your reply. I'm currently fighting hard with the terms. I read a lot more meanwhile (e.g. Axel van Lamsweerde: Requirements Engineering) and I hope this cleaned up my mind.
Let me tell my ideas in the following (should be compliant to your statements). Can you revise my statements?
1)
A user requirement is what I get from any customer - exclusively in his words (problem-domain) (e.g. "the route of the truck must be planned in advance"). This is content of a "user requirement specification" (URS).
2)
From this URS I derive a SRS (e.g. by Object Oriented Analysis).
An SRS does not contain any solution elements (e.g. Architecture, Design,..); It deals only and exclusively with the problem-domain. The goal is to structure the problem domain.
There are three basic elements for getting some abstraction/organization into the problem-domain:
a) Object-Diagrams for the structure (e.g. based on UML class diagrams)
b) Behavioral Diagrams (e.g. state-machines)
c) Operational Diagrams (e.g. Usecases,Szenarios,...)
d) Beside of this there is usually a "textual" description of the "nonfunctional" Requirements.
Alternatively parts a), b) and c) can exclusively also be expressed in "natural language"
All this is SRS
3)
After that the first technical elements come into the play. e.g. Architecture followed by design,...
Do you agree to this sequence and content?
Thank you again for your reply
Best regards
|
|
|
|
|
Great!!! You are absolutely correct.
Now you have very good clarity on the User Requirement, Functional Requirement Specs.
Regarding the Architecture and Technical Designs, based on the complexity of the system, you can have elaborated Use-Case designs in the Form of High Level Design Specs.
In the next level, you can have Low Level Design Specs or Unit Secification detailing the objects, entities etc for the relevant Unit of the System in great detail. Unit Specs often acts as the blue print for the developer of the system and you should be able to derive Unit Test Cases from the Unit Specs.
System Test Cases from the SRS.
Integration Test Cases from High Level Design Specs and Unit Specs.
Hope this helps you.
Feel free to contact me, if you have any doubts / queries.
Regards,
Robin
|
|
|
|
|
Hi Roy,
for the moment I'm fine.
Thank you for your support - it helped me a lot
Best regards
|
|
|
|
|
Hey Frygreen,
No problems.
Thanks,
Robin
|
|
|
|
|
Hello to all, it's me again.
Reading more and more, I begin to doubt my own statements in my last contribution.
Here I wrote under point b): " ... no arichitectural elements .... It (SRS) deals only and exclusively with the problem-domain. The goal is to structure the problem".
Is this really true?
Does a SRS really have no SW-architectural Elements? Is it's only purpose to structure/understand the problem-domain?
If this is true, then: Where are the models for architecture coming up?
Best regards
|
|
|
|
|
Lets say I have 3 classes: Category, Book, and BookCollection. Objects of Category class will have a BookCollection which is simply some container which contains all the books within that category. These classes also have a method Save() which saves them to a permanent storage. Now when Category's Save() method is called, should it just save the category or the books within the category as well? What are the advantages and disadvantages?
If Category.Save() only saves itself, then clients will also need to call Category.Books.Save(). What is better? Also, should BookCollection.Save() traverse the books and call Save on each or will it do all the saving?
I guess it depends on the context but is there a convention?
CodingYoshi
Visual Basic is for basic people, C# is for sharp people. Farid Tarin '07
|
|
|
|
|
Hi,
this is how I see it:
1.
a phone directory holds a number of phone numbers; the phone numbers are not saved separately, it is the directory that holds them.
2.
a filesystem directory holds (or seems to hold?) a number of files; however you can read and write files without explicitly accessing their directory, so the file is a real object. The directory basically is just holding information on files (say FileInfo objects, which do not get saved separately).
3.
now which of those two cases your Book application ressembles most?
if you want to save and restore individual books, use (2) and threat your BookCollection as a list of book references, so saving that would be e.g. a file containing book/file names.
if wou do not want to save and restore individual books, use (1)
BTW: I am not convinced your Category class makes much sense, IMO Category would be an enum, and each book would have a Category property; you Category class could just be another BookCollection holding some of the Books (the once with matching Category property), or an enumerator inside BookCollection yielding only the Books with matching category.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Thanks for the reply.
This is not a real application so the classes are just "hypothetically speaking". However, if it was a real application, Category can still be a valid class because you can create, delete, modify categories as well. Then category will have more properties like id, name, description, books etc.
If it is an enum then we can not accommodate the above.
Nonetheless, your answer really helped me.
CodingYoshi
Visual Basic is for basic people, C# is for sharp people. Farid Tarin '07
|
|
|
|
|
Hi to all,
I need your help. Actually I have to develop a Learning Management System (LMS) Software. But I don't the architechture and how to go for it. Can somebody give the steps how to start. What would be the design? I want to develop it in .net
cheers,
sneha
|
|
|
|
|
sneha Choudhary wrote: Can somebody give the steps how to start
Get the users' requirements.
sneha Choudhary wrote: What would be the design?
That depends on the requirements.
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
|
|
|
|
|
First, Get the requirement documented.
If possible come up with a prototype of your system.
In doing so, you will get the objects, and attributes and various relationships... from there you can get into your design and then development.
|
|
|
|
|
I have built 2 learning management systems from the ground up in ASP.NET/C# and SQL Server. This is going to be a long task depending on the business requirements. Have fun with SCORM and AICC. You might want to give some thought in buying a low cost LMS or using a free one like Moodle. The first one I build took 2 years because of all the features it needed. Like the previous poster said....get the business requirements first and then go from there. Good luck.
|
|
|
|
|
I couldn't find any brainstorming or thought process tool. Could somebody please provide me a link either a web based or windows based.
Thanks
|
|
|
|
|