xxleyi / learning_list

聚集自己的学习笔记
10 stars 3 forks source link

declarative vs imperative #209

Open xxleyi opened 4 years ago

xxleyi commented 4 years ago

Declarative and imperative descriptions are intimately related, as indeed are mathematics and computer science. For instance, to say that the answer produced by a program is correct is to make a declarative statement about the program. There is a large amount of research aimed at establishing techniques for proving that programs are correct, and much of the technical difficulty of this subject has to do with negotiating the transition between imperative statements (from which programs are constructed) and declarative statements (which can be used to deduce things). In a related vein, an important current area in programming-language design is the exploration of so-called very high-level languages, in which one actually programs in terms of declarative statements. The idea is to make interpreters sophisticated enough so that, given what-is knowledge specified by the programmer, they can generate how-to knowledge automatically. This cannot be done in general, but there are important areas where progress has been made.

Both programming styles play significant roles while programming. In high-level programming, especially in data-driven applications, declarative runtime may automate repetitive flow along with simplifying code structure, and at the same time, imperative programming gives full control to developer especially it is very important in low-level programming or mission-critical jobs. Clearly, popularity of declarative and functional programming is arising, but as of today, imperative programming including its libraries, tooling, etc. heavily dominates programming languages.

Both React and Vue are popular declarative runtime.

refs: