Let's suppose we will start new project - application that consists of some business logic, interface on ASP.Internet, WPF or each of them. We want to make use of ORM or DAL code generator and implement our business logic insInternet classes. You will find several fundamental ways the way we can express our ideas of economic domain:
- Implement business classes on .Internet and let ORM generate appropriate database schema
- Create database schema by hand and generate .Internet classes by code generator
- Apply certain type of visual designer, that may generate business classes and database structure or script
Exactly what do you'd rather write: "Create Table Persons ( ... )" or "public class Person "?
What exactly are Benefits and drawbacks of individuals ways?
Maybe you will find some kind of special situations where one of the ways is preferable to another?
How to pick optimal means by a specific project?
I'm quite acquainted with "Code-First" (or "Model-First") way, however it appears the majority of ORMs are made as code machines or mappers, that guess that I'll by hand implement both database structure and business classes.
Solutions according to expirience and good examples of ORM's are specifically welcome.
Edit: Note, now you ask , not "What must i do first when beginning new project?", but "What ought to be by hand declared / instantly produced, domain classes or database structure?"
I believe the right method of system analysis and design would be to begin by modeling your objects and also the relations together first. If you are developing a library system you need to think about the phrases Book, Author, Writer, ISBN as objects less database tables or characteristics. In my opinion this is one way it ought to be. That been stated, let us admit that code machines save way considerable time, and individuals need a relational database to be able to create the model and map it towards the DB objects. I believe this is actually the primary reason why designers often begin by the D.B. What can be my point more is the fact that code machines designers is attempting tough to turn back presently implemented operation (i.e. You give a business design-objects and classes- and also the generator produces the DB using the appropriate schema with this).
Here's a good example of domain-first machines (ADO.Internet Entity Framework itself) Model First :
Visual Studio 2010 needs to ability to develop a DDL and make up a database to keep the entity data model. The developer has complete treatments for the whole process having the ability to personalize the DDL, in order to choose the database he desires, or tweak the mapping process.
Why don't you interface-first?
A lot of applications begin with a course-first attitude. That's an awful idea. Programming may be the heaviest element of building an application, meaning it is the most costly and toughest to alter. Rather, begin by creating first.
Design is comparatively light. A paper sketch is affordable and simple to alter. html designs continue to be easy to change (or get rid of). That isn't the case with programming. Creating first keeps you flexible. Programming first fences you in and sets you up for further costs.
Analysis of needs first, and more documentation of individuals needs and an introduction to the information facets of this?
Then guess what happens data you will be taking and just how it pertains to other data, and may design a database schema or data structure to complement it (as logical objects/tables of related content, not "tab1_data", "tab2_data" matching the information capture process that could change, but you will know!). You can even design b .xsd first and generate code along with a database schema from that. It's all regulated fun and games nowadays, based on your skillset.
Because the database schema i believe stores the information, which may be the vital factor for any business to possess, I'd design that first - multiple tools may can get on over time, maybe the initial system could be changed down the road (e.g., migration to more recent tools/languages/connects). Knowing nothing about database theory, maybe that isn't the best choice however i would get any produced schema verified by another person.