{"id":28291,"date":"2017-12-23T11:08:54","date_gmt":"2017-12-23T09:08:54","guid":{"rendered":"https:\/\/mamchenkov.net\/wordpress\/?p=28291"},"modified":"2017-12-23T11:08:54","modified_gmt":"2017-12-23T09:08:54","slug":"defensive-programming-object-calisthenics","status":"publish","type":"post","link":"https:\/\/mamchenkov.net\/wordpress\/2017\/12\/23\/defensive-programming-object-calisthenics\/","title":{"rendered":"Defensive Programming : Object Calisthenics"},"content":{"rendered":"<!-- google_ad_section_start -->\n<p>I came across this nice and somewhat strongly opinionated video on <a href=\"https:\/\/en.wikipedia.org\/wiki\/Defensive_programming\">Defensive Programming<\/a>:<\/p>\n<div class=\"jetpack-video-wrapper\"><span class=\"embed-youtube\" style=\"text-align:center; display: block;\"><iframe loading=\"lazy\" class=\"youtube-player\" width=\"660\" height=\"372\" src=\"https:\/\/www.youtube.com\/embed\/8d2AtAGJPno?version=3&#038;rel=1&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;fs=1&#038;hl=en-US&#038;autohide=2&#038;wmode=transparent\" allowfullscreen=\"true\" style=\"border:0;\" sandbox=\"allow-scripts allow-same-origin allow-popups allow-presentation allow-popups-to-escape-sandbox\"><\/iframe><\/span><\/div>\n<p>Marco Pivetta makes quite a few good points with I agree (and a few with which I disagree).\u00a0 One thing that he mentioned though I haven&#8217;t heard about &#8211; <a href=\"http:\/\/williamdurand.fr\/2013\/06\/03\/object-calisthenics\/\">Object Calisthenics<\/a>.\u00a0 Which turns out to be yet another set of rules and best practices for the object-oriented design and programming.\u00a0 Here are the rules to get you started:<\/p>\n<ol>\n<li>Only One Level Of Indentation Per Method<\/li>\n<li>Don\u2019t Use The ELSE Keyword<\/li>\n<li>Wrap All Primitives And Strings<\/li>\n<li>First Class Collections<\/li>\n<li>One Dot Per Line<\/li>\n<li>Don\u2019t Abbreviate<\/li>\n<li>Keep All Entities Small<\/li>\n<li>No Classes With More Than Two Instance Variables<\/li>\n<li>No Getters\/Setters\/Properties<\/li>\n<\/ol>\n<p>Read <a href=\"http:\/\/williamdurand.fr\/2013\/06\/03\/object-calisthenics\/\">the whole article<\/a> for explanations and examples.<\/p>\n<!-- google_ad_section_end -->\n","protected":false},"excerpt":{"rendered":"<!-- google_ad_section_start -->\n<p>I came across this nice and somewhat strongly opinionated video on Defensive Programming: Marco Pivetta makes quite a few good points with I agree (and a few with which I disagree).\u00a0 One thing that he mentioned though I haven&#8217;t heard about &#8211; Object Calisthenics.\u00a0 Which turns out to be yet another set of rules and &hellip; <a href=\"https:\/\/mamchenkov.net\/wordpress\/2017\/12\/23\/defensive-programming-object-calisthenics\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Defensive Programming : Object Calisthenics<\/span><\/a><\/p>\n<!-- google_ad_section_end -->\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"Defensive Programming : Object Calisthenics #WebDev #PHP #OOP #BestPractices","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false,"_links_to":"","_links_to_target":""},"categories":[1,18,62],"tags":[3069,3083,38,1908],"keyring_services":[],"class_list":["post-28291","post","type-post","status-publish","format-standard","hentry","category-general","category-programming","category-technology","tag-best-practices","tag-oop","tag-php","tag-youtube-videos"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.8 - aioseo.com -->\n\t<meta name=\"description\" content=\"I came across this nice and somewhat strongly opinionated video on Defensive Programming: https:\/\/www.youtube.com\/watch?v=8d2AtAGJPno Marco Pivetta makes quite a few good points with I agree (and a few with which I disagree). One thing that he mentioned though I haven&#039;t heard about - Object Calisthenics. Which turns out to be yet another set of rules\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Leonid Mamchenkov\"\/>\n\t<meta name=\"google-site-verification\" content=\"VHvdD0_usx1_4DzKy_QCVcICVgX2EgA2ybELT-wl7kQ\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/mamchenkov.net\/wordpress\/2017\/12\/23\/defensive-programming-object-calisthenics\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.8\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Leonid Mamchenkov - Life, universe, and everything else\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Defensive Programming : Object Calisthenics - Leonid Mamchenkov\" \/>\n\t\t<meta property=\"og:description\" content=\"I came across this nice and somewhat strongly opinionated video on Defensive Programming: https:\/\/www.youtube.com\/watch?v=8d2AtAGJPno Marco Pivetta makes quite a few good points with I agree (and a few with which I disagree). One thing that he mentioned though I haven&#039;t heard about - Object Calisthenics. Which turns out to be yet another set of rules\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/mamchenkov.net\/wordpress\/2017\/12\/23\/defensive-programming-object-calisthenics\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2026\/03\/leonid-sailing-beer.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2026\/03\/leonid-sailing-beer.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t\t<meta property=\"og:image:height\" content=\"1024\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2017-12-23T09:08:54+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2017-12-23T09:08:54+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/MamchenkovBlog\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@mamchenkov\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Defensive Programming : Object Calisthenics - Leonid Mamchenkov\" \/>\n\t\t<meta name=\"twitter:description\" content=\"I came across this nice and somewhat strongly opinionated video on Defensive Programming: https:\/\/www.youtube.com\/watch?v=8d2AtAGJPno Marco Pivetta makes quite a few good points with I agree (and a few with which I disagree). One thing that he mentioned though I haven&#039;t heard about - Object Calisthenics. Which turns out to be yet another set of rules\" \/>\n\t\t<meta name=\"twitter:creator\" content=\"@mamchenkov\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2026\/03\/leonid-sailing-beer.jpg\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BlogPosting\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2017\\\/12\\\/23\\\/defensive-programming-object-calisthenics\\\/#blogposting\",\"name\":\"Defensive Programming : Object Calisthenics - Leonid Mamchenkov\",\"headline\":\"Defensive Programming : Object Calisthenics\",\"author\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/author\\\/leonid\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/#person\"},\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2017\\\/12\\\/23\\\/defensive-programming-object-calisthenics\\\/#articleImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3cf6df002a284d78fb6e9d8222ca4d102e0832035ed6bc8447008bd234e131a4?s=96&d=identicon&r=g\",\"width\":96,\"height\":96,\"caption\":\"Leonid Mamchenkov\"},\"datePublished\":\"2017-12-23T11:08:54+02:00\",\"dateModified\":\"2017-12-23T11:08:54+02:00\",\"inLanguage\":\"en-US\",\"commentCount\":2,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2017\\\/12\\\/23\\\/defensive-programming-object-calisthenics\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2017\\\/12\\\/23\\\/defensive-programming-object-calisthenics\\\/#webpage\"},\"articleSection\":\"All, Programming, Technology, best practices, OOP, PHP, YouTube videos\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2017\\\/12\\\/23\\\/defensive-programming-object-calisthenics\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/category\\\/technology\\\/#listItem\",\"name\":\"Technology\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/category\\\/technology\\\/#listItem\",\"position\":2,\"name\":\"Technology\",\"item\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/category\\\/technology\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/category\\\/technology\\\/programming\\\/#listItem\",\"name\":\"Programming\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/category\\\/technology\\\/programming\\\/#listItem\",\"position\":3,\"name\":\"Programming\",\"item\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/category\\\/technology\\\/programming\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2017\\\/12\\\/23\\\/defensive-programming-object-calisthenics\\\/#listItem\",\"name\":\"Defensive Programming : Object Calisthenics\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/category\\\/technology\\\/#listItem\",\"name\":\"Technology\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2017\\\/12\\\/23\\\/defensive-programming-object-calisthenics\\\/#listItem\",\"position\":4,\"name\":\"Defensive Programming : Object Calisthenics\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/category\\\/technology\\\/programming\\\/#listItem\",\"name\":\"Programming\"}}]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/#person\",\"name\":\"Leonid Mamchenkov\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2017\\\/12\\\/23\\\/defensive-programming-object-calisthenics\\\/#personImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3cf6df002a284d78fb6e9d8222ca4d102e0832035ed6bc8447008bd234e131a4?s=96&d=identicon&r=g\",\"width\":96,\"height\":96,\"caption\":\"Leonid Mamchenkov\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/author\\\/leonid\\\/#author\",\"url\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/author\\\/leonid\\\/\",\"name\":\"Leonid Mamchenkov\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2017\\\/12\\\/23\\\/defensive-programming-object-calisthenics\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3cf6df002a284d78fb6e9d8222ca4d102e0832035ed6bc8447008bd234e131a4?s=96&d=identicon&r=g\",\"width\":96,\"height\":96,\"caption\":\"Leonid Mamchenkov\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2017\\\/12\\\/23\\\/defensive-programming-object-calisthenics\\\/#webpage\",\"url\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2017\\\/12\\\/23\\\/defensive-programming-object-calisthenics\\\/\",\"name\":\"Defensive Programming : Object Calisthenics - Leonid Mamchenkov\",\"description\":\"I came across this nice and somewhat strongly opinionated video on Defensive Programming: https:\\\/\\\/www.youtube.com\\\/watch?v=8d2AtAGJPno Marco Pivetta makes quite a few good points with I agree (and a few with which I disagree). One thing that he mentioned though I haven't heard about - Object Calisthenics. Which turns out to be yet another set of rules\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2017\\\/12\\\/23\\\/defensive-programming-object-calisthenics\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/author\\\/leonid\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/author\\\/leonid\\\/#author\"},\"datePublished\":\"2017-12-23T11:08:54+02:00\",\"dateModified\":\"2017-12-23T11:08:54+02:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/#website\",\"url\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/\",\"name\":\"Blog of Leonid Mamchenkov\",\"description\":\"Life, universe, and everything else\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/#person\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Defensive Programming : Object Calisthenics - Leonid Mamchenkov","description":"I came across this nice and somewhat strongly opinionated video on Defensive Programming: https:\/\/www.youtube.com\/watch?v=8d2AtAGJPno Marco Pivetta makes quite a few good points with I agree (and a few with which I disagree). One thing that he mentioned though I haven't heard about - Object Calisthenics. Which turns out to be yet another set of rules","canonical_url":"https:\/\/mamchenkov.net\/wordpress\/2017\/12\/23\/defensive-programming-object-calisthenics\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"google-site-verification":"VHvdD0_usx1_4DzKy_QCVcICVgX2EgA2ybELT-wl7kQ","miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BlogPosting","@id":"https:\/\/mamchenkov.net\/wordpress\/2017\/12\/23\/defensive-programming-object-calisthenics\/#blogposting","name":"Defensive Programming : Object Calisthenics - Leonid Mamchenkov","headline":"Defensive Programming : Object Calisthenics","author":{"@id":"https:\/\/mamchenkov.net\/wordpress\/author\/leonid\/#author"},"publisher":{"@id":"https:\/\/mamchenkov.net\/wordpress\/#person"},"image":{"@type":"ImageObject","@id":"https:\/\/mamchenkov.net\/wordpress\/2017\/12\/23\/defensive-programming-object-calisthenics\/#articleImage","url":"https:\/\/secure.gravatar.com\/avatar\/3cf6df002a284d78fb6e9d8222ca4d102e0832035ed6bc8447008bd234e131a4?s=96&d=identicon&r=g","width":96,"height":96,"caption":"Leonid Mamchenkov"},"datePublished":"2017-12-23T11:08:54+02:00","dateModified":"2017-12-23T11:08:54+02:00","inLanguage":"en-US","commentCount":2,"mainEntityOfPage":{"@id":"https:\/\/mamchenkov.net\/wordpress\/2017\/12\/23\/defensive-programming-object-calisthenics\/#webpage"},"isPartOf":{"@id":"https:\/\/mamchenkov.net\/wordpress\/2017\/12\/23\/defensive-programming-object-calisthenics\/#webpage"},"articleSection":"All, Programming, Technology, best practices, OOP, PHP, YouTube videos"},{"@type":"BreadcrumbList","@id":"https:\/\/mamchenkov.net\/wordpress\/2017\/12\/23\/defensive-programming-object-calisthenics\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress#listItem","position":1,"name":"Home","item":"https:\/\/mamchenkov.net\/wordpress","nextItem":{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/#listItem","name":"Technology"}},{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/#listItem","position":2,"name":"Technology","item":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/","nextItem":{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/programming\/#listItem","name":"Programming"},"previousItem":{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/programming\/#listItem","position":3,"name":"Programming","item":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/programming\/","nextItem":{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress\/2017\/12\/23\/defensive-programming-object-calisthenics\/#listItem","name":"Defensive Programming : Object Calisthenics"},"previousItem":{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/#listItem","name":"Technology"}},{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress\/2017\/12\/23\/defensive-programming-object-calisthenics\/#listItem","position":4,"name":"Defensive Programming : Object Calisthenics","previousItem":{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/programming\/#listItem","name":"Programming"}}]},{"@type":"Person","@id":"https:\/\/mamchenkov.net\/wordpress\/#person","name":"Leonid Mamchenkov","image":{"@type":"ImageObject","@id":"https:\/\/mamchenkov.net\/wordpress\/2017\/12\/23\/defensive-programming-object-calisthenics\/#personImage","url":"https:\/\/secure.gravatar.com\/avatar\/3cf6df002a284d78fb6e9d8222ca4d102e0832035ed6bc8447008bd234e131a4?s=96&d=identicon&r=g","width":96,"height":96,"caption":"Leonid Mamchenkov"}},{"@type":"Person","@id":"https:\/\/mamchenkov.net\/wordpress\/author\/leonid\/#author","url":"https:\/\/mamchenkov.net\/wordpress\/author\/leonid\/","name":"Leonid Mamchenkov","image":{"@type":"ImageObject","@id":"https:\/\/mamchenkov.net\/wordpress\/2017\/12\/23\/defensive-programming-object-calisthenics\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/3cf6df002a284d78fb6e9d8222ca4d102e0832035ed6bc8447008bd234e131a4?s=96&d=identicon&r=g","width":96,"height":96,"caption":"Leonid Mamchenkov"}},{"@type":"WebPage","@id":"https:\/\/mamchenkov.net\/wordpress\/2017\/12\/23\/defensive-programming-object-calisthenics\/#webpage","url":"https:\/\/mamchenkov.net\/wordpress\/2017\/12\/23\/defensive-programming-object-calisthenics\/","name":"Defensive Programming : Object Calisthenics - Leonid Mamchenkov","description":"I came across this nice and somewhat strongly opinionated video on Defensive Programming: https:\/\/www.youtube.com\/watch?v=8d2AtAGJPno Marco Pivetta makes quite a few good points with I agree (and a few with which I disagree). One thing that he mentioned though I haven't heard about - Object Calisthenics. Which turns out to be yet another set of rules","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/mamchenkov.net\/wordpress\/#website"},"breadcrumb":{"@id":"https:\/\/mamchenkov.net\/wordpress\/2017\/12\/23\/defensive-programming-object-calisthenics\/#breadcrumblist"},"author":{"@id":"https:\/\/mamchenkov.net\/wordpress\/author\/leonid\/#author"},"creator":{"@id":"https:\/\/mamchenkov.net\/wordpress\/author\/leonid\/#author"},"datePublished":"2017-12-23T11:08:54+02:00","dateModified":"2017-12-23T11:08:54+02:00"},{"@type":"WebSite","@id":"https:\/\/mamchenkov.net\/wordpress\/#website","url":"https:\/\/mamchenkov.net\/wordpress\/","name":"Blog of Leonid Mamchenkov","description":"Life, universe, and everything else","inLanguage":"en-US","publisher":{"@id":"https:\/\/mamchenkov.net\/wordpress\/#person"}}]},"og:locale":"en_US","og:site_name":"Leonid Mamchenkov - Life, universe, and everything else","og:type":"article","og:title":"Defensive Programming : Object Calisthenics - Leonid Mamchenkov","og:description":"I came across this nice and somewhat strongly opinionated video on Defensive Programming: https:\/\/www.youtube.com\/watch?v=8d2AtAGJPno Marco Pivetta makes quite a few good points with I agree (and a few with which I disagree). One thing that he mentioned though I haven't heard about - Object Calisthenics. Which turns out to be yet another set of rules","og:url":"https:\/\/mamchenkov.net\/wordpress\/2017\/12\/23\/defensive-programming-object-calisthenics\/","og:image":"https:\/\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2026\/03\/leonid-sailing-beer.jpg","og:image:secure_url":"https:\/\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2026\/03\/leonid-sailing-beer.jpg","og:image:width":1024,"og:image:height":1024,"article:published_time":"2017-12-23T09:08:54+00:00","article:modified_time":"2017-12-23T09:08:54+00:00","article:publisher":"https:\/\/www.facebook.com\/MamchenkovBlog","twitter:card":"summary_large_image","twitter:site":"@mamchenkov","twitter:title":"Defensive Programming : Object Calisthenics - Leonid Mamchenkov","twitter:description":"I came across this nice and somewhat strongly opinionated video on Defensive Programming: https:\/\/www.youtube.com\/watch?v=8d2AtAGJPno Marco Pivetta makes quite a few good points with I agree (and a few with which I disagree). One thing that he mentioned though I haven't heard about - Object Calisthenics. Which turns out to be yet another set of rules","twitter:creator":"@mamchenkov","twitter:image":"https:\/\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2026\/03\/leonid-sailing-beer.jpg"},"aioseo_meta_data":{"post_id":"28291","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2023-07-20 05:05:58","updated":"2026-01-15 13:23:44","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/mamchenkov.net\/wordpress\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/\" title=\"Technology\">Technology<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/programming\/\" title=\"Programming\">Programming<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tDefensive Programming : Object Calisthenics\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/mamchenkov.net\/wordpress"},{"label":"Technology","link":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/"},{"label":"Programming","link":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/programming\/"},{"label":"Defensive Programming : Object Calisthenics","link":"https:\/\/mamchenkov.net\/wordpress\/2017\/12\/23\/defensive-programming-object-calisthenics\/"}],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":27291,"url":"https:\/\/mamchenkov.net\/wordpress\/2017\/02\/05\/defensive-bash-programming\/","url_meta":{"origin":28291,"position":0},"title":"Defensive BASH Programming","author":"Leonid Mamchenkov","date":"February 5, 2017","format":false,"excerpt":"If you write any Bash code that lasts more than a day, you should definitely read \"Defensive BASH Programming\" and follow the advice, if you haven't already. \u00a0It covers the following: Immutable global variables Everything is local main() Everything is a function Debugging functions Code clarity Each line does just\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":28490,"url":"https:\/\/mamchenkov.net\/wordpress\/2018\/04\/18\/wordpress-plugin-boilerplate-a-standardized-organized-object-oriented-foundation-for-building-high-quality-wordpress-plugins\/","url_meta":{"origin":28291,"position":1},"title":"WordPress Plugin Boilerplate &#8211; a standardized, organized, object-oriented foundation for building high-quality WordPress Plugins","author":"Leonid Mamchenkov","date":"April 18, 2018","format":false,"excerpt":"WordPress is an excellent system for a whole lot of different projects and needs.\u00a0 It's widely used, fast, and flexible.\u00a0 However it does show its age in many ways.\u00a0 One of the areas where things could be a lot better and simpler is the WordPress plugin development. WordPress plugins are\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":17764,"url":"https:\/\/mamchenkov.net\/wordpress\/2013\/02\/18\/ten-things-i-hate-about-object-oriented-programming\/","url_meta":{"origin":28291,"position":2},"title":"Ten Things I Hate About Object-Oriented Programming","author":"Leonid Mamchenkov","date":"February 18, 2013","format":"link","excerpt":"Ten Things I Hate About Object-Oriented Programming Apparently I\u2019m not the only one. In the immortal words of Edsger Dijkstra: \"Object-oriented programming is an exceptionally bad idea which could only have originated in California.\"","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":7882,"url":"https:\/\/mamchenkov.net\/wordpress\/2004\/09\/09\/object-oriented-programming-concepts\/","url_meta":{"origin":28291,"position":3},"title":"Object-oriented programming concepts","author":"Leonid Mamchenkov","date":"September 9, 2004","format":false,"excerpt":"Here is a nice (as in short and simple) tutorial on object-oriented programming concepts. It touches only briefly and a few concepts: objects, class, message, inheritance, and interface. There is a practical part based on Java. And that's about it. Studying this tutorial will not make you an OOP expert\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":9617,"url":"https:\/\/mamchenkov.net\/wordpress\/2005\/10\/28\/daily-del-icio-us-bookmarks\/","url_meta":{"origin":28291,"position":4},"title":"Daily del.icio.us bookmarks","author":"Leonid Mamchenkov","date":"October 28, 2005","format":false,"excerpt":"Shared bookmarks for del.icio.us user tvset on 2005-10-27 The Object Oriented Programming Web -- Programming and Computer Science Tutorials, Lecture notes and online books Tagged as: algorithms books development programming tutorials Dictionary of Algorithms and Data Structures Tagged as: algorithm algorithms computers concepts data development dictionary documentation education engineering howto\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":16628,"url":"https:\/\/mamchenkov.net\/wordpress\/2012\/08\/16\/geek-and-poke-teaching-object-orientation\/","url_meta":{"origin":28291,"position":5},"title":"Geek And Poke : Teaching Object Orientation","author":"Leonid Mamchenkov","date":"August 16, 2012","format":"image","excerpt":"Via Geek and Poke. \u00a0","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2012\/08\/OOP.jpg?fit=800%2C1132&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2012\/08\/OOP.jpg?fit=800%2C1132&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2012\/08\/OOP.jpg?fit=800%2C1132&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2012\/08\/OOP.jpg?fit=800%2C1132&ssl=1&resize=700%2C400 2x"},"classes":[]}],"jetpack_sharing_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts\/28291","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/comments?post=28291"}],"version-history":[{"count":0,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts\/28291\/revisions"}],"wp:attachment":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/media?parent=28291"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/categories?post=28291"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/tags?post=28291"},{"taxonomy":"keyring_services","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/keyring_services?post=28291"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}