Live data from Hacker News

Programming paradigms that change how you think about coding

brikis98.blogspot.com

201–206 of 206 posts

Re: Programming paradigms that change how you think about coding

#201
post #52

Earlier quoted context omitted.

Why do you think SQL doesn't qualify? it's certainly not the only example of declarative programming, and maybe not the most interesting, but it is one which most developers have come across.

In theory, SQL is a declarative programming language, in practice, past the simplest of examples, there are dozens, if not hundreds of ways to ask the same question, and each one of them performs differently. The moment one starts to do things like add anonymous views, the declarative facade tends to disappear. Let's also remember that many companies stuck with big RDBMs systems have entire teams of people whose job…

SQL-the-language is declarative - it defines meaning and does not define execution strategy. Particular implementations have significant differences in implementation strategy depending on the way the SQL was structured, leading to crazy results when people try and control operational semantics. But that doesn't mean "SQL is not declarative" - it's just a weakness of declarative languages when we care about operational semantics.

Has anyone made an RDBM that let you write SQL and separately control how it is evaluated?

Re: Programming paradigms that change how you think about coding

#203
post #21

I 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…

Graphical programming is also popular for animation/cgi/special FX, e.g. XPresso in Cinema4D.

Re: Programming paradigms that change how you think about coding

#204
post #199

Earlier quoted context omitted.

Not knowing what a latch is or why it is bad seems like more a failure of the class than an inherent problem with Verilog. There are times when a latch is useful and desired (though most often not and most often a normal flop structure is better). With hardware design, you have to keep in mind that you are modeling hardware. A language that did it all for you might be nice, but you still have to know what framework y…

> Not knowing what a latch is or why it is bad seems like more a failure of the class than an inherent problem with Verilog. You misunderstood the problem: It's not a problem that you can describe a latch, but that it's so easy to make the mistake of describing a latch instead of combinational logic. It's a common mistake and clearly a failure of the language, because two very different intents are described by very…

On latches: From experience, I've never had an issue accidentally defining a latch. Simple guidelines (fully describe any case statements or always have an else statement in if branches, use * from Verilog 2005 rather than trying to list all relevant signals) make it more an issue of typos than true unintentional latches and a basic lint flow will identify them quickly.

While I'd accept that perhaps exposing this so easily might be an annoyance in the language, it is hardly a failing.

Synthesis: Again, from experience, this is an issue with your synthesis flow, not the HDL. Synthesis is absurdly complicated, to the point where any team I've been on has at least one guy where that is the entirety of his job. If the generated netlist breaks simulation when your HDL made it all the way through all other flows, more than likely it's an issue with synthesis.

Re: Programming paradigms that change how you think about coding

#205

> If you've used SQL, you've done a form of declarative programming This is so wrong I don't know where to begin.

Per 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 "Wikipedia is mistaken" is totally a defensible position, but it should be defended, so please find a place to begin.

Wikipedia 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.

Re: Programming paradigms that change how you think about coding

#206

Earlier quoted context omitted.

Per 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 "Wikipedia is mistaken" is totally a defensible position, but it should be defended, so please find a place to begin.

Wikipedia 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 ca…

I would appreciate it if you'd at least add a section to the Wikipedia talk page with your concerns. I've not decided exactly how I feel on the matter, but they're certainly not entirely groundless.
Post reply on HN