TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Programming paradigms that change how you think about coding

523 pointsby nielsabout 11 years ago

30 comments

AlexanderDhooreabout 11 years ago
The aurora language seems very interesting. Too bad there is already another language called Aurora...<p>I makes me think of Elm [1] and (functional) reactive programming. Reactive programming is fantastic. It&#x27;s kind of like how a spreadsheet program works. If a variable changes, all variables who depend on it change as well. Given &quot;a = b + c&quot;, if c increments by 1, so does a.<p>It has many advantages over event based systems, like Javascript. Reactive programs don&#x27;t need callbacks. The changing values propagate the &quot;event&quot; through the system.<p>I&#x27;d love to hear what you guys think about this direction of programming. It seems very natural to me.<p>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.<p>[1] <a href="http://elm-lang.org/" rel="nofollow">http:&#x2F;&#x2F;elm-lang.org&#x2F;</a><p>[2] <a href="http://en.wikipedia.org/wiki/Reactive_programming" rel="nofollow">http:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Reactive_programming</a>
评论 #7568958 未加载
jameshartabout 11 years ago
This 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 &quot;Six weird programming paradigms that will blow your mind&quot;.
评论 #7565456 未加载
评论 #7566784 未加载
评论 #7565800 未加载
评论 #7565914 未加载
评论 #7568040 未加载
评论 #7565760 未加载
评论 #7565531 未加载
simiasabout 11 years ago
In the &quot;concurrent by default&quot; section I would add the hardware description languages like VHDL and Verilog.<p>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.
评论 #7565711 未加载
评论 #7567092 未加载
jarrettabout 11 years ago
A thought on dependent types:<p>Can a dependent type system catch <i>all</i> type errors at compile time? For example, suppose I write the following (in pseudo-code):<p><pre><code> &#x2F;&#x2F; Variable x is an integer greater than or equal to 0 and less than 256. int x (&gt;=0, &lt;256) x = 128 &#x2F;&#x2F; This is valid. x = x * 3 &#x2F;&#x2F; This violates the type. </code></pre> I can imagine how a compiler could catch that kind of error. But that&#x27;s trivial. What happens in programs like this:<p><pre><code> int x (&gt;= 0, &lt;=10) x = parseInt(getKeyboardInput) </code></pre> Now the compiler can&#x27;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):<p><pre><code> &#x2F;&#x2F; x is a value that is either 1) an int from 0 to 10, or 2) nothing at all. maybe (int (&gt;= 0, &lt;=10) x &#x2F;&#x2F; applyConstraint recognizes that parseInt may return a value violating x&#x27;s contraints. &#x2F;&#x2F; Thus it transforms the return type of parseInt from int to maybe (int (&gt;= 0, &lt;=10) x = applyConstraint(parseInt(getKeyboardInput)) </code></pre> Or perhaps applyConstraint wouldn&#x27;t have to be called explicitly, but would be implicitly added by the compiler as needed. I&#x27;m not sure which is better stylistically.<p>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&#x27;t declared. For example:<p><pre><code> int w (&gt;= 0, &lt;= 10) int x (&gt;= 0, &lt;= 2) int y int z (&gt;= 0, &lt;= 20) y = w * x z = y </code></pre> Here, the compiler would have to infer from the assignment &quot;y = w * x&quot; that y is always between 0 and 20.<p>Do any languages currently take the idea this far (or farther)?
评论 #7567161 未加载
评论 #7567224 未加载
评论 #7568236 未加载
评论 #7567375 未加载
评论 #7569845 未加载
评论 #7567493 未加载
评论 #7567763 未加载
评论 #7567310 未加载
评论 #7570561 未加载
评论 #7567167 未加载
评论 #7567153 未加载
评论 #7567635 未加载
评论 #7567373 未加载
lolo_about 11 years ago
I think an underrated non-standard approach to programming is graphical programming. Though this approach doesn&#x27;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.<p>There&#x27;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.<p>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.<p>[0]:<a href="http://cycling74.com/products/max/" rel="nofollow">http:&#x2F;&#x2F;cycling74.com&#x2F;products&#x2F;max&#x2F;</a> [1]:<a href="http://thekingofgear.com/post/25443456600/max-msp" rel="nofollow">http:&#x2F;&#x2F;thekingofgear.com&#x2F;post&#x2F;25443456600&#x2F;max-msp</a>
评论 #7570260 未加载
评论 #7565791 未加载
评论 #7585101 未加载
bruabout 11 years ago
Some notes:<p>- parallel and concurrent are 2 different things<p>- the &#x27;symbolic languages&#x27; definition seems off. Wikipedia puts it right:<p>&gt; symbolic programming is computer programming in which the program can manipulate formulas and program components as data<p>So it&#x27;s not &quot;using graphs &amp; such to program&quot;
评论 #7568118 未加载
评论 #7565812 未加载
评论 #7567958 未加载
评论 #7565695 未加载
评论 #7565832 未加载
评论 #7568970 未加载
hexagoncabout 11 years ago
My first and only encounter with &quot;Concatenative Languages&quot; was programming the HP48GX[1] graphing calculator in highschool. Thinking back to it, I&#x27;m amazed by what you could do with it. It was very powerful even by today&#x27;s standards. Whereas other kids had Gameboys, I had an &quot;HP&quot;. 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].<p>[1] <a href="http://en.wikipedia.org/wiki/HP-48_series" rel="nofollow">http:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;HP-48_series</a> [2] <a href="http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life" rel="nofollow">http:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Conway%27s_Game_of_Life</a>
untothebreachabout 11 years ago
I was a little disappointed that Factor[1] didn&#x27;t get a mention in the &#x27;Concatenative&#x27; section. Its stack effect checker takes care of a lot of the problems he mentions, IMO.<p>1: factorcode.org
评论 #7566960 未加载
评论 #7569932 未加载
milliamsabout 11 years ago
QML [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&#x27;s not as powerful as other languages but in its domain it does very well.<p>[1] <a href="https://en.wikipedia.org/wiki/Qt_Modeling_Language" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Qt_Modeling_Language</a>
评论 #7570226 未加载
sirsarabout 11 years ago
LabVIEW 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.<p>I rarely use it because organization is such a pain, but its &quot;data-flow&quot; paradigm does simplify a lot of logic.
评论 #7567206 未加载
评论 #7566040 未加载
评论 #7566115 未加载
prezjordanabout 11 years ago
I wish APL&#x2F;J&#x2F;K were on here, but I guess that doesn&#x27;t really change the way I think about coding... it just blows my mind.
saosebastiaoabout 11 years ago
I&#x27;m a huge fan of the declarative programming paradigm, but outside of Regexp and SQL and a handful of other DSLs, it&#x27;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.<p>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.
评论 #7569168 未加载
z3phyrabout 11 years ago
Since &#x27;functional&#x27; is not mentioned, I will assume that it is mainstream now!
评论 #7565576 未加载
评论 #7565745 未加载
评论 #7565725 未加载
评论 #7565484 未加载
评论 #7565563 未加载
mjbabout 11 years ago
Other languages to add to this list would be Dijkstra&#x27;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.<p>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.
snorkelabout 11 years ago
10 Ways Buzzfeed-style Headlines Will Forever Be Annoying
评论 #7565631 未加载
sergiosgcabout 11 years ago
Where is Aspect Oriented Programming and all the other offspring of the Inversion of Control pattern (Dependency Injection, Dependency Inversion, ...)?<p>Is this line of evolution in languages considered dead?
评论 #7567924 未加载
评论 #7571503 未加载
kitdabout 11 years ago
Pointed out elsewhere, but ANI appears to be dead according to its own tutorial[1]. However Funnel[2] by Martin Odersky&#x2F;EPFL does a similar job, with a more explicit nod to Petri nets which are usually used as the basis for concurrent systems.<p>[1] <a href="https://code.google.com/p/anic/wiki/Tutorial" rel="nofollow">https:&#x2F;&#x2F;code.google.com&#x2F;p&#x2F;anic&#x2F;wiki&#x2F;Tutorial</a> [2] <a href="http://lampwww.epfl.ch/funnel/" rel="nofollow">http:&#x2F;&#x2F;lampwww.epfl.ch&#x2F;funnel&#x2F;</a>
josephschmoeabout 11 years ago
Code Search is a better way to do Declarative Programming for non-optimized solutions. I&#x27;ve been obsessing over this topic for the last few months. Right now there&#x27;s limited versions in a few places: Python&#x27;s howdoi and Visual Studio&#x27;s Code Search.<p>A true Code Search would work like this: 1. Type in your search term in your code in a comment line. i.e. &quot;Bubble sort StampArray by name&quot; 2. Google&#x2F;Bing&#x2F;StackOverflow searches for your string. Replaces your terms with generics. Searches for &quot;Bubble sort [an array of objects] by [string variable]&quot; 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 &quot;code search module&quot; which you can edit. 6. Your edits get added to the search database.<p>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&#x27;t necessarily have to keep the same result forever. If it&#x27;s been deprecated, you can re-do the search.
protomythabout 11 years ago
I&#x27;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.
评论 #7567616 未加载
josephschmoeabout 11 years ago
Dependent types are a wonderful idea so long as I can do a couple things with them: 1. Copy paste them without complications. i.e. &quot;non-null&quot; requires no code that relies on specific variables unless there&#x27;s a logical conflict (which variable?) 2. If it&#x27;s a known failure, give me a warning. If it&#x27;s an unknown failure, let me choose how to deal with it, again in a neutral fashion that I could simply say @Notnull&lt;skip&gt; and it would just skip the code if the variable is null.
keenerdabout 11 years ago
Declarative programming is a great one, almost a magical experience.<p>&quot;It feels like I am sitting at the controls of a quantum computer. I&#x27;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.&quot;<p>(From something I&#x27;ve been working on, <a href="http://kmkeen.com/sat/" rel="nofollow">http:&#x2F;&#x2F;kmkeen.com&#x2F;sat&#x2F;</a> )
Blahahabout 11 years ago
The 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?
评论 #7565313 未加载
评论 #7565311 未加载
评论 #7570216 未加载
评论 #7565610 未加载
aufreak3about 11 years ago
Would be good to add Mozart&#x2F;Oz.<p>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.<p>An interesting tidbit - the Mozart&#x2F;Oz team invented &quot;pickling&quot; before it caught on with Python.
danielweberabout 11 years ago
I&#x27;m in the midst of something else and can&#x27;t pull out my C++11 book now, but doesn&#x27;t C++ have custom types that would let you declare something like &quot;this must be a positive integer&quot;?<p>I might be confusing this with custom literals.
评论 #7567705 未加载
josephschmoeabout 11 years ago
Would 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&#x2F;code view though specifically for this purpose.
JupiterMoonabout 11 years ago
Isn&#x27;t &quot;Dependent types&quot; just re-inventing how Fortran handles non allocatable array and character variables i.e. those who&#x27;s length is declared at compile time using a parameter?
评论 #7567079 未加载
评论 #7566660 未加载
评论 #7569297 未加载
评论 #7566123 未加载
评论 #7565954 未加载
kazagistarabout 11 years ago
If a programming paradigm does not change how you think about coding, it isn&#x27;t a programming paradigm. Good article though.
cowlsabout 11 years ago
I read it, and how I think about coding remains the same as before I read it.
评论 #7565660 未加载
joshlegsabout 11 years ago
.... did .... did you crosspost this from reddit ???<p><a href="http://www.reddit.com/r/programming/comments/22nhb2/six_programming_paradigms_that_will_change_how/" rel="nofollow">http:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;programming&#x2F;comments&#x2F;22nhb2&#x2F;six_prog...</a>
SeanLukeabout 11 years ago
&gt; If you&#x27;ve used SQL, you&#x27;ve done a form of declarative programming<p>This is so wrong I don&#x27;t know where to begin.
评论 #7565911 未加载
评论 #7566457 未加载