|
I used to take the approach that an object should know how to persist itself, but now I always split the database access out into a separate object from the domain class as it seems to me to be a reasonable separation of concerns. One object knows about business logic, runtime behaviour, validation rules, etc. but does not know anything about persistence. Another object knows how to save and load to and from the persistence store, but does not know (or care) what the target classes are used for. I find this easier to work with, and it makes it easier to separate business logic and persistence logic for unit testing (if you are into that sort of thing).
Martin Fowler covered this in his Patterns of Enterprise Architecture book, where he calls it the Table Gateway pattern. Java people call it the DAO pattern, although that term has different connotations for .NET.
|
|
|
|
|
I have a DAL and then a single entity object, problem seems to be that a collection of the entity objects has one hell a lot of baggage in it.
I'm currently working through Josh Smith's[^] article on MVVM and wondering if the level of complexity is valid for LOB apps. I look at it from a down stream support aspect.
I am slowly coming around to the opinion that WPF/Silverlight is probably going to be the future UI to work with and the MVVM pattern seems to have a vote of confidence from some well respected people.
|
|
|
|
|
Hello experts,
I'm trying to design a framework for generating reports by storing the meta data in an XML.
The following are the sources (in both SQL / Oracle providers).
1) Tables/Views
2) Stored Procedures
3) OLAP Cubes
I'll write a wrapper to sync changes to these Tables/Views/SPs/Cubes so that the XML is up to date.
Tables/Views
============
The user will be able to store subset of the columns and filter criteria (1 or many) and should be able to run the same report at a later stage.
Stored Procedures
=================
Whenever the user wants to run the stored procedure, he/she will supply the parameters and get the output.
OLAP Cubes
==========
Predetermined cubes and/or cubes with specific members as parameters.
I'm thinking the following way using strategy pattern for retrieving data.
1) IReportData: Gets the report data in a dataset/cellset
2) IReportParameters: Gets report parameters (For SPs?)
3) IReportFilters: Report filters / criteria /criteria set
3) IReportSQL: The final executable SQL
4) IReportFormat: Rendering format
4) IReportRender: Final renderer
What do you guys think about this? Do you have any design pattern (s) that you would like to recommend?
Thanks,
RK.
You can never try. You either do it or you don't.
|
|
|
|
|
Hi
I have to do a project nemed "Recruitment Management System". I am in difficulty to make Different UML Diagrams. Is anyone can provide me the following diagrams for the system?
DFD Diagram (Context and Level-1)
Use Case Diagrams.
ER diagrams.
Activity Diagrams.
Sequence Diagrams.
Architectural design diagram.
Class Diagrams.
Database Design.
Deploymnet Diagram.
Test Cases for Use Cases.
|
|
|
|
|
Amir irfani wrote: Is anyone can provide me the following diagrams for the system?
Given the amount of time that your question has been sitting there, I guess not!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Any idea how much work that represents? Even if someone had all those documents, I doubt that they would just share it.
Amir irfani wrote: I am in difficulty to make Different UML Diagrams
What exactly is it that you are having problems with? Do you want information on UML[^], or are you looking for information specific to the recruitment-domain?
|
|
|
|
|
Maybe some time studying UML would be the best place to start.
|
|
|
|
|
Hi
I have a senario in which I need to move the data from one database to another depending upon some conditions so that it will reduce some load on one database.For example we have A and B database and lets say lots of new data comes into database A daily.Now i want to put a logic so that some of infrequently used data in database A can be moved to database B on a daily basis.Once data is moved from A database to B databse data will be deleted from A thus reducing load on database A.so daily this process goes on and data from A will be moved to B.So B contains all the data that is moved from A daily and no data of previous day is overwritten on B.No data transformation is required.Will replication be helpful in this senario ?
|
|
|
|
|
do not publish the same question in two or more forums. Pick one and stick to it. Those are the rules around here.
|
|
|
|
|
In my site, there is registration fee for membership. Now the registration fee is constant so that i put it in the web config file. Sometimes the client requirement will change by add an option to edit the fee. Then I will prefer to move it into database. So i have to implement the function to get the fee regardless where it resides.
Please suggest me which design pattern is suitable for this scenario?
Thanks and regards,
Majee
|
|
|
|
|
The strategy-pattern[^], where you'd create an concrete strategy that can be replaced
"Our software isn't released, it escapes leaving a bloody trail of testers behind it."
|
|
|
|
|
Thanks Eddy, I have implemented the strategy pattern. I am afraid my classes caused little bit over kill though it is not the problem of design patterns.
Thanks and regards,
Majee
|
|
|
|
|
Hi,
I have a design question.
Certain modules in my application will behave differently depending on which state in the U.S. the user lives.
I will try to explain my question by talking about one module in particular, lets says its a sales tax module...
I am using strategy pattern to set the behavior of certain classes at runtime, in this case it depends on which state the user is in.
I have an abstract SalesTaxBase class that sets its behavior through the use of the ISalesTax interface. My concrete implementations that handle the specifics of each State's sales tax rules are called SalesTaxBehavior<state name=""> and they implement ISalesTax. Which SalesTaxBehavior class is used is determined at runtime depending on the State in the U.S. the user is in. Typical strategy pattern...
My issue is I want to release the program but I haven't completed all of the SalesTaxBehavior concrete implementations yet. My plan is to let the user download the latest module as they become available and then the program will be able to set the behavior of the SalesTaxBase class based on the newly downloaded SalesTaxBehaviorForNewMexico class.
Finally my question... How can I deploy my application so that the application sold today can call a SalesTaxBehavior class I create and the user uploads next year.
I was thinking of using a switch statement that said, if the state is Alabama use the SalesTaxBehavoirForAlabama class and so on for each SalesTaxBehavoir class I have already completed at the release date.
However the switch statement is concrete and so it won't know of any additional SalesTaxBehavior classes implemented after the initial release.
I don't want to update the original dll I only want to add additional dll's that perform the new functionality. In other words the design solution of how to add additional modules at a later date needs to be closed for modification but open for extension.
What would be a good method for updating my program to handle the latest SalesTaxBehavior class that has just be uploaded? To summarize what I need is a way so my app knows of and can call all of the modules that it currently contains and also those that will be added in the future.
What about a text or xml file that the application reads that contains the details of the added modules? Is that a common method for this kind of problem? (This just occurred to me as I was about to hit send...)
I hope I have been succinct enough; please let me know if I need to clarify anything.
|
|
|
|
|
Yes, it's possible to update the application after deployment. There are multiple ways of updating, where the simplest is a ClickOnce-installation.
Alternatively, you can load an assembly dynamically, check out what classes are defined within, and even instantiate[^] the classes of your liking. There's a CodeProject[^] article showing how to build plugins that way
|
|
|
|
|
I'm trying to build a generic filter screen for a set of reports with a similar purpose off the same database. Most reports include a CallData table, with filters like DateFrom, DateTo, DurationFrom, DurationTo, etc. So, I use controls for these to build a section of the where clause. When I run the report, I read the query text, build the where clause for the CallRecords filters, and replace a token in the query with this filter text. This works well with most reports, as most only filter on CallRecords.
Some also filter on, say, "Employees.EmployeeId in (1,2,3)", which I also built dynamically using checkbox lists presented to the user in the filter screen. My issue here is how to decide which criteria to insert into which report query. I could use attributes on the report classes, but I think that's clumsy. My currently winning candidate solution is to have a separate token for each filter in the report, so if there is no /*@@Employees@@*/ token in the report query, no employees criteria will be inserted.
Any suggestions of other means of doing this?
|
|
|
|
|
If you are using a stored proc this may help. Where @SetID is the criteria from the client, -1 can be any value. There is a neater method floating around somewhere but I have not changed mine for a decade or more. Search for 'Dynamic where clause'.
AND (ISNULL(@SetID,-1) = -1 OR FileSetID = @SetID)
Also the EmployeeID in (@List) will not work, you need a Split function that returns a resultset and then you can use an inner join or where in method.
|
|
|
|
|
Hi,
I have been trying to understand the differnce between these two concepts, however I am still a bit confused.
if I have this interface
Interface IArticleFactory {
IArticle Create(Parameter p)
}
What is the relationship beetween IArticle and IArticleFactory? Dependency, Association or none.
What is the relationship beetween Parameter P and IArticleFactory? Dependency, Association or none.
(some people show no relation at interface level)
Again
Class ArticleFactory : IArticleFactory {
IArticle Create(Parameter p) {
return IArticle = new Article(p);
}
}
What is the relationship beetween IArticle and ArticleFactory?
Dependency, Association or none.
What is the relationship beetween Article and ArticleFactory? Dependency, Association or none.
What is the relationship beetween Parameter P and ArticleFactory? Dependency, Association or none.
Thanks
Pierpaolo
|
|
|
|
|
At work a coworker has the need to automate some of his work. He has XLS files that have lots of blank columns and un-alphabetized entries in columns and he wants a version of that XLS that has been edited and adjusted and also has the ability to get appended to auotmatically later.
What way could I go about thinking how to design something to do this? What language to start in? I know there are programs out there that do this, but all I found are ones that charge and also he wouldn't be able to get the company to pay for a program to do this for him.
Any ideas/designs?
|
|
|
|
|
Hi ,
I am currently working on a big C++/COM project .
Can any one know/suggest @ the free available refactoring tools useful for refactoring.
|
|
|
|
|
Hi,
Anybody has idea how to do this?
|
|
|
|
|
hello everybody ,
i really need ur help if you deal with a Enterprise Library Logging Application Block before
im trying to extract specific data from the log entery i use XmlLogEntry class and the output into xml file i tried to read from the xml file and it raise error that this xml is being used by another application and i dont know how to extract specifi data from that object i tried to use XML property but it also gave error i need to put Node every time the log works in another xml file becuase you know the output xml form the logging application block is invalid xml formate
public void LogFirstFOrmatter(Exception ex,int ex_priority,string title, TraceEventType type,string errormsg,int eventID)
{
XmlLogEntry myxmlLog = new XmlLogEntry();
myxmlLog.Severity = type;
myxmlLog.AddErrorMessage(errormsg);
myxmlLog.EventId = eventID;
myxmlLog.Message = ex.ToString();
myxmlLog.Priority = ex_priority;
myxmlLog.Title = title;
Logger.Write(myxmlLog);
LoadLogFile("MyLog");
}
public XDocument LoadLogFile(string name)
{
XDocument doc = new XDocument();
var tmpLog = Path.Combine(ConfigurationManager.AppSettings.Get("Path"),name);
tmpLog += ".xml";
var fileContent = string.Empty;
using (StreamReader reader = new StreamReader(tmpLog))
{
fileContent = reader.ReadToEnd();
}
doc = XDocument.Parse(fileContent);
return doc;
}
|
|
|
|
|
Did you read its documentation, this sort of usage information must be documented some where with application.
|
|
|
|
|
I am trying to communicate from my PC with a PCB using I2C. This PCB type was working but some of them are not now. I am receiving massage on my GUI control panel "I2C not connected". The problem on hardware I've found is that PIC microcontroller on PCB has 2.1v on its VSS (ground) pin. Firmware is transfered right to the PIC. I think this voltage appearing on Vss pin is creating problem. Is there any body to help me please, whether this is the problem and how to solve it please. Many thanks.
kd
|
|
|
|
|
Hi,
My apologies if I put this in the incorrect forum
I got the book on expert business objects, and they use the CSLA.NET framework. Now I read many negative reviews on this framework after buying the book And alot of people say that we should rather use DDD (Domain-Driven Design). What exactly is DDD? And why choose it above CSLA.NET? Are there any good books/online articles to read that explains this for beginners and how to implement it?
What other similar commercial/opensource frameworks are available to look at?
Has any one used CSLA.NET? And comments positive/negative?
Regards,
Brendan
|
|
|
|
|
These are two somewhat orthogonal (or complementary) items.
CSLA.NET provides a harness that eases the persistence, state snapshot, and business-rule tracking. This entire harness reflects the methodology that Lhotka uses to create his applcations. You can compare this harness-as-philosophy to Taligent's MVP harness or Clifton's Application Automation Layer. Normally, you have to buy into this lock, stock, and barrel to adopt these types of harnesses.
DDD attempts to provide a set of guidelines by which a software development team can produce in anticipated and repeatable ways the decomposition of a business model into an object-oriented structure. My exposure to this started with Coad's Domain-Neutral Component and Modelling in Color, supplemented by Nicola, et. al.'s Streamlined Object Modeling. The most recent valuable entry in this list is Evans' Domain-Driven Design: Tackling Complexity in the Heart of Software.
So, CSLA.NET embodies a philosophy regarding application construction. DDD embodies "best practices" for modeling a business domain.
The Application Automation Layer: Introduction And Design[^]
Modeling in Color[^]
Streamlined Object Modeling[^]
Domain-Driven Design[^]
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|