1. Home
  2. Computing & Technology
  3. Java

Declarative Language

By , About.com Guide

Definition:

A declarative language describes what it wants to accomplish rather than focusing on how to achieve its goal. Writing a declarative program is not about specifying a sequence of statements to run one after another to create an application, but to write declarative statements that show a relationship between each other.

Examples:

JavaFX script is a declarative language. To create a GUI, the elements of the interface are described with respect to each other (i.e., a script can describe a scene. Its content might be a couple of buttons and a line of text, all described with variable values in a series of declarative statements). The script creates the desired GUI because of the relationship between the different elements can be interpreted (i.e., the order of the buttons and text inside the content of the scene).

In contrast, Java is an imperative language. To produce a similar GUI, a JFrame object could be created. Next, two JButton objects and a JTextField object can be explicitly added to the JFrame. The interface is created from a series of statements that are each executed in turn.

Glossary:

# A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Explore Java
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Java
  4. Java Glossary
  5. D
  6. Definition for the Term: Declarative Language>

©2009 About.com, a part of The New York Times Company.

All rights reserved.