Normally when programming in C# I architect my project after the domain driven principles. I am new to programming in Objective C for iPhone and was wondering if anyone had any sample projects or code that uses the domain driven design principles in Objective C. I am looking for examples of how Business Objects, etc are used. Thanks.
There is a chance that you misunderstand what Domain Driven Design principles are. DDD is a set of guidelines, it is more about how you think and how you approach problems, it is mostly technology agnostic. Nothing prevents your design from being driven by domain instead of technology if you write Objective C code (I personally liked the fact that you have to name arguments because it made for a more readable code in my opinion).
Your question is probably about technologies that usually support (but not define) DDD: ORM, DI, Unit Tests. And this part is not so good IMHO (based on short and relatively outdated experience). Instead of using ORM you usually employ Core Data which is an object graph persister that is suppose to be even better in theory because you don't deal with 'Relational' part. I remember however that Core Data put certain restrictions on my object model that I would wanted to avoid in other environments. Can not speak for DI, but unit testing was a pain (in 2010) and I've heard it still is in 2012.
The bottom line is that you would have to elaborate on your question, split it and maybe ask it in Objective-C section.
I am surprised that no one mentioned how anti DDD CoreData is. Even with CRUD style apps, I always try to code DDD style. One of the first things you will notice is the extensive use of CoreData throughout Cocoa, specially on Mac.
XCode and Cocoa promotes the use of CoreData along bindings. However CoreData forces you all the time coding to the database, not the domain model. Indeed, you cannot rename a single domain object attribute without forcing a whole database migration.
If you are learning Cocoa you will have to learn CoreData because many apps and sample code rely on it. Later on, as your knowledge of the framework matures, you might want to drop CoreData altogether if you really want a domain model, which is what I usually do for my own projects.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With