punjabtechnicaluniversity.blogspot.in
“A concern is a particular goal, concept, or area of interest”
There are mainly two types of concern from an object perspective:-
Core / Main concerns which it should satisfy and is his work.
Above is a class diagram which shows relationshipbetween two classes “ClsCustomer” and “ClsAuditTrail”. “ClsCustomer” class does inserting of new customer’s in to database and “ClsAuditTrail” does the auditing of what is changed in the customer class.
Now there are two concerns in this project :-
1.Customer code should not exceed greater than 10 length (Business level concern)
“A concern is a particular goal, concept, or area of interest”
There are mainly two types of concern from an object perspective:-
Core / Main concerns which it should satisfy and is his work.
System concerns which are not related to business functionalities but software related concerns example audit trail, Error handling, Security etc.
Ok let’s try to understand this principle by some actual example.
Customer and Audit trail relationships
Above is a class diagram which shows relationshipbetween two classes “ClsCustomer” and “ClsAuditTrail”. “ClsCustomer” class does inserting of new customer’s in to database and “ClsAuditTrail” does the auditing of what is changed in the customer class.
Now there are two concerns in this project :-
1.Customer code should not exceed greater than 10 length (Business level concern)
2.All customer data which is updated should be audited. (System level concern) Here goes the class code. If you see the ClsCustomer implementation in the update method I have called the Audit trail implementation. If you really look from object oriented point of view we are doing something in customer class which is supposed to be not his implementation: - Audit Trail logging.
Thus we have also broken down the rule of encapsulation. In short the class not only handles his work but also some other work which is not his concern.
0 comments:
Post a Comment
North India Campus