declarative programming

Tom tbee at tbee.org
Tue Dec 7 07:07:53 PST 2010


Brian Goetz kindly pointed me to a too easily coining of the term "declarative programming". I did not think enough about it, and stand corrected. As of now I will refer to my suggestion as "declarative initialization".

Thanks Brian!

Tom


On 7-12-2010 15:39, Brian Goetz wrote:
>
>> Basically what declarative programming is, is initializing objects in a readable form. Something like:
>
> No, that's not what declarative programming is!  You are alluding to a specific feature, not unlike "object literals" in some languages, which is *an example of* a more declarative style of initialization.  Declarative programming is a far more general term.  (Its sort of like saying "object oriented programming is when you have special functions called constructors to initialize the state of data structures.")
>
> Declarative is the opposite of "imperative".  In a nutshell, "imperative" is "tell me how to do it", whereas declarative is "tell me what result you want."  This is a language design philosophy that goes way beyond how objects are initialized.
>
> For example, most of SQL is declarative -- you describe the characteristics of the result you want (SELECT * from Person where name = "Tom") and the implementation figures out whether to do a table scan, index scan, etc.  (But it has no object initialization at all.)
>
>
>
>



More information about the lambda-dev mailing list