4 ms·
It's not dogma anymore. It may have been dogma at the time of COBOL, but now we know plain-English programming general purpose programming languages are a bad i
by jerf 13y ago
It's not dogma anymore. It may have been dogma at the time of COBOL, but now we know plain-English programming general purpose programming languages are a bad idea, because we've tried any number of times, and in general if you don't produce an atrocity, you're doing well above average. You end up with a language that is still every bit as complex as a normal programming language, and you add the ambiguity of English to the problem. Instead of it being a win, you lose, badly.
You can do better if you rigidly constrain your DSL's domain, but I'd argue that in many cases you're still looking at "spending" some design juice on a "plain English" interface and it's not at all clear that you've produced something that is improved by the "plain English" so much as produced something that had enough design budget left to absorb the penalty without being destroyed.
It's 2013 now, not 1970. Any time you're tempted to go "My goodness, programming would just be so easy if we did X", go out and look. Odds approach 100% that we've done X, many, many times, and the reason you've never heard about it is that it didn't work well enough to be talked about. See also "fully visual programming language" and any number of "business logic" initiatives over the years.
(To which the typical next cognitive reaction is to believe that it would work if we just poured more effort into it. That may be true, but it's worth pointing out you're entering into unprovable territory. And in many cases, part of the idea really is that X is just so obvious and great that even a partial implementation ought to show its promise immediately.)
- zeckalpha 13y agoI think you need to watch Bret Victor's talk at DBX. http://vimeo.com/71278954 http://vimeo.com/71278954
- jessedhillon 13y agoYeah everyone's seen that talk. Any technology can look cool for 5 minutes. He really neglects to observe that all of the ideas he presented were thoroughly explored during their time -- and repeatedly in the decades since. The conclusion continues to be that such systems are inferior to our current ways. That may be because nobody has pushed hard enough, but it's not because those systems, as implemented, were good enough if only someone would just pay attention.
- meowface 13y agoWell, it was the first real programming language. I can picture people thinking "since machine code is so ugly for humans to read and write, let's come up with something that any human can read or write with extreme ease." They weren't even thinking about "elegance" or "beauty" of code; I'd be surprised if those concepts existed that early on. We later realized it was a bad idea once we actually had some decent alternatives. But at the time I'm sure people were overjoyed that they could write in plain, clear English instead of digits or assembly.
- ams6110 13y agoCOBOL, originally, probably wasn't thought of as a general purpose language. It was more of a business DSL (hence its name). It was about easily processing business data in standard formats, reading and writing files, and producing reports. And for those things, it's actually pretty good. Where it became a "bad idea" was when it was pressed into service beyond that scope.
- zackmorris 13y agoI see what you are getting at that basing a programming language on one dialect like english is a bad idea. But what I disagree with is that pure mathematics is more useful than other ways of thinking. Anymore, I find that having to adapt myself to whatever methodology a language imposes on me is generally more work than the problem I'm trying to solve. Take for example the current hubbub over promises to try to reduce callback hell in javascript. What I find almost amusing is that callback hell shouldn't exist in the first place. It was solved trivially thirty years ago with cooperative threads on pre-NeXT Mac OS. It's obvious in hindsight that cooperative threads were a mistake for kernels, but they turn out to work quite well for processes (the people who wrote Go realized this and did one better, adapting some of the functional concepts from Erlang into a cooperative-thread style that can run concurrently because there's little or no shared data). You rarely have to deal with mutexes or atomic operations (except in cases where one of your operations spans a yield). IMHO they left yield out of javascript in browsers originally for political reasons, because it was already handled by the runtime. Adding it back in is a reluctant admittance that it's become a necessity in today's complex GUIs. Anywhere I look today, I see these problems revisited that were really solved in better ways years ago. A great example of dogma today is templates in c++. Such an astonishing amount of boilerplate to do things that are so easy in other languages, or with more fine grain control of macros. And a lot of the verbosity goes away when you allow variables to infer their type from the return value of a function. Statically typed variables are even a form of dogma. What matters is the underlying piece of data, not the name of the variables that refer to it. We should be dealing with things as a large graph where the data is hashed or referenced somehow if we need a name for it. Honestly most of the code I write now doesn't even have variables. I only use them when I have to work around a limitation of the language (for a long time php wouldn't let you use the array access [] operator after on function result) or when a piece of code is too large to fit on a line. Variables themselves don't actually exist, they are an abstraction. If C had a way to make a const type and initialize it later, we could emulate many of the advantages of functional programming by using the variable name to refer to the result of a block of code. Another example are the blocks in objective-c, which are just nested anonymous functions or lambdas. These should have been part of the c standard from the very beginning, but with nicer syntax (like javascript). I think they were left out for political reasons, because someone early on recognized that they would lead to callback hell! How messed up is that? I could go on almost forever on this stuff. Lisp gets around most of these problems easily, but to me it's the mathematical equivalent of machine code. Haskell and Scala try to make it more readable but fail due to their obsession with brief notation. Conceptually none of this stuff is all that complicated. I remember the first time I saw someone using Excel and when it hit me what they were actually doing, it shook my world so fundamentally that for a moment I thought that everything I learned in computer science had been a waste of time. That feeling never quite left me. If I had a hope for computer science today, it's that we would take the sheer simplicity of functional programming (graph-style like Excel) and build layers above it that extend a programmer's leverage. Here are a few examples off the top of my head: * Dealing with everything as an array to provide inherent parallelism in Matlab * Making concurrent programming look single-threaded by using select in Go * SQL queries to retrieve data by its relationship, not its address * Triggering actions to run when something changes like Prolog * Dealing with atomic messages instead of streams like in Go * Memory-mapped IO instead of loading files into memory * Using pure sockets/file descriptors and pipes instead of proprietary APIs to access data (also pipes are just double-ended file descriptors if we could truncate from the front, and shouldn't exist as a separate concept) * Tying objects to their representation, for example changing the visible attribute in javascript and seeing the element appear instead of calling a setVisible() function (in a fundamental way to ease the burden on programmers, not just syntactic sugar) * Lazy evaluation/referential transparency (treating code like data and vice versa) * Nested languages like Terra instead of writing glue (calling c from lua the way we used to call asm from c) * Universal JIT compilers so we can quit arguing about one language being faster than another and focus on abstract concepts * Integrating genetic programming into languages so we can express a function by its desired input and output instead of having to write every line of code by hand * Losing the concept of a file altogether and focus on state like CouchDB * Make all of this readable by treating the language as a view of the code (for example switching to tabs showing other views like prefix/infix/postfix or human readable like Hypertalk) * Begin thinking of code as pruning a tree instead of manually solving the problem (let the computer explore every permutation of the problem space and return the results for review like solving equations in Mathematica x = yz -> y = x/z -> z = x/y) * Standardize the way libraries communicate (Python should be able to talk to Wolfram Alpha and feed the results into a shell script then save each line in a SQL database with full unicode support) * Get rid of drivers and adapt something like HTML for all devices so that they can be queried, controlled and listened to This got way too long so I will stop there. It needs to be rewritten but I don't have time..
- ehsanu1 13y agoI've been looking into natural language programming, and I recognize some things along those lines have been done. Most of them don't go the length though as far as I know, and have not applied real natural language processing (which we're only getting slightly good at in recent years) to try to semantically understand the English in order to compile it to real code. The only such system I know if is Inform 7 [0][1], which is not really general purpose (though it seems to be quite flexible). There's also livecode [2], which is general purpose, but they did not seem to do any semantic parsing beyond some built-in fixed grammar rules and the language is not exactly "natural" (correct me if I'm wrong, I haven't tried it yet). I also know of a few projects that manage to do this well for constrained domains. For instance, these guys [3] were able to take input parser specifications written in English and automatically create the input parser from its specification. But constraining the domain is what makes this work, and is not the way towards general purpose natural language programming. Would you be so kind as to enumerate some of the work done for plain-English general purpose programming? I've gone out and looked myself, but I have not found all that much. [0] http://www.spagmag.org/archives/backissues/SPAG44 http://www.spagmag.org/archives/backissues/SPAG44 [1] http://inform7.com/learn/papers/ http://inform7.com/learn/papers/ [2] http://www.kickstarter.com/projects/1755283828/open-source-edition-of-livecode http://www.kickstarter.com/projects/1755283828/open-source-e... [3] http://web.mit.edu/newsoffice/2013/writing-programs-using-ordinary-language-0711.html http://web.mit.edu/newsoffice/2013/writing-programs-using-or...