{"id":45356,"date":"2024-10-14T14:28:48","date_gmt":"2024-10-14T18:28:48","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=45356"},"modified":"2024-10-14T14:28:48","modified_gmt":"2024-10-14T18:28:48","slug":"greppability-is-an-underrated-code-metric","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2024\/10\/14\/greppability-is-an-underrated-code-metric\/","title":{"rendered":"Greppability Is an Underrated Code Metric"},"content":{"rendered":"<p><a href=\"https:\/\/morizbuesing.com\/blog\/greppability-code-metric\/\">Moriz B&uuml;sing<\/a> (via <a href=\"https:\/\/news.ycombinator.com\/item?id=41430772\">Hacker News<\/a>):<\/p>\n<blockquote cite=\"https:\/\/morizbuesing.com\/blog\/greppability-code-metric\/\">\n<p>It turns out that splitting up, or dynamically constructing identifiers is a bad idea.<\/p>\n<p>[&#8230;]<\/p>\n<p>Don&rsquo;t rename fields at application boundaries to match naming schemes. An obvious example is then importing postgres-style snake_case identifiers into javascript, then converting them to camelCase.<\/p>\n<p>[&#8230;]<\/p>\n<p>Taking inspiration from the <a href=\"https:\/\/peps.python.org\/pep-0020\/\">Zen of Python<\/a>,\nwhen dealing with namespaces, flattening your folders\/object structures is mostly better\nthan nesting.<\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/mastodon.social\/@troz\/113036675509741563\">Sarah Reichelt<\/a>:<\/p>\n<blockquote cite=\"https:\/\/mastodon.social\/@troz\/113036675509741563\"><p>I applauded Swift&rsquo;s plan to eliminate all the <code>NS<\/code> prefixes but searching for <code>Data<\/code> or <code>String<\/code> is impossible. <code>NSData<\/code> &amp; <code>NSString<\/code> were much more searchable.<\/p><\/blockquote>\n\n<p>No matter how smart the IDE is, there will be times when you need to search the raw source. And, of course, Google and Stack Overflow and your issue tracker don&rsquo;t understand what the symbols refer to.<\/p>","protected":false},"excerpt":{"rendered":"<p>Moriz B&uuml;sing (via Hacker News): It turns out that splitting up, or dynamically constructing identifiers is a bad idea. [&#8230;] Don&rsquo;t rename fields at application boundaries to match naming schemes. An obvious example is then importing postgres-style snake_case identifiers into javascript, then converting them to camelCase. [&#8230;] Taking inspiration from the Zen of Python, when [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2024-10-14T18:28:56Z","apple_news_api_id":"230ebb4c-2dfa-4cb0-9e67-6b859cc75b6c","apple_news_api_modified_at":"2024-10-14T18:28:56Z","apple_news_api_revision":"AAAAAAAAAAD\/\/\/\/\/\/\/\/\/\/w==","apple_news_api_share_url":"https:\/\/apple.news\/AIw67TC36TLCeZ2uFnMdbbA","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[69,27,719,31,2586,30,2598,54,71,901],"class_list":["post-45356","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-cocoa","tag-craft","tag-grep","tag-ios","tag-ios-18","tag-mac","tag-macos-15-sequoia","tag-objective-c","tag-programming","tag-swift-programming-language"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/45356","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=45356"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/45356\/revisions"}],"predecessor-version":[{"id":45357,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/45356\/revisions\/45357"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=45356"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=45356"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=45356"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}