Always the "Entity first" approach when designing Java applications from scratch?

I'm just reading the book here: http://www.amazon.com/Java-Architects-Handbook-Second-Edition/dp/0972954880/trying to find a strategy for efficiently designing a (generic) medium to large application (200 tables or more) - for example, a classic multi-tier corporate intranet. I am trying to adapt my past experience (as a database developer, but also OOAD) to create such a Java application. From what I've read, if you define your entities first, there is no recommended way to dump the database directly (automatically). The book says you must first create an entity / object model (OOAD) and THEN is the db admin / dev job. (?) To create / output a database (schema, normalization, etc.) Based on an already built entity model, If so, I am afraid that the architect / developer might lose control over important aspects - normalization, modeling of entity attribute values etc.

Perhaps, like many older developers (back-end developers, architects, etc.), I feel more comfortable defining the database schema first, and spending a lot of time on aspects such as normalization, etc. While this is certainly possible these days, asking yourself if it will (pretty soon, if not sooner) become "old-fashioned" rather than normal - like the classic / recommended approach when developing applications from scratch.

I know that the Entity Framework (.NET) has already clearly defined these approaches - "entities", "database", "first code" first, and they can be mixed if necessary. I know for a fact that they recommend "entity first" for newly developed applications and "database first" if you have already defined the database schema (which is the case for many older applications when migrating, etc. I just ask if there is something similar for the java world.

So the questions are: (although I know there is no silver bullet, etc.)

  • Is "Objects first" for newly created apps the norm these days?
  • What tools do you use (if any) to help output the db schema process? - your experience, pros and cons with specific UML tools, etc.
  • What if you have a parts schema / old / subdomain database (which you would like to keep, mostly)? In this case, should you infer the model entity from and then refactor the model using your preferred UML tool?
  • From a workforce perspective (say for db 200-500 tables): what's the best approach: for example, have 2 different people participating in the OOAD / entity and database design, respectively, working together with the architect?
+3


source to share


3 answers


As you expect - my answer depends on this.

The problem is that there are so many possible flavors and sizes for a good design that you really need to get the best look possible first.

Ask yourself some important questions:

Where is the core of the system? Is the database the real core or is it really just a persistence layer for the code. It might be possible that the database is the core, and the code is really just a fun user interface for the data. There can also be a combination - where some of the tables are the core along with some of the objects.



What do you see in the future? Remember, changes are happening as we speak, which are rapidly advancing database technology. There are several databases that are all in-ram. Some of them are designed for distributed architecture. Some are mostly clouds. If you build your circuit first, you run the risk of locking yourself up to a certain technology.

What scale do you want to achieve? ... By insisting on a specific database, you can close the doors, possibly in manual presence.

I usually consider an object to be the first best source approach because you can always get the schema from entities and some metadata. Of course, you can go to the schema first and grow entities out of the schema, but this way you usually find that the database influences the design too much.

+4


source


1) I first made a database in the past, but now I usually do Entity, but mainly because of the tools I use when building applications. Entity has some good advantages at first over trying to map your entities to your specific schema later. You also don't get locked into a rigid scheme. That your app is also a question, and if it's just a basic CRUD app, write it once after reading a lot, or it will actually "do" something that will inform you about how to archive your app.

2) I use hibernate a lot, which encourages building your model in the first place, designing all of your objects, etc. and then creating a schema from that, hibernate can generate your entire schema from the models you create (although you may need to customize to make sure they're not crazy). If you have 200 objects in your model, you probably want to do a significant amount of UML modeling in advance to ensure that your model is consistent.

3) If you are working with a partially legacy database, it is sometimes a good idea to fit into a schema schema to do this, so that your entities and schema are consistent. It might hurt a little, but then it tries to explain why part of your application is just different from other parts. So yes, I would probably pull my objects out of the schema in this case. But then again, if this was downright crazy, it might be possible to do some very specific DAO code to hide that part of the schema from this application and pretend it isn't there.



4) I cannot give you a good answer to this as I am not sure what you are leading into. When you have design standards for your circuit, he turns the knob to twist it.

So after all that my answer is "It depends"

+2


source


While the answers already posted cover a lot of questions - and ultimately all the answers should probably be summed up under "it depends" - I would like to expand on the topic that has already been touched on.

My focus is on data - I am a Business Intelligence and Data Warehouse developer and I work on issues like data quality, data management, master data set, etc. To this end, I have to extract data from other systems - data that is in different conditions.

When considering whether your system's kernel is really a database or an interface (as suggested by OldCurmudgeon), I highly recommend thinking outside of your own realm. I have seen and heard of many systems where it is clear that the database is treated like an afterthought (sometimes created with the first object model, but sometimes by hand), even though most of the business value is in the data. More and more companies, of course, are realizing that their data is valuable and are using the tools to use it - but this is difficult to do if bad transactional databases mean that the data was lost, never saved in the first place, was overwritten when the story is necessary or inconsistent.

While I do not want to make myself and others with similar roles outside of work: if the data that the system you are working on is or can be useful, if there is any reason that any other than created interface, then it's worth the time and effort to create a sound data model to store it. If the system is for an organization, or is about to be sold to organizations, there is a decent chance they will want to report it, want to run output from it to a data warehouse or other data warehouse, and want to analyze the data it creates and holds.

I don't know enough about tools like Hibernate to see if it is possible to use them to work in essence in the first place and still create a good quality database, but I know that I have run into some problematic databases this way. At least as suggested, if you're going to work this way, make sure it is producing something sane and possibly adapting it when needed to ensure data integrity. If data integrity is a key requirement and you can't get the tool to create a suitable database that will ensure data integrity, then perhaps consider going back to doing things the "old fashioned" way.

I would also suggest that the real value is in developers working alongside any specialists, analysts, architects, etc., maybe, as colleagues, do some preliminary modeling, even if the system they then produce uses entity-first and even if it deviates from the more conceptual models released early on for technical reasons. I have seen many problems in systems caused by a lack of understanding of broader business units and relationships, and which could have been avoided if time had been spent understanding the overall structure in this way. I was personally responsible for creating these problems when I was an app developer myself,therefore, it should not be seen as a criticism of front-line developers - just voting in favor of cross-functional and collaborative analysis and modeling before development approaches and projects are decided.

+2


source







All Articles