{"id":813,"date":"2017-05-25T19:02:21","date_gmt":"2017-05-25T19:02:21","guid":{"rendered":"http:\/\/www.pnambic.com\/home\/?p=813"},"modified":"2017-05-25T19:02:21","modified_gmt":"2017-05-25T19:02:21","slug":"what-is-business-logic","status":"publish","type":"post","link":"http:\/\/www.pnambic.com\/home\/2017\/05\/25\/what-is-business-logic\/","title":{"rendered":"What is Business Logic?"},"content":{"rendered":"<p>The standard descriptions of \u201cbusiness logic\u201d have long left me cold. I want an objective, measurement-based definition for the notion of business logic that I can use to guide the placement and packaging of code as it is being implemented. Ideally, I should make this decision once and that decision is correct.<\/p>\n<p>Definitions such as \u201cbusiness logic .. is the part of the program that encodes the real-world\u201d[<a href=\"https:\/\/en.wikipedia.org\/wiki\/Business_logic\" target=\"_blank\" rel=\"noopener noreferrer\">Wikipedia<\/a>] seem circular and imprecise. It feels like an \u201cI know it when I see it\u201d definition. More refined approaches state that business logic handles how \u201cdata can be created, stored, and changed\u201d. In practice, presentation layers have several reasons to create and change data that have little business relevance. The creation or mutation of data is not sufficient in itself to define code as business logic.<\/p>\n<p>The standard definitions all rely on the context of a specific business. If you know the business, then you know which parts of the code are business logic. However, if the business process emerges as a consequence of the engineering work, an all too common occurrence, then it is impossible to identify all business logic in advance of its implementation.<\/p>\n<p>The best objective definition of business logic that I know is that behavior which two different presentations need to use to effect a persistent change. Although this definition is objective, it does fail to provide prescriptive guidance. Code that is initially implemented in a presentation layer can emerge as business logic after it is written.<\/p>\n<p>An objective mechanism to determine if code is business logic is essential for edge cases. The notion of \u201cI know it when I see it\u201d is sufficient for simple cases, but it lacks the precision of the \u201cused by two\u201d metric. In emergent software development, the \u201cused by two\u201d metric can require revisiting some software components. Experienced engineers following the guideline \u201cis it likely to be used from multiple presentations\u201d are likely to make good decisions.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The standard descriptions of \u201cbusiness logic\u201d have long left me cold. I want an objective, measurement-based definition for the notion of business logic that I can use to guide the placement and packaging of code as it is being implemented. Ideally, I should make this decision once and that decision is correct. Definitions such as<a class=\"moretag\" href=\"http:\/\/www.pnambic.com\/home\/2017\/05\/25\/what-is-business-logic\/\"> [&#8230;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":329,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[31],"tags":[],"class_list":["post-813","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-news"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.pnambic.com\/home\/wp-content\/uploads\/2015\/11\/pnambic_favicon.jpg?fit=60%2C55","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p6YqIw-d7","_links":{"self":[{"href":"http:\/\/www.pnambic.com\/home\/wp-json\/wp\/v2\/posts\/813","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.pnambic.com\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.pnambic.com\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.pnambic.com\/home\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.pnambic.com\/home\/wp-json\/wp\/v2\/comments?post=813"}],"version-history":[{"count":2,"href":"http:\/\/www.pnambic.com\/home\/wp-json\/wp\/v2\/posts\/813\/revisions"}],"predecessor-version":[{"id":815,"href":"http:\/\/www.pnambic.com\/home\/wp-json\/wp\/v2\/posts\/813\/revisions\/815"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.pnambic.com\/home\/wp-json\/wp\/v2\/media\/329"}],"wp:attachment":[{"href":"http:\/\/www.pnambic.com\/home\/wp-json\/wp\/v2\/media?parent=813"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.pnambic.com\/home\/wp-json\/wp\/v2\/categories?post=813"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.pnambic.com\/home\/wp-json\/wp\/v2\/tags?post=813"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}