TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Making Wrong Code Look Wrong (2005)

38 pointsby blackswanover 16 years ago

3 comments

tomeover 16 years ago
I like the ideas expressed but I'd rather see them enforced by the language than by coding convention. For example to simulate type checking you could prefix _typename onto each of your variable names. Then<p>i_int += j_filehandle<p>would stick out as wrong. But luckily many languages support type checking so we don't have to do it in those languages!<p>I wonder is it possible to avoid mixing safe and unsafe strings (for example) using some new language feature (or a new use of an old one)?
评论 #472703 未加载
评论 #472701 未加载
smanekover 16 years ago
Well, my first thought would be using macros to ensure you never have 'unsafe' strings anywhere.<p>But, for some inexplicable reason, Joel says "Don’t use macros to create your own personal programming language."<p>How is using macros to encapsulate common functionality any different than using functions to encapsulate common functionality? Both lead to less mental overhead, more code reuse, and code that's easier to parse.
评论 #472917 未加载
Herringover 16 years ago
I don't quite buy his argument about why we need to keep things in unsafe format for a while. If that credit card app can't handle HTML-encoded stuff, how would it handle evil javascript?
评论 #473163 未加载
评论 #472921 未加载