Timeline for What's The Difference Between Imperative, Procedural and Structured Programming?
Current License: CC BY-SA 4.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 2, 2023 at 20:24 | comment | added | Martin Maat | @Blaisem If you say "SQL is a bunch of functions strung together" I will say that makes it imperative. If you regard an SQL statement as a description of a result, which you could, that would make it declarative. Because the mapping of SQL keywords to functions is rather direct as you point out, it is not a clear cut case and a poor example for either paradigm. | |
Jun 2, 2023 at 10:12 | comment | added | Blaisem | @MartinMaat A language based on functions is imperative? That's...literally the opposite interpretation of declarative programming and couldn't be more wrong. You should review the wiki page on declarative programming. In fact, I just noticed SQL is listed there as declarative. | |
Jun 1, 2023 at 4:45 | comment | added | Martin Maat | @Blaisem Functions are imperative, they are a series of instructions. | |
May 31, 2023 at 15:27 | comment | added | Blaisem | @MartinMaat SQL is definitely not imperative. It's declarative, as every query keyword is actually a function. A query is just a string of functions, making it declarative. You can pass queries into each other like first-class citizens. If it's not strictly functional, it's very close and possibly certain flavors are. | |
Jul 20, 2021 at 19:09 | comment | added | Martin Maat | @Maggyero I would call both HTML and CSS declarative because of their descriptive nature. They describe a document and how it should be rendered but no steps towards a result are provided. SQL and HTTP on the other hand are purely command based, they tell what is to be done, thus they are imperative. | |
Jul 20, 2021 at 8:29 | comment | added | Géry Ogam |
Excellent answer (imperative vs declarative = control vs logic = command vs statement = action vs state = step vs result). So are HTML (e.g. <!DOCTYPE html><html lang=""><title>x</title> ), CSS (e.g. h1 { font-size: 3rem; } ), SQL (e.g. INSERT INTO relation (x) VALUES (3); ), and HTTP (e.g. PUT / HTTP/1.1 Host: example.com {"x": 3} ) imperative languages or declarative languages?
|
|
Aug 1, 2020 at 21:17 | history | edited | Martin Maat | CC BY-SA 4.0 |
Improved language and punctuation.
|
Mar 28, 2019 at 22:15 | history | answered | Martin Maat | CC BY-SA 4.0 |