Page 1 of 1
Zend Framework DDD
Posted: Thu Jul 08, 2010 5:52 pm
by DaveTheAve
Does this look right to you guys? Case you can't tell, i'm using Zend Framework.
[text]appliction/
- Models/
- doctrine/
- FC_Models_Doctrine_Users extends FC_Models_Resources_Abstract_Users implements FC_Models_Resouces_Interfaces_User
- Resources/
- Gateways/
- Abstract/
- Collection.php extends FreeC_Object impliments Iteration, Seekible
- Users.php extends FreeC_Object
- Interfaces/
- User.php
- Users.php extends FC_Models_Abstract_Collection
- User.php extends FC_Models_Doctrine_Users
- Leads.php extends FC_Models_Abstract_Collection
- Lead.php extends FC_Models_Doctrine_Leads
- Attributes.php extends FC_Models_Abstract_Collection
- Attribute.php extends FC_Models_Doctrine_Attributes
- Modules/
- leads/
- Models/
- Resources/
- Gateways/
- Abstract/
- Leads.php extends FC_Models_Leads
- Lead.php extends FC_Models_Lead
- Interfaces/
- Leads.php extends FC_Modules_Leads_Models_Resources_Abstract_Leads
- Lead.php extends FC_Modules_Leads_Models_Resources_Abstract_Lead
- Controllers/
- Library/
- FreeC/
- Object.php implements AccessArray[/text]
Been reading up on DDD (Domain-Driven Design) and I think the above implements it, right? Anyone have any Zend Framework DDD guides? lol
Re: Zend Framework DDD
Posted: Fri Jul 09, 2010 1:43 pm
by josh
No, you've designed the models around the database schema in my opinion. The models are supposed to describe the domain. This doesn't describe anything to me other then the fact you figured out how to use Doctrine's collections to tie some "leads" to some "users". I don't have any clue what your app does. I'm supposed to have a good idea about what it does by looking at how you modeled the domain, unfortunately it seems all the information I need is somewhere cryptic in the code. The names of the files and how you organized it should describe a lot more.
Also part of DDD is breaking the domain model down into different "contexts", accompanying this is also supposed to be some sort of UML diagram or map that explains the relationships between objects & contexts.
Did you read the Domain Driven Design book? The blue one by Eric Evans??
Re: Zend Framework DDD
Posted: Fri Jul 09, 2010 2:51 pm
by DaveTheAve
Nope, it is on my short to-do list and very close to the top. However, the map above I came up with looking at tutorials and online examples.... so much for that. lol
Thank you for your honest feedback; back to the drawing board.
Re: Zend Framework DDD
Posted: Fri Jul 09, 2010 6:51 pm
by DaveTheAve
Redo! So I actually read just over HALF the DDDQ book and researched the ACTUAL methods (most in Java - thank god for college) and implemented them the best I could conceive in a way I can present to the public - A blog!
Am I anywhere close? Any advice?
P.S. Is the Collections too much? Noticed Magento used it and I really liked the idea of collections; thought the factory was suppose to do it but researched it and all factory classes do I've noticed is create objects from other object's data. (Getting the author information via a blog post object.)
[text]Version 1.4: (Idea of a Blog - Real topic too senitive)
Bloghead/
- Domain/
- Domain/
- Entity/
- User.php extends NeoeliteConsulting_Object calls Bloghead_Domain_Repository_Users
- Post.php extends NeoeliteConsulting_Object calls Bloghead_Domain_Repository_Users
- ValueObject/
- User/
- AccountSafetyInfo.php
- Address.php
- ContactInfo.php
- Post/
- Metadata.php
- Blog.php
- Factory/
- User.php creates Bloghead_Domain_Entity_User from different objects
- Post.php creates Bloghead_Domain_Entity_Post from different objects
- Repository/
- Dao/
- Users.php extends Zend_DB_Table or (Doctrine Models) implements Bloghead_Domain_Repository_Interfaces_User
- Posts.php extends Zend_DB_Table or (Doctrine Models) implements Bloghead_Domain_Repository_Interfaces_Post
- Interfaces/
- Users.php
- Posts.php
- Users.php
- Posts.php
- Service/
- User/
- Auth.php
- Acl.php
- Post/
- Recaptcha.php
- Collection/
- Users.php extends NeoeliteConsulting_Collection calls Bloghead_Domain_Repository_Users returns Bloghead_Domain_Entity_User
- Posts.php extends NeoeliteConsulting_Collection calls Bloghead_Domain_Repository_Users returns Bloghead_Domain_Entity_Post
- Modules/
- user/
- Domain/
- Entity/
- User.php extends Bloghead_Domain_Entity_User
- Post.php extends Bloghead_Domain_Entity_Post
- ValueObject/
- User/
- AccountSafetyInfo.php extends Bloghead_Domain_ValueObject_User_AccountSafetyInfo
- Address.php extends Bloghead_Domain_ValueObject_User_Address
- ContactInfo.php extends Bloghead_Domain_ValueObject_User_ContactInfo
- Post/
- Metadata.php extends Bloghead_Domain_ValueObject_Post_Metadata
- Blog.php extends Bloghead_Domain_ValueObject_Post_Blog
- Factory/
- User.php extends Bloghead_Domain_Factory_User
- Post.php extends Bloghead_Domain_Factory_Post
- Repository/
- Dao/
- Users.php extends Bloghead_Domain_Repository_Dao_Users
- Posts.php extends Bloghead_Domain_Repository_Dao_Posts
- Interfaces/
- Users.php extends Bloghead_Domain_Repository_Interfaces_Users
- Posts.php extends Bloghead_Domain_Repository_Interfaces_Posts
- Users.php extends Bloghead_Domain_Repository_Users
- Posts.php extends Bloghead_Domain_Repository_Posts
- Service/
- User/
- Auth.php extends Bloghead_Domain_Service_User_Auth
- Acl.php extends Bloghead_Domain_Service_User_Acl
- Post/
- Recaptcha.php extends Bloghead_Domain_Service_Post_Recaptcha
- Collection/
- Users.php extends Bloghead_Domain_Collection_Users returns Bloghead_Modules_User_Domain_Entity_User
- Posts.php extends Bloghead_Domain_Collection_Posts returns Bloghead_Modules_User_Domain_Entity_Post
- Controllers/
- IndexController.php calls Bloghead_Domain_Collection_Users::fetchUserById('1');
- Library/ (Don't mind these... part of my thought process)
- Zend/
- PHPIDS/
- PHPSec/
- Recaptcha/
- Doctrine/
- NeoeliteConsulting/
- Cookies/
- CookieBroker.php
- Cookie.php
- Object.php implements AccessArray, Serializable
- Collection.php implements Iteration, Seekable, Serializable[/text]
Re: Zend Framework DDD
Posted: Sat Jul 10, 2010 2:06 pm
by josh
Are you modeling a computer or are you modeling something from the real world? Don't be so anxious to pollute your domain with meaningless concepts like "collections" for no reason. If you have a group of birds fly by when you're out at the park you don't go "hey look at that collection" you say "hey look at that flock"
In the DDD book by Eric Evans he talks about a shipping application in which one object in that application is the "leg" of a shipping route. A bunch of programmers would probably just call it a "route-connecting-passageway-thingy" and be contempt at that name. The domain experts however have a more technical name - a leg of the route - the technical concept is what you want to search for.
Re: Zend Framework DDD
Posted: Sat Jul 10, 2010 2:21 pm
by DaveTheAve
The used class is not NeoeliteConsulting_Collection but rather Bloghead_Domain_Collections_Users, or Bloghead_Domain_Collections_Books, Bloghead_Domain_Collections_Birdflock, Bloghead_Domain_Collections_Herd.
Should the collections in there own folder or a sub-folder in the Entity folder?
Besides the file-naming, does everything else look fine?
Re: Zend Framework DDD
Posted: Sat Jul 10, 2010 8:02 pm
by josh
DaveTheAve wrote:Should the collections in there own folder or a sub-folder in the Entity folder?
I think that would be low on the "making sense" scale. I'd want them together. Why? Because they are closely related concepts why would you put them "far apart"? Why do you need the word collection in it's title? Just to sound "programmy"? that's not what DDD is about. DDD isn't about using technical terms, its about using terms your 4yr old would understand. Call that class the "birds" class. Not the "
collection of aviation mammals" class
My 2 cents. PS No way you could have read Eric Evans book that fast I'm a fast reader and it took me like a month. Either that you read the words but you must have skimmed it. You did not read half of that book in 4hrs, lol. If you do that math it means you spent barely over 30 seconds on each page of the book

. Are we talking about the same one?
http://books.google.com/books?id=7dlaMs ... &q&f=false
You're not going to understand the paradigm until you put in hard work which takes time.
Re: Zend Framework DDD
Posted: Sat Jul 10, 2010 9:06 pm
by DaveTheAve
Said I read the DDDQ version in that time.... not the regular one - Too poor to afford the $40.
Re: Zend Framework DDD
Posted: Sun Jul 11, 2010 1:10 am
by josh
I don't know what you mean by DDQ version but if you want to learn the ideas of domain driven design I suggest reading domain driven design, not DDQ (whatever that is)
Re: Zend Framework DDD
Posted: Sun Jul 11, 2010 7:10 am
by DaveTheAve
DDDQ:
http://www.infoq.com/minibooks/domain-d ... gn-quickly
Same author as the original DDD but 300pages less and free so I don't have to stop eating for a month to pay for it.

Re: Zend Framework DDD
Posted: Mon Jul 12, 2010 4:21 pm
by josh
It says it was produced by infoQ, not by Eric Evans. It says thanks to Eric Evans for his support, which probably means he skimmed it and said "yeah whatever" for all we know. I can't say I've ever really learned anything of value from infoQ.
I think they exist to collect your address & snail mail you spam about various programming conferences that cost $10k+ In other words it more profit than academic oriented. I'd recommend the DDD book. Any other abridged version is probably going to be a waste of time.