Questions tagged [declarative]
9 questions
28
votes
9 answers
Declarative programming vs. Imperative programming
I feel very comfortable with Imperative programming. I never have trouble expressing algorithmically what I want the computer to do once I figured out what is it that I want it to do. But when it comes to languages like SQL or I often get stuck…

EpsilonVector
- 10,763
- 10
- 56
- 103
5
votes
2 answers
Can all business logic be decomposed as a (declarative) state diagram on simple crud operations and conditionals?
This seems an extreme question probably but I'm wondering anyhow:
Can all business logic be decomposed as a (declarative) state diagram on simple crud operations and conditionals?
Already a lot of lower-level domain logic can, and ofen is…

Geert-Jan
- 673
- 1
- 5
- 13
3
votes
1 answer
In a declarative language, specifically in the context of modelling, can we make a clear distinction between code and data?
For declarative languages, specifically (but not limited to) in the field of modelling, it's not obvious to me whether code can be considered to be separate from data. This line of reasoning may only apply to non-turing complete languages such as…

Mike Vella
- 131
- 3
2
votes
5 answers
Is imperative style programming (say with Java/C) more error prone than something more declarative
I know programmers tend to get defensive with their paradigms and tools that they use. But in your experience, with the most generic, typical pieces of code that you see with Java or C++ or C, is the code more error prone than a similar piece of…

berlinbrown2
- 525
- 2
- 14
2
votes
1 answer
For Object Oriented Programming purists, are @annotations heresy?
Philosophical Question:
An issue that occurred to me is that especially when using frameworks like Spring or Hibernate ( which are everywhere in industry), we have annotate everything.
This is better obviously then the declarative XML statements...…

Menelaos
- 267
- 3
- 14
1
vote
2 answers
Declarative parser for JSON and DOM
I am parsing many JSONs and DOMs in PHP. The problem is that the my knowledge about the structure of the JSON/DOM is mixed with code. For example, suppose that I have few sources of first and last names. Each data source can look different and have…

Mateusz Drost
- 159
- 3
0
votes
2 answers
Should default values be explicitly stated in configuration files for libraries or frameworks?
In one of the projects I work for, we have just added karma to run unit tests.
When reviewing the MR of a coworker, I noticed the karma.conf.js (the configuration file) has 120 lines, which seems to be a lot for me.
While reading each configuration,…

Gonzalo.-
- 161
- 6
0
votes
1 answer
Determine execution order based on declarative definition?
We want to create a DSL in Scala where you can declaratively list the ingredients that a product consist of. These ingredients can consist of for example "Create product a", "Create product b", "Send mail". The ingredients can depend on each other…

user2609980
- 193
- 8
0
votes
2 answers
Is recursion a declarative approach to solve the problems?
I have noticed many problems in algorithms textbook are solved by recursion (divide and conquer, backtracking,...)
As I tried to enhance my skills in writing them, I have noticed, I just need to translate a recursive definition of the problem to the…

Ahmad
- 1,806
- 3
- 20
- 32