How to Design a generic business entity and still be OO?

前端 未结 7 892
抹茶落季
抹茶落季 2021-02-01 20:57

I am working on a packaged product that is supposed to cater to multiple clients with varying requirements (to a certain degree) and as such should be built in a manner to be f

7条回答
  •  清酒与你
    2021-02-01 21:39

    A way of approaching this is to use a meta-layer, or reflection, or both. In addition you will need to provide a customisation application which will allow modification, by the users, of your business logic layer. Such a meta-layer does not really fit in your layered architecture - it is more like a layer orthoganal to your existing architecture, though the running application will probably need to refer to it, at least on initialisation. This type of facility is probably one of the fastest ways of screwing up the production application known to man, so you must:

    1. Ensure that the access to this editor is limited to people with a high level of rights on the system (eg administrator).
    2. Provide a sandbox area for the customer modifications to be tested before any changes they are testing are put on the production system.
    3. An "OOPS" facility whereby they can revert their production system to either your provided initial default, or to the last revision before the change.
    4. Your meta-layer must be very tightly specified so that the range of activities is closely defined - George Orwell's "What is not specifically allowed, is forbidden."

    Your meta-layer will have objects in it such as Business Object, Method, Property and events such as Add Business Object, Call Method etc.

    There is a wealth of information about meta-programming available on the web, but I would start with Pattern Languages of Program Design Vol 2 or any of the WWW resources related to, or emanating from Kent or Coplien.

提交回复
热议问题