Zach’s ugly mug (his face) Zach Leatherman

Surnamespacing

May 07, 2008

Everyone has a library. Everyone has their own utility classes and functions they’re using in their own personal and contracted projects. And now that everyone has a blog too, they’re all releasing their libraries as open source, using the commando underoo philosophy of wild, free, and unrestricted naming schemes for their code. Not anymore. Let’s surnamespace.

What does surnamespacing give me?

  • Accountability: Your code is directly linked to your family honor. You’d be surprised how hard people work at test cases and increased code coverage when the respect of their lineage is at stake.
  • Connect with your Extended Family: Connect with programmers sharing your namespace, your family is now your development team.
  • Minimize Collisons: The ball and chain associated with an imposed naming scheme means that we won’t have everyone using foo and bar to hold their code, unless you’re the lucky son of a bitch that has inherited that top notch surnamespace real estate.
  • Faster Initial Development Cycle: Sometimes naming your library is the hardest part. Skip this step and just surnamespace it.
    Jesus Christ, please show me some examples:

JavaScript Surnamespacing

    var Christ = {
        Jesus: {
            walkOn: function(obj) {},
            turn: function(from, to) {},
            respawn: function() {}
        }
    };
    // Sample Usage
    Christ.Jesus.walkOn('water');
    Christ.Jesus.turn('water', 'wine');
    Christ.Jesus.respawn();

Java Surnamespacing

    package Christ;
    public class Jesus {
        public void walkOn(String s) {}
        public void turn(String from, String to) {}
        public void respawn() {}
    }

PHP 6 Surnamespacing (projected usage)

    namespace Christ {
        class Jesus {
            public function walkOn($obj) {}
            public function turn($from, $to) {}
            public function respawn() {}
        }
    }

Update: Apparently I can’t write Java code. Don’t tell work.


< Newer
Javascript Objects are NOT JSON
Older >
Don&#8217;t Let the Door Hit You Onunload and Onbeforeunload

Zach Leatherman IndieWeb Avatar for https://zachleat.com/is a builder for the web at IndieWeb Avatar for https://cloudcannon.com/CloudCannon. He is the creator and maintainer of IndieWeb Avatar for https://www.11ty.devEleventy (11ty), an award-winning open source site generator. At one point he became entirely too fixated on web fonts. He has given 79 talks in nine different countries at events like Beyond Tellerrand, Smashing Conference, Jamstack Conf, CSSConf, and The White House. Formerly part of Netlify, Filament Group, NEJS CONF, and NebraskaJS. Learn more about Zach »

3 Comments
  1. Matt Disqus

    08 May 2008
    I call the top-level Smith surnamespace.
  2. Zach Leatherman Disqus

    08 May 2008
    You'd better hope Remington isn't a programmer.
  3. Tim Disqus

    09 May 2008
    PHP 5.3 will have namespaces too!
Shamelessly plug your related post

These are webmentions via the IndieWeb and webmention.io.

Sharing on social media?

This is what will show up when you share this post on Social Media:

How did you do this? I automated my Open Graph images. (Peer behind the curtain at the test page)