SitePoint Sponsor |
|
User Tag List
Results 1 to 4 of 4
-
May 31, 2007, 21:39 #1
- Join Date
- Oct 2003
- Location
- Denmark
- Posts
- 129
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
When and how to do the actual saving
I've created the following classes:
http://svn.intraface.dk/intrafacepub...ty/Accounting/
And the usage is shown here:
http://svn.intraface.dk/intrafacepub...nting/Test.php
Two questions?
1) Now the question is, I need to save the data somehow (for instance in a database), but the question is where to do it in a design like this?
2) How can I extend it so it is possible to make a threelegged transaction also?
-
Jun 5, 2007, 10:25 #2
- Join Date
- Sep 2003
- Location
- Glasgow
- Posts
- 1,690
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Perhaps the transaction should know how to save itself - and roll back if it can't. I don't know much about accounting though: what exactly do you need to keep records of?
working on: Aperiplus, Rephactor, Phemto
useful links: xUnit test patterns, martinfowler.com, c2 wiki
-
Jun 5, 2007, 11:36 #3
- Join Date
- Oct 2003
- Location
- Denmark
- Posts
- 129
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Well, it is a real double entry accounting system, which also needs to support threelegged transactions. But I am not sure how to design this - whether the transaction should be two or threelegged would be determined from the account type (whether it is an account where Tax are added or not - or for some accounts you also have to add a calculated amount and put it on another account).
And I need to save the stuff in the database. However, Kyberfabrikken kind of showed me how he would do that, and I updated my code accordingly. I havent added rollback, because I never really understood how that will work in a reallife appl. What would it look like exactly.
-
Jun 5, 2007, 12:31 #4
- Join Date
- Aug 2004
- Posts
- 428
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
command pattern - undo + transactions
Bookmarks