10 ms·
Programming paradigms that change how you think about coding
- bru 12y agoSome notes: - parallel and concurrent are 2 different things - the 'symbolic languages' definition seems off. Wikipedia puts it right: > symbolic programming is computer programming in which the program can manipulate formulas and program components as data So it's not "using graphs & such to program"
- seanmcdirmid 12y agoMathematica is a good example of a symbolic language (can't get more symbolic than term rewriting), but he calls that....knowledge oriented or some other nonsense.
- Orangeair 12y agoMathematica[0] and The Wolfram Language[1] are two different things. The Wolfram Language is a sort of extension of their Wolfram Alpha service, which Wolfram itself describes as "Knowledge Based." Mathematica is still just Mathematica. [0]http://www.wolfram.com/mathematica/ http://www.wolfram.com/mathematica/ [1]https://www.wolfram.com/language/ https://www.wolfram.com/language/
- taliesinb 12y agoNo. Mathematica is a commercial piece of desktop software that uses the Wolfram Language. Just like how RStudio uses R. There are other product platforms (coming soon) that employ the Wolfram Language, both in cloud and desktop incarnations: http://www.wolframcloud.com/ http://www.wolframcloud.com/
- seanmcdirmid 12y agoI'm not great at following markitecture, but didn't Mathematica exist and have a language before this language was rebraded as the Wolfram Language? There is nothing really wrong with this, but its understandable that people might be confused about it right now.
- taliesinb 12y agoThat's right, and what seems to be confusing people is that the language underlying Mathematica-the-product was always, implicitly, "Mathematica". We were a one-product company, and it didn't make sense to distinguish Mathematica-the-product and the language it ran. The last time we'd tried to branch the underlying language off into its own thing was in the early nineties, where a certain intern by the name of Brin was in the middle of refactoring the code before he went off to do other things :). My prediction is that the confusion will pass soon once we have these concrete products actually out in the world. A new generation of people will be using and seeing the language for the first time. And they'll be doing stuff that old-school Mathematica-the-product (and most of its user base) would find quite alien. Things like trying code out in online sandboxes, coding things in the cloud IDE (or locally, via Eclipse or "Wolfram Desktop"), deploying public APIs for other people to use, building websites totally within the language, doing internet-of-things type stuff, embedding chunks of WL code in Java or Python or whatever, writing natural language parsers on top of Alpha's technology, creating data science workflows, making private clouds, designing interactive visualizations, tweeting code at our executor-bot... and on and on...
- vkjv 12y agoIf you want concurrent by default, try an HDL. :)
- noobiemcfoob 12y agoI had the same thought. I find it odd he didn't mention them.
- coldtea 12y ago>parallel and concurrent are 2 different things That should be an implementation detail as far as the programmer is concerned. And languages should strive for parallelism anyway, not merely concurrency.
- tel 12y agoThe idea that parallel code is executed through a concurrency mechanism should be hidden, but it doesn't mean that the distinction between the two should be. http://existentialtype.wordpress.com/2011/03/17/parallelism-is-not-concurrency/ http://existentialtype.wordpress.com/2011/03/17/parallelism-... http://existentialtype.wordpress.com/2014/04/09/parallelism-and-concurrency-revisited/ http://existentialtype.wordpress.com/2014/04/09/parallelism-...
- ExpiredLink 12y ago@see http://www.reddit.com/r/programming/comments/22nhb2/six_programming_paradigms_that_will_change_how/cgor59p http://www.reddit.com/r/programming/comments/22nhb2/six_prog... for some valid critique.
- tokipin 12y agoTake this[1] for example. That's a regular Mathematica notebook. You can insert images (like drag & drop them from your desktop) directly into notebooks. It's actually very convenient for image processing. The same thing holds true for things like the graphical output of plotting functions, which retain their underlying vector data. The symbolic paradigm isn't necessary for this, but it makes it easier. Implementation-wise these things requires less "special case-ing" than you would think because the symbolic paradigm in essence encourages your representations to be naked. Thus images, plots, etc are not "black box" items. They're structured data represented in the same language, but which the frontend happens to display in visual forms. (Code itself is also data, except that if a symbol in the data has an associated transformation rule, that transformation rule is applied. This mechanism is how you make data do 'variables' and 'functions'. These variables and functions work more or less the same as they would in a common programming language, but the underlying mechanism is nothing but data transformations.) [1] http://reference.wolfram.com/mathematica/ref/EdgeDetect.html http://reference.wolfram.com/mathematica/ref/EdgeDetect.html
- brikis98 12y agoThanks for the feedback. I updated the post with notes that mention these corrections.
- simias 12y agoIn the "concurrent by default" section I would add the hardware description languages like VHDL and Verilog. Learning Verilog was an eye opening experience for me. It reminded me of the time I switched from unstructured BASIC to C when I was a kid. At first it seems complex and weird then suddenly it clicks and it all starts making sense.
- adwn 12y ago... and then suddenly you realize what a horrible, horrible language it is. I'm not exaggerating, it isn't even well-suited for the domain it is mainly used for (i.e., designing digital hardware circuits). For example: 1) Synthesis/simulation mismatch: Your design might work in simulation but not in hardware, and vice versa. Often, this is due to X-value (representing unknown/invalid values) problems. 2) Signed datatypes: If you mix signed and unsigned values in an expression, the result is unsigned. So, if a is unsigned and has the value 4, b is signed and has the value -3, then (a * b) < 5 will return 0 (false), while ($signed(a) * b) < 5 will correctly return 1 (true). That's because signed datatypes are just an afterthought and weren't officially introduced until 2001, more than 15 years after the language's inception. 3) If an undeclared net is used in an module instantiation, the compiler silently creates a 1 bit net with that name. No error message, no warning. You can turn off that stupid behavior with a compiler directive, but you have to turn it back on at the end of your file, because otherwise its effects are active in all files compiled afterwards, and many third-party sources don't work correctly with this setting. VHDL is also a bad language, but for very different reasons. And yet, alternative HDLs have a hard time getting traction, for various reasons and non-reasons.
- Igglyboo 12y agoI wholeheartedly agree. I'm a CSE Major and I took a hardware design class last fall, we programmed and Xilinx FPGA using VHDL. It was a huge change from everything I had learned before, I had no idea what a latch was and why it was bad to imply them. The thing that bothered me the most was the simulation/synthesis disconnect, the only efficient way to debug a program is by using the simulator because debugging it on the board takes a very long time when changing code. But even after you've debugged it in the simulation it might not even synthesize, which is an even harder "bug" to debug.
- Blahah 12y agoThe concurrent by default paradigm looks like it could be really useful for some cases. Does anyone know of any more well-used languages that support it?
- maaaats 12y agoIt's a "well-used language" in academic contexts, but probably not exactly an answer to your question ;) Anyways, in OZ[1] you can just add thread <x> end around code x, and it's concurrent. It will wait for all bindings to be resolved before continuing. It's a pretty cool language with a lot of paradigms one can easily try out. [1] http://en.wikipedia.org/wiki/Oz_%28programming_language%29#Dataflow_variables_and_declarative_concurrency http://en.wikipedia.org/wiki/Oz_%28programming_language%29#D...
- simias 12y agoAs I mentioned in my other comment Verilog and VHDL are "concurrent by default" since that's how hardware works anyway. If you want to experiment with them you don't need an FPGA, you can just start with a simulator such as Icarus Verilog[1] and a waveform viewer like gtkwave[2] and get a feel of the language. There are a bunch of tutorials on the net. [1] http://iverilog.icarus.com/ http://iverilog.icarus.com/ [2] http://gtkwave.sourceforge.net/ http://gtkwave.sourceforge.net/
- GotAnyMegadeth 12y agoVerilog is Turing complete and can do standard IO, so you probably don't even need a simulator/wave viewer.
- simias 12y agoYeah, but using waveforms is half the fun! :) Also, debugging verilog using only $display doesn't sound very fun...
- krupan 12y agohttp://www.edaplayground.com/ http://www.edaplayground.com/ is a great way to play with hardware description languages too. You don't need to install anything.
- z3phyr 12y agoSince 'functional' is not mentioned, I will assume that it is mainstream now!
- nly 12y agoOr maybe it just won't 'change the way you think about coding'
- lomnakkus 12y agoI think that depends a lot on what you mean by "functional". If "functional" means "everything is immutable" then I can guarantee that you'll learn a lot by programming that way. If you mean "first-class functions" then I cannot -- although you still might. You could probably program in Scheme (say) as if it were C with side effects all over the place, but that wouldn't teach you anything except a different syntax. OTOH, coding something non-trivial in Haskell would teach you a lot -- even if you don't end up using/liking it. (Aside: I was somewhat disappointed by the blogger calling out the "Wolfram Language" as something special or to be admired. It's a ridiculous ad-hoc hodgepodge of a language. I stress the word language.)
- ChrisGaudreau 12y agoIf you don't know FP and you learn FP, then it will almost certainly change the way you think about coding.
- Dewie 12y agoOne could say that it goes under declarative
- marcosdumay 12y agoAnd concurrent.
- bnegreve 12y agoAccording to Wikipedia, functional programming is an example of declarative programming [1], which is mentioned in the article. This is not immediately obvious to me, here's why (from the same wikipedia article [1]): While functional languages typically do appear to specify "how", a compiler for a purely functional programming language is free to extensively rewrite the operational behavior of a function, so long as the same result is returned for the same inputs. This can be used to, for example, make a function compute its result in parallel, or to perform substantial optimizations (such as deforestation) that a compiler may not be able to safely apply to a language with side effects. [1] http://en.wikipedia.org/wiki/Declarative_programming http://en.wikipedia.org/wiki/Declarative_programming
- snorkel 12y ago10 Ways Buzzfeed-style Headlines Will Forever Be Annoying
- cshimmin 12y agoHonestly, my facebook feed has trained me to simply never click on any article that begins with a number.
- jameshart 12y agoThis is a substantial piece of writing with information many here would find interesting; putting it behind a buzzfeed list style headline does it a disservice. One step short of calling it "Six weird programming paradigms that will blow your mind".
- andrelaszlo 12y agoChanging paradigms has to change the way you think about things, by definition. By the scientific definition of "paradigm", at least, but I think it's no less true for programming paradigms.
- chriswarbo 12y agoI think the idea is that we usually don't change paradigms. However, by broadening our perspective we can gain insights into our existing code. An example of a paradigm that won't change the way you think about code is a cyclic tag system. You might find it interesting to know about, but I doubt that knowledge would change the way you write code. As a concrete example, learning pure functional programming gives me another perspective on the OO code I write; ie. that methods are functions where the first argument is the implicit "this" and the body of the function contains a top-level pattern-match on the class tag. This perspective has helped me avoid over-complicating my code at times.
- nly 12y agoI thought it was a tiny but deliberate master-stroke of tongue-in-cheek irony. Or maybe the author was really after that buzzfeed crowd ;) I any case, I bet I wasn't the only one who thought "well, HN is going downhill fast" first, and came out glad my prejudices were tested.
- weland 12y agoIt also includes quite some information that isn't exactly right.
- notduncansmith 12y agoMy first thought was "How this 36-year-old mom learned to code with one neat trick!"
- cowls 12y agoI read it, and how I think about coding remains the same as before I read it.
- mcherm 12y agoI don't think the idea was that reading the article would change how you thought about coding. I believe the point was that trying out these unusual programming paradigms would change how you thought. For the cases on his list that I have tried (declarative programming and Forth/Joy) I have found that to be true. I would add object oriented programming (eg: smalltalk), macro programming (eg: lisp) and functional programming (eg: Haskell) to the list of things that change your thinking, but since most of the article's prospective audience has already heard of those I was happy that he stuck with paradigms that are LESS well known.
- lolo_ 12y agoI think an underrated non-standard approach to programming is graphical programming. Though this approach doesn't seem to received significant uptake amongst professional programmers, there is an application called max [0] that is popular amongst musicians and artists and quite surprisingly powerful and effective. There's an interesting article [1] on how Jonny Greenwood of Radiohead uses it extensively, in there you can see some examples of how it works - modules wired together visually. I think there is a lot of potential for a really nice mix between text-based programming and graphical programming to work for general programming too. [0]:http://cycling74.com/products/max/ http://cycling74.com/products/max/ [1]:http://thekingofgear.com/post/25443456600/max-msp http://thekingofgear.com/post/25443456600/max-msp
- prawks 12y agoThe digital media department at my alma mater used Max/MSP to teach programming to art students with a lot of success. It's really fascinating to watch the programs as they run, and it makes for a great way to visualize abstraction and separation of concerns in a concrete way.
- adambard 12y agoMy degree included a "Computer Music" option, which were a few classes that were half music students and half computer science ones. We used Max/MSP quite a bit. For anyone that wants to play around with a very similar language, PureData is an open-source application that is a relative of Max/MSP (they share a creator, and are quite similar). Not wanting to come in to do the homework or purchase the software myself, I used it quite a bit. http://puredata.info/ http://puredata.info/
- humanrebar 12y agoI've used graphical programming in the past. It sounds amazing in abstract, but ends up being a mess when it is implemented. It basically requires a "sufficiently smart editor", which, even if implemented perfectly, would not leave a lot of room for a third-party ecosystem to be built around the language. There are many solved problems in text-based programming that would need to be resolved in order for a graphical programming language to be as useful. How would one post a "snippet" to StackOverflow? How would diffs work? Consequently, how would source code management work?
- JupiterMoon 12y agoIsn't "Dependent types" just re-inventing how Fortran handles non allocatable array and character variables i.e. those who's length is declared at compile time using a parameter?
- octo_t 12y agoThat's just one use of dependent types (and the easiest one for an audience to understand).
- JupiterMoon 12y agoBut it is the only one described in the article.
- patrickmay 12y agoCommon Lisp also supports specialized type declarations like this. (In Common Lisp type declarations are optional.)
- nbouscal 12y agoCommon Lisp does not have dependent types. The example given is unfortunate because it often leads people to think they already have (and understand) dependent types, when that isn't the case.
- nbouscal 12y agoThe article unfortunately does quite a poor job of explaining what dependent types are and why they're valuable. They're a lot more complicated than just "storing the length of a vector in its type". Dependent types allow you to create types where one type in a signature 'depends' on the value of another type in the same signature. This is very powerful, but unfortunately easily understandable examples are still somewhat hard to come by.
- tel 12y agoIt's a bit more than that. Let's assume Vector is a typed list type of know length [1,2,3] : Vector 3 Int we can write `append` which combines Vectors append : (Vector n a, Vector m a) -> Vector (n + m) a which works as you expect because the expression in the type (n+m) is written in the value language. Here's another (slightly pathological) dependent type. Normally `if` statements require that the then and the else branches result in the same type, but in a DT language you can write if' : (cond : Bool) -> a -> b -> (if cond then a else b) In other words, `if'` takes the type where you first provide it a boolean, we'll call it `cond`, and then two differently type continuation parameters. The type of the result is an expression: "if cond is true then this is the type of the first continuation, otherwise this is the type of the second continuation". Both of these examples would be proud to call themselves trivial. The DT rabbit hole goes very deep.
- mjb 12y agoOther languages to add to this list would be Dijkstra's Guarded Command Language, and Promela. Promela is especially interesting because of the (nondeterministic) execution semantics, which provide an extremely interesting way to model parallelism. In a similar vein, TLA+ is worth a look. Both Promela (Spin) and TLA+ have active communities and have found fairly wide use in industry. They are generally used for model checking, model extraction by guided abstraction, and development by refinement, but can be used in a much more adhoc way to just experiment with parallel ideas.
- SeanLuke 12y ago> If you've used SQL, you've done a form of declarative programming This is so wrong I don't know where to begin.
- dllthomas 12y agoPer Wikipeda, "Common declarative languages include those of database query languages (e.g., SQL, XQuery), regular expressions, logic programming, functional programming, and configuration management systems." http://en.wikipedia.org/wiki/Declarative_programming http://en.wikipedia.org/wiki/Declarative_programming "Wikipedia is mistaken" is totally a defensible position, but it should be defended, so please find a place to begin.
- SeanLuke 12y agoWikipedia is mistaken. To me, in a declarative programming language you tell the computer what you want without exactly telling it how to achieve it. It's the compiler's job to figure that out. That classic example of a declarative programming language is Prolog. In databases there are two traditional approaches to extracting queries: the relational algebra and the relational calculus. One of these (the relational calculus) is very clearly declarative: you essentially are saying "give me all students whose ID numbers are less than 1000 and who took a class from someone who is no longer a member of the faculty." The interpreter figures how what relational operations should be performed to do this. The other option is the relational algebra, which to me is very obviously not declarative: you are telling the system exactly what to do, and giving it an implicit ordering (though just like in any procedural language it can change the ordering if it thinks it's a good idea). Thus in the relational algebra you'd say "get the table of students. Reduce it to those whose ID numbers are less than 1000. Join it with those students who took a class. Take the list of faculty. Reduce it to those who are longer teaching. Join that with the previously generated students relation. Project out just the student names." The primary language for the declarative relational calculus is Datalog. The primary language for the (non-declarative) relational algebra is SQL. Though SQL has a few extra gizmos added to compensate for the fact that it's less expressive than the relational calculus.
- milliams 12y agoQML [1] is an interesting example of declarative programming. It allows constraints and relationships to be defined and the runtime will do the rest. Perhaps it's not as powerful as other languages but in its domain it does very well. [1] https://en.wikipedia.org/wiki/Qt_Modeling_Language https://en.wikipedia.org/wiki/Qt_Modeling_Language
- general_failure 12y agoQML is simply brilliant for developing UIs.
- sirsar 12y agoLabVIEW is concurrent by default; control flow is done by linking the outputs of one function to the inputs of another. This makes writing concurrent loops ridiculously easy: just put two loops next to each other. I rarely use it because organization is such a pain, but its "data-flow" paradigm does simplify a lot of logic.
- sesm 12y agoAnother example would be Bloom language. Here is a great talk explaining motivation for using "disorderly" languages in distributed systems: http://vimeo.com/53904989 http://vimeo.com/53904989
- bane 12y agoYeah there's a pretty large class of data processing tasks that are made pretty trivial by LabVIEW-likes visual dataflow languages. One I've seen for XML work that was pretty good was called "SDE" http://www.futurepointsystems.com/?page=products http://www.futurepointsystems.com/?page=products
- cdtwoaway 12y agoHappy to see another LV user here. Organization gets much, much easier once you get the big architecture concepts - produce/consumer patterns, messenger-queues, event structures, actor framework. Yes, it can be painful, but the newer functionalities (clean-up, riddiculously easy sub-vi creation,..) subtly improve it. Btw: If you are using LabVIEW and have never used Quickdrop, try it. It is the most underutilized and amazing feature.
- untothebreach 12y agoI was a little disappointed that Factor[1] didn't get a mention in the 'Concatenative' section. Its stack effect checker takes care of a lot of the problems he mentions, IMO. 1: factorcode.org
- protomyth 12y agoPostscript is another excellent example of the type.
- evincarofautumn 12y ago“Stack checking” is definitely the ticket to maintainable stack programs. I have been working on a statically typed concatenative language called Kitten[1] off and on for a while, and while the error messages leave something to be desired, they can at least help you understand how data is flowing through a program, and of course rule out some bugs. [1]: http://github.com/evincarofautumn/kitten http://github.com/evincarofautumn/kitten
- untothebreach 12y agovery cool, I will definitely take a look at this
- kitd 12y agoPointed out elsewhere, but ANI appears to be dead according to its own tutorial[1]. However Funnel[2] by Martin Odersky/EPFL does a similar job, with a more explicit nod to Petri nets which are usually used as the basis for concurrent systems. [1] https://code.google.com/p/anic/wiki/Tutorial https://code.google.com/p/anic/wiki/Tutorial [2] http://lampwww.epfl.ch/funnel/ http://lampwww.epfl.ch/funnel/
- danielweber 12y agoI'm in the midst of something else and can't pull out my C++11 book now, but doesn't C++ have custom types that would let you declare something like "this must be a positive integer"? I might be confusing this with custom literals.
- AnimalMuppet 12y agoWell, there's unsigned integers. This means that it can't be less than 0. But if you have a 32 bit unsigned integer, and you decrement 0, you get 0xFFFFFFFF. That may or may not be what you want or expect. You also could create a class that wrapped an integer, that would have a range, and would maintain that range as a class invariant. It could either clip or throw an exception when an attempt was made to go out of the range. But that's just regular class stuff, so I don't think it's what you had in mind...
- jarrett 12y agoA thought on dependent types: Can a dependent type system catch all type errors at compile time? For example, suppose I write the following (in pseudo-code): // Variable x is an integer greater than or equal to 0 and less than 256. int x (>=0, <256) x = 128 // This is valid. x = x * 3 // This violates the type. I can imagine how a compiler could catch that kind of error. But that's trivial. What happens in programs like this: int x (>= 0, <=10) x = parseInt(getKeyboardInput) Now the compiler can't know for sure whether the type has been violated, because the value of getKeyboardInput could be anything. To take a page from Haskell, you could do something like this (which is still pseudocode, not valid Haskell): // x is a value that is either 1) an int from 0 to 10, or 2) nothing at all. maybe (int (>= 0, <=10) x // applyConstraint recognizes that parseInt may return a value violating x's contraints. // Thus it transforms the return type of parseInt from int to maybe (int (>= 0, <=10) x = applyConstraint(parseInt(getKeyboardInput)) Or perhaps applyConstraint wouldn't have to be called explicitly, but would be implicitly added by the compiler as needed. I'm not sure which is better stylistically. Either way, applyConstraint would be required any time a computation could return an invalid value. That would get tricky, because the compiler would have to track the constraints on every variable, even where those constraints aren't declared. For example: int w (>= 0, <= 10) int x (>= 0, <= 2) int y int z (>= 0, <= 20) y = w * x z = y Here, the compiler would have to infer from the assignment "y = w * x" that y is always between 0 and 20. Do any languages currently take the idea this far (or farther)?
- nuncanada 12y agoYes, Depently Typed languages can. They are full blown theorem provers...
- JadeNB 12y agoGödel guarantees that full-blown theorem provers, even with human guidance, cannot prove all true statements about sufficiently rich systems. 'Sufficiently rich' here just means 'includes Peano arithmetic', and you can find tons of tutorials for doing just that (Church encoding) in even the simplest type systems. (This bit of pure-mathematics wonkery ignores the substance of jarrett's question, though; one doesn't need the full Gödelian power to observe that a priori theorems that must be verified at compile time can never account for data that are provided only after compilation.)
- prezjordan 12y agoI wish APL/J/K were on here, but I guess that doesn't really change the way I think about coding... it just blows my mind.
- protomyth 12y agoI've been thinking a lot about agent-oriented programming. I had a General Magic device back in the day and later thought the concept of a Telescript like language as applied more for code organization than code mobility might be interesting. I guess APIs won, but I still think there is something there.
- abecedarius 12y agohttp://erights.org/ http://erights.org/ was not technically like Telescript, but aimed at a similar-enough vision you might find it interesting. http://erights.org/elib/capability/ode/index.html http://erights.org/elib/capability/ode/index.html for that vision. The section on mobile almost-code at http://erights.org/elib/distrib/pipeline.html http://erights.org/elib/distrib/pipeline.html should help to relate it to Telescript.
- hexagonc 12y agoMy first and only encounter with "Concatenative Languages" was programming the HP48GX[1] graphing calculator in highschool. Thinking back to it, I'm amazed by what you could do with it. It was very powerful even by today's standards. Whereas other kids had Gameboys, I had an "HP". I even got in trouble playing tetris on it during my German language class. My calculus teacher never knew that you could do symbolic integrals and derivatives with it (using a free computer algebra library). Sadly, the only program of note that I wrote for it was an implementation of the The Game of Life[2]. [1] http://en.wikipedia.org/wiki/HP-48_series http://en.wikipedia.org/wiki/HP-48_series [2] http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life
- sergiosgc 12y agoWhere is Aspect Oriented Programming and all the other offspring of the Inversion of Control pattern (Dependency Injection, Dependency Inversion, ...)? Is this line of evolution in languages considered dead?
- ExpiredLink 12y agoYes, thank heavens, yes!
- NathanOsullivan 12y agoCame here to say the same thing. Learning about Inversion of Control utterly changed how I program on a day-to-day basis. It may not be a language feature, but the things in the article seem rather academic by comparison.
- saosebastiao 12y agoI'm a huge fan of the declarative programming paradigm, but outside of Regexp and SQL and a handful of other DSLs, it's dead. Its death should be a case study in Open Source strategy: It died because it became boring before it became useful. SQL and Regexp have stuck around because they did something useful immediately. I think that any future that the Declarative paradigm has within general purpose languages is the kind applied by compilers. For example, x = (a + b) - a can be reduced to x = a or even eliminated altogether with subsequent in-scope references to x being replaced with a. Another example is dead code elimination. These forms of declarative let you use an imperative or functional language immediately but gently introduce you to declarative benefits without having to deal with all the mind bending that is necessary to optimize pure declarative code.
- segmondy 12y agoYou are very mistaken. Prolog is still very much alive. You can find us on ##prolog in freenode. You can build a web application with prolog. When the 2048 madness was going on, I implemented in prolog in about 200 lines in 2 hours and I had about 3 weeks of prolog under my belt at that time. It's a very powerful concept. I didn't have to figure out the how to implement it, I just broke 2048 down into rules, declared it, and bam, I had a game.
- singold 12y agoHow/where do you recommend to learn prolog? The concept looks really interesting and useful, at least for me.
- mindcrime 12y agoThere are a lot of good Prolog resources on the web. I gathered up a little list some time ago. You can find it here: http://fogbeam.blogspot.com/2013/05/prolog-im-going-to-learn-prolog.html http://fogbeam.blogspot.com/2013/05/prolog-im-going-to-learn...
- saosebastiao 12y agoI never said it wasnt useful, I said that it was dead...much in the same sense as COBOL. I use datalog and constraint programming extensively, but I'm a black sheep.
- josephschmoe 12y agoDependent types are a wonderful idea so long as I can do a couple things with them: 1. Copy paste them without complications. i.e. "non-null" requires no code that relies on specific variables unless there's a logical conflict (which variable?) 2. If it's a known failure, give me a warning. If it's an unknown failure, let me choose how to deal with it, again in a neutral fashion that I could simply say @Notnull<skip> and it would just skip the code if the variable is null.
- keenerd 12y agoDeclarative programming is a great one, almost a magical experience. "It feels like I am sitting at the controls of a quantum computer. I've got all my qubits (terms) all wired together in some complicated expression and when power is applied every qubit will instantly collapse out of superposition and crystallize into a perfect answer." (From something I've been working on, http://kmkeen.com/sat/ http://kmkeen.com/sat/ )
- josephschmoe 12y agoWould be pretty cool to have concurrency by default and then a lock declaration I could do on a particular function to fix any concurrency issues. Would need a new style of debugger/code view though specifically for this purpose.
- josephschmoe 12y agoCode Search is a better way to do Declarative Programming for non-optimized solutions. I've been obsessing over this topic for the last few months. Right now there's limited versions in a few places: Python's howdoi and Visual Studio's Code Search. A true Code Search would work like this: 1. Type in your search term in your code in a comment line. i.e. "Bubble sort StampArray by name" 2. Google/Bing/StackOverflow searches for your string. Replaces your terms with generics. Searches for "Bubble sort [an array of objects] by [string variable]" 3. Takes code results and shows them to you. Replaces all instances of [string variable] with getName() and all instances of [Object[]] with StampArray. 4. You pick your favorite. 5. Your IDE adds the code to a "code search module" which you can edit. 6. Your edits get added to the search database. The best part? You could even put your Declarative Programming engine -inside- of the Search just by populating initial search results. What about better code coming to exist in the future, you say? Well, you don't necessarily have to keep the same result forever. If it's been deprecated, you can re-do the search.
- AlexanderDhoore 12y agoThe aurora language seems very interesting. Too bad there is already another language called Aurora... I makes me think of Elm [1] and (functional) reactive programming. Reactive programming is fantastic. It's kind of like how a spreadsheet program works. If a variable changes, all variables who depend on it change as well. Given "a = b + c", if c increments by 1, so does a. It has many advantages over event based systems, like Javascript. Reactive programs don't need callbacks. The changing values propagate the "event" through the system. I'd love to hear what you guys think about this direction of programming. It seems very natural to me. Edit: I also see reactive programming as the golden way of having changing state in functional languages. Functional languages have no problem with data or state. They have a problem with change of state. The reactive paradigm solves that problem. All change is implicit and code can be exactly as functional as before. [1] http://elm-lang.org/ http://elm-lang.org/ [2] http://en.wikipedia.org/wiki/Reactive_programming http://en.wikipedia.org/wiki/Reactive_programming
- ibdknox 12y agowe're actually in the process of changing the name :) EDIT: re FRP, you might find this Lambda The Ultimate post insightful: http://lambda-the-ultimate.org/node/4900 http://lambda-the-ultimate.org/node/4900 FRP has issues with openness and isn't real great at dealing with collections. It also forces you to express things kind of unnaturally (e.g. instead of "click this and increment x", you say "the counter is the count of all click events"). There are other methods of managing time, like Glitch[1] and Bloom[2] that seem more promising :) [1]: http://lambda-the-ultimate.org/node/4910 http://lambda-the-ultimate.org/node/4910 [2]: http://boom.cs.berkeley.edu/ http://boom.cs.berkeley.edu/
- deleted 12y ago[deleted]
- AlexanderDhoore 12y agoWell, I'm not a fan of the "use folds over time" concept either. FRP is too complex, but there's some great ideas there. Would you say Aurora and these other languages are "reactive"? Or do you have a better term for it? BTW: I'm reading "Toward a better programming" right now :)
- joshlegs 12y ago.... did .... did you crosspost this from reddit ??? http://www.reddit.com/r/programming/comments/22nhb2/six_programming_paradigms_that_will_change_how/ http://www.reddit.com/r/programming/comments/22nhb2/six_prog...
- aufreak3 12y agoWould be good to add Mozart/Oz. Dealing with process coordination using the resolution of logical variables gave me a refreshing new perspective. The finite domain constraint system design in Oz is an awesome example of this in action. An interesting tidbit - the Mozart/Oz team invented "pickling" before it caught on with Python.
- kazagistar 12y agoIf a programming paradigm does not change how you think about coding, it isn't a programming paradigm. Good article though.