Where is the separation of logic if the business entity knows both the business logic and has knowledge of the structure of the associated data storage mechanism?
Each database table class contains both business rules in the form of custom code and a description of the table’s physical structure as described in the $fieldspec array. By containing all this information within a single class I am adhering to one of the fundamental principles of OOP which is encapsulation. Although this information is defined within a business object it is not used to access the persistent data store (i.e. database) until it is passed to my Data Access Object (DML class). This uses the information given to it – the table structure and some data – to construct the relevant query and then pass it to the specified database engine via the relevant API. There is nothing in the principles of OOP that says I cannot define information in one object, then pass it to another for processing. It is where this information is actually processed which is important.
Related Questions
- I am considering getting into the trucking business as an independent driver. What is the best business structure or entity for me to form to operate my business?
- If a foreign entity intends to or is already transacting business in Texas, what are the penalties for not registering with the Secretary of State?
- Do all agents who sell, solicit or negotiate insurance for the business entity need to be licensed and on the business entity corporate structure?