[{"data":1,"prerenderedAt":79},["ShallowReactive",2],{"term-d\u002Fdefensive-naming":3,"related-d\u002Fdefensive-naming":60},{"id":4,"title":5,"acronym":6,"body":7,"category":40,"description":41,"difficulty":42,"extension":43,"letter":44,"meta":45,"navigation":46,"path":47,"related":48,"seo":54,"sitemap":55,"stem":58,"subcategory":6,"__hash__":59},"terms\u002Fterms\u002Fd\u002Fdefensive-naming.md","Defensive Naming",null,{"type":8,"value":9,"toc":33},"minimark",[10,15,19,23,26,30],[11,12,14],"h2",{"id":13},"eli5-the-vibe-check","ELI5 - The Vibe Check",[16,17,18],"p",{},"You don't just call it 'data,' you call it 'rawUserInputUnvalidated' because you know, deep in your bones, that someone, possibly future you, will eventually use it without checking it first. Defensive naming is writing variable and function names so explicit about their risks and assumptions that misuse becomes almost impossible, even for someone skimming at 2 a.m.",[11,20,22],{"id":21},"real-talk","Real Talk",[16,24,25],{},"Defensive naming is the practice of choosing identifiers that make a value's state, safety, or assumptions explicit, such as raw versus sanitized or validated versus unvalidated, so that misuse is caught by inspection rather than by a runtime bug. It trades a small amount of verbosity for a meaningful reduction in the class of errors that come from developers assuming more than a name actually guarantees.",[11,27,29],{"id":28},"when-youll-hear-this","When You'll Hear This",[16,31,32],{},"\"Rename it to rawInput, defensive naming would have caught this bug in code review.\" \u002F \"I know it's verbose, but defensive naming has saved us from this exact mistake before.\"",{"title":34,"searchDepth":35,"depth":35,"links":36},"",2,[37,38,39],{"id":13,"depth":35,"text":14},{"id":21,"depth":35,"text":22},{"id":28,"depth":35,"text":29},"general","You don't just call it 'data,' you call it 'rawUserInputUnvalidated' because you know, deep in your bones, that someone, possibly future you, will eventual...","intermediate","md","d",{},true,"\u002Fterms\u002Fd\u002Fdefensive-naming",[49,50,51,52,53],"Magic Number","Code Smell","Input Validation","Type Guard","Static Typing",{"title":5,"description":41},{"changefreq":56,"priority":57},"weekly",0.7,"terms\u002Fd\u002Fdefensive-naming","Tt2EAYmigl4eP8xGeEh-f8id0KRB4dYBR6dzkGgGNNs",[61,66,70,73,76],{"title":50,"path":62,"acronym":6,"category":63,"difficulty":64,"description":65},"\u002Fterms\u002Fc\u002Fcode-smell","architecture","beginner","Code that works but feels... wrong. Like when food smells slightly off — it might be fine, but something isn't right.",{"title":51,"path":67,"acronym":6,"category":68,"difficulty":64,"description":69},"\u002Fterms\u002Fi\u002Finput-validation","security","Input validation is checking that user input is what you expect before using it.",{"title":49,"path":71,"acronym":6,"category":40,"difficulty":64,"description":72},"\u002Fterms\u002Fm\u002Fmagic-number","A random number in your code with no explanation. Like writing `if (age > 17)` instead of `if (age > MINIMUM_AGE)`.",{"title":53,"path":74,"acronym":6,"category":40,"difficulty":42,"description":75},"\u002Fterms\u002Fs\u002Fstatic-typing","Static typing means you have to tell the computer what type each variable is when you write the code, and it checks everything is correct BEFORE running.",{"title":52,"path":77,"acronym":6,"category":40,"difficulty":42,"description":78},"\u002Fterms\u002Ft\u002Ftype-guard","A type guard is like a bouncer at a club checking IDs. Before your code enters the VIP section, the guard checks 'are you a string or a number?",1792528078232]