Declarative Versus Imperative Code

Terminology and differences in programming paradigms

Martin Novak
Better Programming

cartoon about imperative vs. declarative code
Image source: Author

Believe it or not, you are likely already using multiple programming paradigms as a developer. Because there is nothing more fun than entertaining your friends with programming theory, here is an article that will help you recognize popular paradigms in your code.

For updated information please consider my new post Imperative Vs. Declarative Programming In JavaScript or watching my new YouTube video:

Imperative Code

Imperative programming is how we started with Assembly (1949) and continued with languages like C, C++, C#, PHP, and Java. Procedural and object-oriented programming belong under the imperative paradigm.

Your code is based on statements that change the program state by telling the computer how to do things. In other words, your code is based on defining variables and changing the values of those variables.

It is the ideal programming paradigm for people who have a less-than-innocent…

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Responses (4)

What are your thoughts?

Good article on programming paradigms. Appreciate it, including the snarky comments.
LISP(1984)??? No, LISP(1958).
Certainly FORTRAN (1957) (now Fortran) deserves mention so here it is. Also COBOL (1959).

--

I'm imperatively telling you to use declarative code
Sheer brilliance!

--

Martin, good article. Thanks.

--