Questions tagged [imperative]

Imperative programming is a paradigm of expressing the logic of a computer program or computation by explicitly describing its control flow in terms of statements that change a program state.

57 questions
2
votes
2 answers

Imperative vs interrogative methods

When implementing a class, is it better practice to return a value for methods (interrogative) or to simply manipulate class attributes directly within the method (imperative). For example, I have a class which builds a string to be output to a CSV…
Andrew
  • 11,068
  • 17
  • 52
  • 62
1
vote
1 answer

Is there a Declarative approach to converting each member of a TypeScipt array to a full instance of an Object?

I have a class I can't change, simplified version shown. I got an array of variations on the class. I need to add the rest of the class to each member of the array before I can use them. class ValueType { name: string; size: number = 5; …
1
vote
1 answer

Incrementing a counter with functional programming vs imperative programming

I likely am asking a very stupid question here, please forgive me. I am a Java and C# backend-engineer with relatively good knowledge of OOP design patterns. I have recently discovered the debate about OOP vs functional programming and the question…
1
vote
0 answers

How to change the structure of a sentence (imperative -> interrogative) in python (NLP)

I would like to build a model that can take a sentence in the imperative form and output a new sentence in an interrogative form (however, the meaning would be the same in both sentences - both sentences are commands). I have seen the following…
Aryana
  • 75
  • 1
  • 1
  • 7
1
vote
1 answer

Is behind the hood of declarative coding is still imperative in Javascript?

I read the difference of imperative and declarative paradigms here https://codeburst.io/declarative-vs-imperative-programming-a8a7c93d9ad2 The author then use React and JQuery as examples, but then under all the cool stuffs that React use, it must…
Loredra L
  • 1,485
  • 2
  • 16
  • 32
1
vote
1 answer

Imperative OCaml data structure with pointers?

Is such a thing possible? Hi all, in my class we were told to implement Binary Search Trees in OCaml, using functional and imperative programming. We are following an ADT and implementation in Pascal, a procedural language where pointers are used.…
deko
  • 463
  • 1
  • 6
  • 17
1
vote
0 answers

Function outputs random number

I just made a function that needs to find the lowest amount of spectators at soccer games. It works for all values but one, team[10] where it seems as if it is pointing to a random location in memory and I cannot seem to find the reason. It seems…
asdasd
  • 59
  • 6
1
vote
2 answers

Is it possible to design and build a procedural (imperative) based application successfully?

Can you provide examples of applications today that are procedural and maintain a high level of integrity and efficiency? Are there any books, tutorials or links that provide examples of how to successfully build and maintain an imperative system?…
user4903
1
vote
1 answer

ASP.Net set Membership.Provider programmatically

I would want to know if it is possible to set the default Membership provider (Membership.Provider) through code not through configuration file.
Alexander Beninski
  • 817
  • 3
  • 11
  • 24
0
votes
0 answers

Inheriting component that uses useImperativeHandle exposed api

Can't get throght problem of wrapping a component that exposes ref with some api. I need to add some functionality to it and export the same api to its users. I don't need to add new methods to this api. In other words the problem sounds like:…
Xi Spar
  • 1
  • 1
0
votes
0 answers

What are the differences between "declarative" and "imperative" frameworks in UI development?

I've been trying to understand the differences between declarative and imperative frameworks in the context of UI development. However, despite my research, I'm still finding it hard to grasp these concepts clearly. Could someone explain the key…
0
votes
1 answer

What is the difference between abstraction and declarative programming?

Declarative programming seems to be achievable through abstraction. So what's the difference between abstraction and declarative programming? [ My thought ] I will call the person using the class "server" and the person using the class "client". I…
Ashe
  • 61
  • 7
0
votes
1 answer

Function doesn't print correctly

So I have to create a "lights out" game. I have to create two functions. One function "flip" val flip : bool array array -> int -> int -> bool array array = that given a bool matrix and two integers i, j. it negates the values (true→false,…
idkrlly
  • 13
  • 4
0
votes
1 answer

Is it possible to mix declarative and imperative paradigms for Android UI development?

Is it possible to mix declarative and imperative paradigms for Android UI development ? 1- In « traditional » Android development, Java + XML are used to create interface elements (in a Rather static way). 2- With Kotlin + « Jetpack Compose » it is…
Serge Hulne
  • 594
  • 5
  • 17
0
votes
2 answers

Simple flow control and variable binding in Clojure

I'm learning Clojure and working on a simple file parsing script. I have a file in the form of: pattern1 pattern2 pattern3 pattern1 pattern2 ... where each line has a few values (numbers) that I extract. If I was to write this in Java for…
newman555p
  • 181
  • 1
  • 4
  • 13