Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

We don't program Turing Machines, just like we don't program in machine code any more. Languages are a means of expressing what we think in terms a computer can understand. If we can't express ourselves, we can't tell the computer what to do. Put another way:

Programming languages teach you not to want what they cannot provide. You have to think in a language to write programs in it, and it's hard to want something you can't describe.
Paul Graham, ANSI Common Lisp, Prentice Hall, 1996, p2.

Perl is an ugly language, because it has evolved over the past two decades driven by real customer requirements. That's a good thing. Languages like Lisp, Prolog, and Haskell are beautiful, but I would guess that more function has been delivered in Perl than in the other three combined. Perl is available, and availability matters more than beauty to most people.

print "Hello, world!\n";

This code is available to just about any programmer. The \n is a term from a well-known mini-language. print is a well-known verb. "Hello, world!" is a well-known example. We understand the above, because it is familiar to our context.

main: mov dx,str mov ah,9 int 021 ret str: db "Hello World!$"

You probably understand this, because you recognize it is a canonical example. And, I already established the context with the first example. However, unless you are an old DOS hacker, you probably don't know what 021 is. It's the name of an API, and ah and dx hold its parameters. Just like, [] is an API as in ("Hello, World!")[0], and ("Hello, World!") and 0 are its parameters. If you don't know Perl, it might be hard to see that, especially if it looked like: (0)[0]. What does that smiley mean?

You probably understand this sentence:

http://www.bivio.com/goto?x=http://yahoo.com

However, do you understand this one?

http://www.bivio.com/my-club-site/mail/post?fc=aMTc_!cZmlzY3Vz

There are many mini-languages in the above sentence, but all arose out of necessity. ASCII provides a common character set, and won out over EBCDIC, for random reasons. http:// was needed to allow the browser to switch between multiple protocols. www.bivio.com arose, because the Internet needed a distributed naming system when the hosts file got too large to be shipped around every night. my-club-site arose, because our support team needed to give people generic URLs to their private clubs. /mail/post is just a name for a message, that's readable and short. It allows our programmers to read the server logs easily. fc= evolved, because HTML is stateless. The stuff after the fc= tells the interpreter where the particular browser window should return to after you post the message or cancel without storing anything on the server.

The above mini-languages are simple, declarative, and satisfy a basic rule: keep it simple. They aren't beautiful.

Mini-languages which diverge from the KISS principle are an excellent distraction from what you are being paid to do. That's when the mini-language takes on a life of its own, and ceases to be a tool to solve a problem, but a problem in itself. This can be excellent for job security. However, you are programming ineffectively, and you want to be a good programmer. Someone has already generalized and abstracted most programming constructs for you. If you ignore that fact, you are working for yourself, and cheating your customer.

An excellent example of this is the syntax for formatting this reply. HTML was an excellent generalization. However, the special syntax for links is not HTML (although you can use HTML). While it is totally cool that you can make a link with square brackets, it's pretty odd all the same. It's not POD, it's not HTML, and it conflicts one of the most common syntactic elements in the subject matter of this site. You'd have to look at the source of this text to know that [ is the way to get a [ in your posts. And, I didn't have a ready example, and it took quite a bit of searching to figure out why my square brackets weren't showing up. This may be funny in this context. It isn't funny if it is Friday night, and you have to debug somebody else's undocumented, mini-language before you can check-in and go home.


In reply to Re^2: the disadvantages of mini-languages by robnagler
in thread the disadvantages of mini-languages by metaperl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others making s'mores by the fire in the courtyard of the Monastery: (4)
    As of 2019-10-20 21:15 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      Notices?