{"id":1346,"date":"2020-10-10T10:00:57","date_gmt":"2020-10-10T10:00:57","guid":{"rendered":"http:\/\/blog.softwareclues.com\/?p=1346"},"modified":"2020-10-10T22:45:31","modified_gmt":"2020-10-10T22:45:31","slug":"the-traps-of-frameworks","status":"publish","type":"post","link":"http:\/\/blog.softwareclues.com\/zh\/the-traps-of-frameworks","title":{"rendered":"The Traps of Frameworks"},"content":{"rendered":"<p class=\"graf graf--p\">When I interview a Java developer, if I see Spring Boot or Spring on the candidate\u2019s resume, I may start with a simple question: \u201c<strong class=\"markup--strong markup--p-strong\">What is the default scope for a Spring bean<\/strong>\u201d? Most people would get it right. I would then follow with a tricky question: \u201c<strong class=\"markup--strong markup--p-strong\">Does Spring make sure a Singleton bean thread-safe<\/strong>?\u201d or \u201c<strong class=\"markup--strong markup--p-strong\">Does developer need to do anything to make sure a Singleton bean thread-safe<\/strong>?\u201d.<\/p>\n<p class=\"graf graf--p\">When I say \u201ctricky\u201d, not because it\u2019s tricky technically, but because half interviewees have no idea. The other half who correctly answered don\u2019t always demonstrate solid understanding of Singleton and thread-safety. It\u2019s okay to guess at an interview I guess.<\/p>\n<p class=\"graf graf--p\">Spring Boot is one of those popular frameworks for Java developers. Like most other Java frameworks, it provides proven reusable libraries and increases productivity. Some developers can probably make a living by simply being good at it.<\/p>\n<p class=\"graf graf--p\">However, because it encapsulates the interpretation of various Java Specifications, hides the complexity of design and implementation, <strong class=\"markup--strong markup--p-strong\">often the framework itself imposes a serious impediment for developers to understand the underlining fundamentals<\/strong>.<\/p>\n<p class=\"graf graf--p\">Many Spring Boot developers don\u2019t know Spring Boot is just a framework on top of another popular framework <strong>Spring Framework<\/strong>, which was initially a framework for Java <strong>Servlet<\/strong> applications. Most freshly-minted Spring Boot developers never heard of Servlet, not to mention <strong>web.xml<\/strong>. They only know their Spring Boot applications, \u201c<strong class=\"markup--strong markup--p-strong\">just run<\/strong>\u201d. They never know why and how it runs.<\/p>\n<p class=\"graf graf--p\">Because of that, they never think of what the underlining Servlet Container is, what the default configurations (like Max Concurrent Requests) are, and how to fine tune those configurations. Imagine asking them to write a Java Web Application without Spring Boot?<\/p>\n<p class=\"graf graf--p\">Frameworks tend to wrap a lot of default features and behaviors under the hood, just to name a few: default Encryption Algorithm, default Socket Timeout, default Retry Strategy.<\/p>\n<p class=\"graf graf--p\">In the past, Frameworks might have configuration property for each \u201cfeature\u201d, but this has changed in the recent years. Nowadays, Framework authors tend to favor \u201c<a class=\"markup--anchor markup--p-anchor\" href=\"https:\/\/en.wikipedia.org\/wiki\/Convention_over_configuration\" target=\"_blank\" rel=\"noopener noreferrer\" data-href=\"https:\/\/en.wikipedia.org\/wiki\/Convention_over_configuration\"><strong class=\"markup--strong markup--p-strong\">Convention over configuration<\/strong><\/a><strong class=\"markup--strong markup--p-strong\">\u201d.<\/strong> Old configuration files are replaced by annotations with \u201c<strong class=\"markup--strong markup--p-strong\">sensible defaults<\/strong>\u201d. Moreover, many of the features and behaviors are \u201cdiscovered\u201d automatically based on your running environments, like system properties, environment variables and what is in the class-path.<\/p>\n<p class=\"graf graf--p\">Several years back, I led a framework team. We built a Framework as the foundation for a slew of web applications that support multi-million $ business. We worked very hard to support all major features by default, and still allow each application to extend and override each feature by configuration and automatic discovery. I learned first hand, it\u2019s even harder for application developers to fully understand how each feature worked and how to extend or override them.<\/p>\n<p class=\"graf graf--p\">Naturally, due to the lack of visibility and transparency of frameworks, people makes a lot of assumptions about frameworks, such as Singleton bean thread-safety. Some of the assumptions will definitely haunt the team down the road if the technical leads on the team didn\u2019t review the design and code carefully.<\/p>\n<p class=\"graf graf--p\">Overtime, frameworks will evolve or die. If you ever worked with Struts 1.x framework, and if you didn\u2019t understand Java Servlet, you would have a difficult time to migrate your applications to Struts 2.x or Spring.<\/p>\n<p class=\"graf graf--p\"><strong class=\"markup--strong markup--p-strong\">Frameworks are your tools, not your crutches<\/strong>. <strong class=\"markup--strong markup--p-strong\">If you don\u2019t think out of the box of Spring Boot, you can\u2019t professionally outgrow Spring Boot<\/strong>. Simple. Period.<\/p>\n<p class=\"graf graf--p\">That is true to other frameworks too.<\/p>\n<p class=\"graf graf--p\">Frameworks can help you get started quickly, but understanding the underlining principles will help you in the long run.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When I interview a Java developer, if I see Spring Boot &hellip; <a href=\"http:\/\/blog.softwareclues.com\/zh\/the-traps-of-frameworks\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201cThe Traps of Frameworks\u201d<\/span><\/a><\/p>\n","protected":false},"author":1097,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":true,"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}}},"categories":[3,50,72],"tags":[92,137,115,135,136],"translation":{"provider":"WPGlobus","version":"2.12.2","language":"zh","enabled_languages":["en","zh"],"languages":{"en":{"title":true,"content":true,"excerpt":false},"zh":{"title":false,"content":false,"excerpt":false}}},"jetpack_publicize_connections":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>The Traps of Frameworks - \u8f6f\u4ef6\u542f\u793a\u5f55<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/blog.softwareclues.com\/the-traps-of-frameworks\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"The Traps of Frameworks - \u8f6f\u4ef6\u542f\u793a\u5f55\" \/>\n<meta property=\"og:url\" content=\"http:\/\/blog.softwareclues.com\/the-traps-of-frameworks\" \/>\n<meta property=\"og:site_name\" content=\"\u8f6f\u4ef6\u542f\u793a\u5f55\" \/>\n<meta property=\"article:published_time\" content=\"2020-10-10T10:00:57+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-10-10T22:45:31+00:00\" \/>\n<meta name=\"author\" content=\"Liesheng Long\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"Liesheng Long\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"http:\/\/blog.softwareclues.com\/the-traps-of-frameworks\",\"url\":\"http:\/\/blog.softwareclues.com\/the-traps-of-frameworks\",\"name\":\"The Traps of Frameworks - \u8f6f\u4ef6\u542f\u793a\u5f55\",\"isPartOf\":{\"@id\":\"http:\/\/blog.softwareclues.com\/#website\"},\"datePublished\":\"2020-10-10T10:00:57+00:00\",\"dateModified\":\"2020-10-10T22:45:31+00:00\",\"author\":{\"@id\":\"http:\/\/blog.softwareclues.com\/#\/schema\/person\/ff797d30c4d54be305f52ff52a33a9a4\"},\"breadcrumb\":{\"@id\":\"http:\/\/blog.softwareclues.com\/the-traps-of-frameworks#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/blog.softwareclues.com\/the-traps-of-frameworks\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/blog.softwareclues.com\/the-traps-of-frameworks#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/blog.softwareclues.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"The Traps of Frameworks\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/blog.softwareclues.com\/#website\",\"url\":\"http:\/\/blog.softwareclues.com\/\",\"name\":\"\u8f6f\u4ef6\u542f\u793a\u5f55\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/blog.softwareclues.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"http:\/\/blog.softwareclues.com\/#\/schema\/person\/ff797d30c4d54be305f52ff52a33a9a4\",\"name\":\"Liesheng Long\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"http:\/\/blog.softwareclues.com\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/0.gravatar.com\/avatar\/67b0b2025216951440393e7d97d7999d?s=96&d=mystery&r=g\",\"contentUrl\":\"http:\/\/0.gravatar.com\/avatar\/67b0b2025216951440393e7d97d7999d?s=96&d=mystery&r=g\",\"caption\":\"Liesheng Long\"},\"url\":\"http:\/\/blog.softwareclues.com\/zh\/author\/liesheng\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"The Traps of Frameworks - \u8f6f\u4ef6\u542f\u793a\u5f55","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/blog.softwareclues.com\/the-traps-of-frameworks","og_locale":"zh_CN","og_type":"article","og_title":"The Traps of Frameworks - \u8f6f\u4ef6\u542f\u793a\u5f55","og_url":"http:\/\/blog.softwareclues.com\/the-traps-of-frameworks","og_site_name":"\u8f6f\u4ef6\u542f\u793a\u5f55","article_published_time":"2020-10-10T10:00:57+00:00","article_modified_time":"2020-10-10T22:45:31+00:00","author":"Liesheng Long","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"Liesheng Long","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"http:\/\/blog.softwareclues.com\/the-traps-of-frameworks","url":"http:\/\/blog.softwareclues.com\/the-traps-of-frameworks","name":"The Traps of Frameworks - \u8f6f\u4ef6\u542f\u793a\u5f55","isPartOf":{"@id":"http:\/\/blog.softwareclues.com\/#website"},"datePublished":"2020-10-10T10:00:57+00:00","dateModified":"2020-10-10T22:45:31+00:00","author":{"@id":"http:\/\/blog.softwareclues.com\/#\/schema\/person\/ff797d30c4d54be305f52ff52a33a9a4"},"breadcrumb":{"@id":"http:\/\/blog.softwareclues.com\/the-traps-of-frameworks#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["http:\/\/blog.softwareclues.com\/the-traps-of-frameworks"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/blog.softwareclues.com\/the-traps-of-frameworks#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/blog.softwareclues.com\/"},{"@type":"ListItem","position":2,"name":"The Traps of Frameworks"}]},{"@type":"WebSite","@id":"http:\/\/blog.softwareclues.com\/#website","url":"http:\/\/blog.softwareclues.com\/","name":"\u8f6f\u4ef6\u542f\u793a\u5f55","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/blog.softwareclues.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"http:\/\/blog.softwareclues.com\/#\/schema\/person\/ff797d30c4d54be305f52ff52a33a9a4","name":"Liesheng Long","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"http:\/\/blog.softwareclues.com\/#\/schema\/person\/image\/","url":"http:\/\/0.gravatar.com\/avatar\/67b0b2025216951440393e7d97d7999d?s=96&d=mystery&r=g","contentUrl":"http:\/\/0.gravatar.com\/avatar\/67b0b2025216951440393e7d97d7999d?s=96&d=mystery&r=g","caption":"Liesheng Long"},"url":"http:\/\/blog.softwareclues.com\/zh\/author\/liesheng"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/paLJfj-lI","jetpack-related-posts":[],"_links":{"self":[{"href":"http:\/\/blog.softwareclues.com\/zh\/wp-json\/wp\/v2\/posts\/1346"}],"collection":[{"href":"http:\/\/blog.softwareclues.com\/zh\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.softwareclues.com\/zh\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.softwareclues.com\/zh\/wp-json\/wp\/v2\/users\/1097"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.softwareclues.com\/zh\/wp-json\/wp\/v2\/comments?post=1346"}],"version-history":[{"count":6,"href":"http:\/\/blog.softwareclues.com\/zh\/wp-json\/wp\/v2\/posts\/1346\/revisions"}],"predecessor-version":[{"id":1360,"href":"http:\/\/blog.softwareclues.com\/zh\/wp-json\/wp\/v2\/posts\/1346\/revisions\/1360"}],"wp:attachment":[{"href":"http:\/\/blog.softwareclues.com\/zh\/wp-json\/wp\/v2\/media?parent=1346"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.softwareclues.com\/zh\/wp-json\/wp\/v2\/categories?post=1346"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.softwareclues.com\/zh\/wp-json\/wp\/v2\/tags?post=1346"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}