1
$\begingroup$

Maybe this is a very ignorant question. I don't understand imperative computing very well, would it be correct to think of it as simply scripting (as in, running one or a few commands at a time, typically run through a shell language, as opposed to writing a fully fledged program)?

$\endgroup$
3
$\begingroup$

Your understanding is not correct. There are two major programming paradigms: imperative programming and declarative programming.

In imperative programming you basically tell your computer what to do to solve a certain problem by providing an algorithm which might be implemented as a composition of different functions and/or methods. Often one distinguishes between object-oriented and procedural programming as the two main subparadigms of imperative programming, where the latter one is often scripting but the lines between scripting and "software engineering" (i.e. writing fully fledged programs) is blurry. Procedural programming can be engineerish, too.

In declarative programming you do not tell your computer how to solve the problem but rather what is the problem. Again, one might distinguish between subparadigms where one might be more frequent for hacky scripts where others are more profound.

You might want to check out C, Java, and Haskell (for instance) as procedural, object-oriented (i.e. the two mainly imperative languages) and a functional (i.e. a declarative language) language. Maybe implement functions to sort a list of integers in each of them, the differences between the latter as opposed to the first two should become very clear, but also the corresponding Wikipedia pages should provide good insights. However, e.g. in C++ (object-oriented) there are some features whose origins are in functional (declarative programming), e.g. lambda functions. On the other hand Haskell also has some sort of loops which are strictly speaking a rather imperative concept, so programming language designers adapt concepts from other languages from another paradigm, the line is blurred and not as clear as 30 years ago.


The difference between scripting and software engineering is even less clear. I would say it depends on the size of the program, reliability, use cases, how well it is documented, ... whether a certain program is a script or "fully fledged".

| cite | improve this answer | |
$\endgroup$
  • 1
    $\begingroup$ And of course, scripting can be functional too! $\endgroup$ – D. Ben Knoble Jan 19 at 1:16
  • $\begingroup$ Thank you very much for the detailed response, I am definitely saving this and will be referring to it throughout the future! Funny thing is that your initial description of declarative program brought to mind machine learning, but that isn't a style of programming at all of course. I can comprehend the wikipedia pages on this a bit better thanks to your response so I'll give those another read. Thank you again! $\endgroup$ – James Ronald Jan 19 at 17:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.