Post #421,226
11/9/17 11:20:35 PM
11/9/17 11:25:53 PM
|
Guaranteed Code?
MIT Technology Review: Guaranteed CodeAdam Chlipala, an associate professor of computer science at MIT, thinks there’s a better way to write computer programs.
Most programs just list operations that the computer should perform when it receives particular types of data. The programmer has to write tests to determine whether a program does what it’s supposed to, and since it’s virtually impossible to predict all the ways a program might be used, most software has bugs.
Chlipala prefers so-called functional programming. Instead of stringing together imperative commands, a functional programmer defines a set of functions, or mathematical relationships between inputs and outputs. Essentially, functional programming expresses what a program does as a set of equations. Looking at it superficially, it's a different approach for web development. Anyone use it or look in to it? Link to (PDF) paper describibg it: Ur/Web: A Simple Model for Programming the Web[edit] add link to paper
Alex
"There is a cult of ignorance in the United States, and there has always been. The strain of anti-intellectualism has been a constant thread winding its way through our political and cultural life, nurtured by the false notion that democracy means that "my ignorance is just as good as your knowledge."
-- Isaac Asimov
Edited by a6l6e6x
Nov. 9, 2017, 11:25:53 PM EST
Guaranteed Code?
MIT Technology Review: Guaranteed CodeAdam Chlipala, an associate professor of computer science at MIT, thinks there’s a better way to write computer programs.
Most programs just list operations that the computer should perform when it receives particular types of data. The programmer has to write tests to determine whether a program does what it’s supposed to, and since it’s virtually impossible to predict all the ways a program might be used, most software has bugs.
Chlipala prefers so-called functional programming. Instead of stringing together imperative commands, a functional programmer defines a set of functions, or mathematical relationships between inputs and outputs. Essentially, functional programming expresses what a program does as a set of equations. Looking at it superficially, it's a different approach for web development. Anyone use it or look in to it?
Alex
"There is a cult of ignorance in the United States, and there has always been. The strain of anti-intellectualism has been a constant thread winding its way through our political and cultural life, nurtured by the false notion that democracy means that "my ignorance is just as good as your knowledge."
-- Isaac Asimov
|
Post #421,227
11/10/17 8:33:47 AM
11/10/17 8:33:47 AM
|
I'm dubious.
Functional programming is great for some things. But the reason you can mathematically prove it's correct has to do with the lack of side effects in functions. As soon as you put a SQL database in there you lose that property and it's no longer truly provable functional programming.
He talks about two special features, encapsulation and simple concurrency, as if they're some new mind-blowing thing that most web developers have never heard of. Anyone using a modern web development language like ES2015 or Coffeescript, and a library like React, has access to both of those.
So, interesting experiment, but it doesn't seem worth the trouble of dealing with the limited libraries and servers of a niche tool. The toy example in the paper aside, I doubt there's any meaningful productivity boost unless, like the author, you think mainly in functional modes all day long anyway.
Regards, -scott Welcome to Rivendell, Mr. Anderson.
|
Post #421,231
11/10/17 2:18:52 PM
11/10/17 2:18:52 PM
|
Thanks for your comments, Scott!
I had a feeling it might not be nirvana.
Alex
"There is a cult of ignorance in the United States, and there has always been. The strain of anti-intellectualism has been a constant thread winding its way through our political and cultural life, nurtured by the false notion that democracy means that "my ignorance is just as good as your knowledge."
-- Isaac Asimov
|
Post #421,288
11/14/17 7:23:12 PM
11/14/17 7:23:12 PM
|
Euh...
encapsulation and simple concurrency, as if they're some new mind-blowing thing that most web developers have never heard of You'd be amazed... (not limited to web developers either, although PHP code does seem to contain the most eyewatering atrocities committed against any sane coding practice.)
|
Post #421,235
11/10/17 7:04:39 PM
11/10/17 7:04:39 PM
|
Functional programming has been around since approximately forever.
AFAICS, all he claims is to have taken it to the Web. Sure, OT1H that might be fine and dandy and just about all-round super-duper...
But OTOH, there are reasons functional programming, despite having been around since approximately forever, hasn't yet taken the programming world as a whole by storm.
-- Christian R. Conrad Same old username (as above), but now on iki.fi(Yeah, yeah, it redirects to the same old GMail... But just in case I ever want to change.)
|
Post #421,236
11/10/17 7:07:10 PM
11/10/17 7:07:10 PM
|
Bah, that's what I get for having a post hanging around un-posted for 10 hrs: Beaten by Scott.
|
Post #421,237
11/10/17 7:37:52 PM
11/10/17 7:37:52 PM
|
:-) It was worth hearing your take on it regardless.
Regards, -scott Welcome to Rivendell, Mr. Anderson.
|
Post #421,252
11/12/17 1:32:00 PM
11/12/17 1:32:00 PM
|
OK, then here's some more:
OT1H, that whole "No side effects!" thing sounds like it often could be great. But OTOH, perhaps only when you explicitly want just a single value as a result, calculated from whatever inputs.
So what about all the other times, like in real-world application programs, where you actually want all kinds of shit to happen? Like saving stuff to disk, committing a database transaction, opening or closing one or more on-screen windows, etc. Or especially, several of those at once. "Those aren't 'side effects', they're what this is supposed to do!", kind of thing.
Summa summarum: It all feels a little too theoretical.
-- Christian R. Conrad Same old username (as above), but now on iki.fi(Yeah, yeah, it redirects to the same old GMail... But just in case I ever want to change.)
|