Close
  • Latest News
  • Artificial Intelligence
  • Video
  • Big Data and Analytics
  • Cloud
  • Networking
  • Cybersecurity
  • Applications
  • IT Management
  • Storage
  • Sponsored
  • Mobile
  • Small Business
  • Development
  • Database
  • Servers
  • Android
  • Apple
  • Innovation
  • Blogs
  • PC Hardware
  • Reviews
  • Search Engines
  • Virtualization
Read Down
Sign in
Close
Welcome!Log into your account
Forgot your password?
Read Down
Password recovery
Recover your password
Close
Search
Logo
Subscribe
Logo
  • Latest News
  • Artificial Intelligence
  • Video
  • Big Data and Analytics
  • Cloud
  • Networking
  • Cybersecurity
  • Applications
  • IT Management
  • Storage
  • Sponsored
  • Mobile
  • Small Business
  • Development
  • Database
  • Servers
  • Android
  • Apple
  • Innovation
  • Blogs
  • PC Hardware
  • Reviews
  • Search Engines
  • Virtualization
More
    Subscribe
    Home Development
    • Development

    Save Me from Cleverness

    Written by

    Peter Coffee
    Published May 15, 2006
    Share
    Facebook
    Twitter
    Linkedin

      eWEEK content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More.

      Programming guru Brian Kernighan has famously said that debugging code is twice as difficult as writing it—and, he said, it follows that, “If you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.” Id generalize this to two principles that should be followed by anyone who buys, builds or uses complex and powerful systems: Leave half of what you have in reserve, and assume below-average cleverness.

      I first saw Kernighans warning in the 1988 paperback reprint of his 1974 McGraw-Hill book (with P.J. Plauger), “The Elements of Programming Style.” Many people have been quoting his comments this May in the context of a flaw found in March in a widely used implementation of the X Window System, an MIT-originated protocol for cross-platform GUI construction.

      Despite the mocking label of “the first fully modular software disaster” seen on a poster at one X Window conference, X Window has been a pathway to portability for any number of useful tools that might otherwise be available only on Windows. For example, the Macintosh version of the SlickEdit programmers editor runs on Macs by means of the X Window implementation packaged with OS X.

      X Window is an open-source project (www.x.org), with plenty of eyes scanning its reference implementation and other implementations for bugs or vulnerabilities. A Department of Homeland Security audit (your tax dollars at work) found the flaw that provoked this months comments on cleverness—and many have since made the point that this demonstrates a key virtue of open-source efforts.

      In our own eWeek story on how the vulnerability came to light (see “Govt-funded security audit flags X11 vulnerability” at eweek.com), the chief technical officer of the DHS contractor doing the audit described the cause as “something as seemingly harmless as a missing closing parenthesis.” Thats not quite correct, and the problem would have been found much sooner if that had been the case.

      Missing punctuation will generally result in a programs failing to compile, let alone run—although substituting one punctuation mark for another can be devastating, as in the legendary case of the FORTRAN code that disrupted a NASA mission when a period replaced a comma.

      In the case of the recently discovered X Window flaw, the missing marks were a pair of parentheses, creating a classic case of the machine doing exactly what it was told instead of what was wanted. In two places where the code should have said “geteuid()” (call function “geteuid” with no arguments and return the result), there instead appeared “geteuid” (return the memory location of the “geteuid” code).

      The error would have been caught if the C programming language distinguished between the concepts of zero (a number) and null (absence of a value), but it does not. The convenience of using “0” for both, and the cleverness of letting a functions name serve as both verb of invocation and noun of code location, are defining features of the C language—of which cleverness critic Kernighan, ironically, was one of the main designers.

      Famously terse, C is not a language where youd expect to find something as verbose as Visual Basic .Nets “AddressOf” operator, which appears in statements such as “AddHandler Button1.Click, AddressOf Button-ClickHandler” (an example from Microsoft documentation) and makes the codes intention perfectly obvious. Another good rule to remember is that most code will be written only once but read many times, and that its more important for a language to be easy to read without ambiguity than to be easy to write with few keystrokes.

      But coders are not the only ones who are ill-served by systems designed to treat almost every possible input as a legitimate (if, perhaps, obscure) command. Try to find a keystroke in an application like Microsoft Word that doesnt have some function, changing the editing sessions behavior without telling the user how or why.

      Real systems and real users dont do well when balanced on the sharp edge of making too many things too easy to do, in ways that are often too difficult to see.

      Peter Coffee can be reached at [email protected].

      /zimages/6/28571.gifFor reader response to this column, click here.

      /zimages/6/28571.gifCheck out eWEEK.coms for the latest news, reviews and analysis in programming environments and developer tools.

      Peter Coffee
      Peter Coffee
      Peter Coffee is Director of Platform Research at salesforce.com, where he serves as a liaison with the developer community to define the opportunity and clarify developers' technical requirements on the company's evolving Apex Platform. Peter previously spent 18 years with eWEEK (formerly PC Week), the national news magazine of enterprise technology practice, where he reviewed software development tools and methods and wrote regular columns on emerging technologies and professional community issues.Before he began writing full-time in 1989, Peter spent eleven years in technical and management positions at Exxon and The Aerospace Corporation, including management of the latter company's first desktop computing planning team and applied research in applications of artificial intelligence techniques. He holds an engineering degree from MIT and an MBA from Pepperdine University, he has held teaching appointments in computer science, business analytics and information systems management at Pepperdine, UCLA, and Chapman College.

      Get the Free Newsletter!

      Subscribe to Daily Tech Insider for top news, trends & analysis

      Get the Free Newsletter!

      Subscribe to Daily Tech Insider for top news, trends & analysis

      MOST POPULAR ARTICLES

      Artificial Intelligence

      9 Best AI 3D Generators You Need...

      Sam Rinko - June 25, 2024 0
      AI 3D Generators are powerful tools for many different industries. Discover the best AI 3D Generators, and learn which is best for your specific use case.
      Read more
      Cloud

      RingCentral Expands Its Collaboration Platform

      Zeus Kerravala - November 22, 2023 0
      RingCentral adds AI-enabled contact center and hybrid event products to its suite of collaboration services.
      Read more
      Artificial Intelligence

      8 Best AI Data Analytics Software &...

      Aminu Abdullahi - January 18, 2024 0
      Learn the top AI data analytics software to use. Compare AI data analytics solutions & features to make the best choice for your business.
      Read more
      Latest News

      Zeus Kerravala on Networking: Multicloud, 5G, and...

      James Maguire - December 16, 2022 0
      I spoke with Zeus Kerravala, industry analyst at ZK Research, about the rapid changes in enterprise networking, as tech advances and digital transformation prompt...
      Read more
      Video

      Datadog President Amit Agarwal on Trends in...

      James Maguire - November 11, 2022 0
      I spoke with Amit Agarwal, President of Datadog, about infrastructure observability, from current trends to key challenges to the future of this rapidly growing...
      Read more
      Logo

      eWeek has the latest technology news and analysis, buying guides, and product reviews for IT professionals and technology buyers. The site’s focus is on innovative solutions and covering in-depth technical content. eWeek stays on the cutting edge of technology news and IT trends through interviews and expert analysis. Gain insight from top innovators and thought leaders in the fields of IT, business, enterprise software, startups, and more.

      Facebook
      Linkedin
      RSS
      Twitter
      Youtube

      Advertisers

      Advertise with TechnologyAdvice on eWeek and our other IT-focused platforms.

      Advertise with Us

      Menu

      • About eWeek
      • Subscribe to our Newsletter
      • Latest News

      Our Brands

      • Privacy Policy
      • Terms
      • About
      • Contact
      • Advertise
      • Sitemap
      • California – Do Not Sell My Information

      Property of TechnologyAdvice.
      © 2024 TechnologyAdvice. All Rights Reserved

      Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.