By Joy Chao, Novice Graphista | September 19, 2016
The history of programming languages goes back to the beginning of computing, with new languages being created for each variation and paradigm. When it comes to databases, two well-known paradigms include imperative and declarative query languages.
All too often, the latter is often broadly defined as being any database query language that is not imperative. However, to define it in such a manner is too broad.
In this blog post, we will discuss the different features of the imperative and declarative database query languages, as each has its individual strengths and weaknesses. Selecting which language to use will depend specifically upon your individual situation.
Imperative Query Languages
If the query languages were human archetypes, imperative languages would be the micromanaging boss who gives instructions down to the final detail. In the most basic sense, imperative query languages are used to describe how you want something done specifically. This is accomplished with explicit control in a detailed, step-by step manner; the sequence and wording of each line of code plays a critical role.
Some well-known general imperative programming languages include Python, C and Java. In the world of graph databases, there aren’t any purely imperative query languages. However, both Gremlin and the Java API (for Neo4j) include imperative features. These two options provide you with more detailed power over the execution of their task. If written correctly, there are no surprises – you will get exactly what you want done.
However, imperative database query languages can also be limiting and not very user-friendly, requiring an extensive knowledge of the language and deep technical understanding of physical implementation details prior to usage. Writing one part incorrectly creates faulty outcomes.
As a result, imperative languages are more prone to human error. Additionally, users must double-check the environment before and after the query and be prepared to deal with any potential erroneous scenarios.
To better illustrate the differences, imagine you have two children: Izzy and Duncan. Izzy represents an imperative query language and Duncan the declarative query language.
To get the two children to make their beds, you take differing approaches. For Duncan, it is easy. Simply instruct Duncan to make his bed and he will do it however he sees fit. Yet, he might make it slightly differently than you had in mind, especially if you’re a picky parent.
Izzy requires an entirely different process. You must first inform her that she needs both sheets and blankets to make her bed, and that those materials can be found on top of her bed. Then she requires step-by-step instructions, such as “spread the sheet over the mattress” and “tuck in the edges.”
The final result will be closely similar to Duncan’s (or perhaps, exactly the same). At the end of the process, both children have their beds made.
Declarative Query Languages
On the other end of the spectrum, declarative database query languages let users express what data to retrieve, letting the engine underneath take care of seamlessly retrieving it. They function in a more general manner and involve giving broad instructions about what task is to be completed, rather than the specifics on how to complete it. It deals with the results rather than the process, thus focusing less on the finer details of each task.
Some well-known general declarative programming languages include Ruby, R and Haskell. SQL (Structured Query Language) is a declarative query language and is the industry standard for relational databases. In the graph database ecosystem, several query languages are considered declarative: Cypher, SPARQL and Gremlin (which also includes some imperative features).
Using a declarative database query language may also result in better code than what can be created manually, and it is usually easier to understand the purpose of the code written in a declarative language. Declarative query languages are also easier to use as they simply focus on what must be retrieved and do so quickly.
However, declarative languages have their own tradeoffs. Users have little to no control over how inputs are dealt with; if there is a bug in the language, the user will have to rely on the providers of the language to fix the problem. Likewise, if the user wants to use a function that the query language doesn’t support, they are often at a loss.
In the previous example of the children, Duncan was able to complete his task in a method faster and easier for his parent than Izzy. However, imagine now that you want to them to wash the dishes.
It is the same process for Izzy: You’d need to walk through each step with her so she can learn how the process works. For Duncan however, we have hit a snag. Duncan has never learned how to wash the dishes. You will stay in that impasse with Duncan unless his programming engineers decide to teach him how to wash the dishes. (Duncan isn’t like most children.)
Conclusion
This post is not meant to pit the two types of database query languages against each other; it is meant to highlight the basic pros and cons to consider before deciding which language to use for your project.
You should select the best query language paradigm for your specific use case. Neither paradigm is better than the other; they each have different strengths for software development.
If your project requires finer accuracy and control, imperative query languages do the job well. If the speed and productivity of the process matter more, declarative languages offer the flexibility of getting results without as much effort. Ultimately, the choice depends upon your individual use case.
Are you a beginner to graph database technology?
Click below to get your free copy of the O’Reilly Graph Databases ebook and discover how to use graph databases for your application or project.
How long marinate steak tips
what does generalization mean
what does the root infer mean in the word inferior
How to predict magic tricks pieces of paper
what does ava mean
How to get rid of vertigo
How long to deep fry chicken wings
How do they do the tricks in carbonaro effect
What are the rubber tips on a water bottle called that you sip out of
what does bsm mean on a car
How to add vaccination card to wallet?
How long to bake steak?
what does refinance mean
How long to bake lasagna at 350?
How to get instagram account back?
How to make wheel in little alchemy?
How to get rid of worms in humans without medication?
How to find diamonds in minecraft 1.17
Why does my polka dot plant have brown tips
what does natty mean gym
what is sos mean
what does huh mean in text
How to 69
what does mw mean
Guy who tricks scams
what does forwarded for delivery mean
Tips for getting a pap smear when you have vaginismus
what does dharma mean
How to leave a group text iphone
How to clean golf clubs?
How to make flowers last longer
How to prevent your earbud tips from falling off
Who is the girl who did tricks on her bike
view filters are applied in what order?
what does tw stand for
How much does doordash pay before tips
what are dogs
How to make a quesadilla?
For car washing, tips on how to make signs
what does it mean if your hands itch
How to stop night sweats
How do skiers keep their tips together
How to reset pc
How to dispose of paint?
How to get the dog to do tricks on gta 5
what does the egr valve do
Why are my grass tips brown
How to get stains out of clothes
How to build business credit?
what does going commando mean
what does the color red mean
How to make your dog do tricks in my first dog
what are the two primary types of waves generated by earthquakes?
How to lock your credit
what does ref range mean
How to season salmon?
what does ostracized mean
what does oppa mean
How to make gingerbread cookies
How to play pokemon
How long do i need to keep tax records?
Why is my peace lily tips turning brown
How to cream butter and sugar?
How to get rid of a boil fast?
How to get tips as a waiter
what are catalytic converters
what does dog whistle mean
what does mfs mean
what does con mean
what does a heart attack ekg look like
How to make weed gummies?
what towers does t mobile use
what does sa
How to factory reset iphone without apple id password?
How to get an average
what does tribal mean
How long to cook pork chops on grill?
what does my eyecolor mean
How to enable javascript on chrome?
How to know if you like someone
What do you glue pool cue tips with
Tips on how to be a good boyfriend
How to be healthy?
what does hum mean
How to buy nfts
what does inductive mean
What causes brown leaf tips on houseplants
How to make magic -tricks
what does cbf mean
How to get to bios
what does congeniality mean
How to find my airpods
How to get rid of weeds
what does pushing p mean tiktok
How to talk to anyone 92 little tricks chapters
How to send certified mail?
Mario kart wii how to do tricks with gamecube controller
what does optimize mean
what does it mean to be entrepreneurial
How do i change the airpod pro tips
Why you shouldn't clean your ears with q tips
How long to air fry asparagus
what does the prefix un mean
How to kill mosquitoes?
Why do the tips of my teeth look transparent
what does insecure mean
How are tips split princess emerald
what does ffs mean
Tech decks how to do tricks
what does influence mean
what does a barometric pressure headache feel like
How to make good in little alchemy 2
How much does it cost to replace carpet
How to make granola bars?
what does kun mean
How to stop hot flashes fast?
Card magic tricks how to do
How to remove ski pole tips for roller skiing
what does voltage mean
what does psychology mean
Best tips how to be smart everyday life
what does ily mean
How many people have died doing magic tricks
How to get rid of gnats in kitchen?
what does 5.11 mean
How to potty train a kitten?
How to do tricks with a skipping rope
How to core cabbage tips
How to get rid of flu?
How to take off gel nail tips
How to steam tamales
Tips when trading in a car for a new car
what does utah mean
How to hide your number when calling
How to stop pop-ups on windows 10
what time does dillards close
How to write a cover letter for a job?
what does inscription mean
How does ryan tricks read minds
what does a diverticulitis attack feel like
what does nfs mean text
How to use a drill?
what does rule of law mean
what does mm mean
How do magicians do lottery number tricks
How to guide tips optimize setup "spotify"+"assistant
How long is derek chauvin going to be in jail?
Littmann how to replace ear tips
How to make your nose stop running?
How to get off acrylic nails?
How to cure neck pain fast
How to cook pea tips
what episode does naruto learn sage mode
How to cook a pork tenderloin?
what does hasta luego mean in spanish
How to draw among us?
How to use google home hub tips and tricks
How to remove carpet?
What is another name for tips
How long does it take for dogs to learn tricks
Tips and tricks how to apply vinyl to outdoor sign
How to put a curse on someone?
How to make a toddler poop when constipated
what does making love mean
what does toil mean
How to make an nft art?
How to make your room smell good?
How to upgrade nook's cranny
what does bbg mean in text
What is time management tricks
Why tips
How to make handcuffs out of a belt
How to opioids pain management tips
what does the infinity sign mean
what does centennial mean
what does solitude mean
what does gr stand for
How can i make the tips of my hair silver without ruining it
what does ot mean in texting
How to bbq ribs tips slab
what does swot stand for
Why are the tips of my avocado leaves turning brown
what does upon mean
what does it mean when you dream about your teeth falling out
How to make apple butter?
How to get rid of under-eye bags permanently without surgery
How to do pogo stick tricks
How to follow up on a job application?
List two tips for protecting your privacy when on google specifically.
How to stop hot flashes fast
How to change iwatch band
How many hat tricks were their in 2015
what does baka mean in text
How to use siri on iphone 13
Www..chattanoogahomes.com/blog/stress-free-tips-when-moving-home
How to become an archaeologist?
what are the parts of the body
How to cook raw shrimp?
what does subordinate mean
How to tell cat gender by face?
How to sell tickets on seatgeek?
Google tricks to do when bored
How to get cash fast?
How to learn italian
what do the red flags on facebook mean
what does mbn mean in texting
what does nun mean
How to hear god's voice
what does a memo look like
what does unironically mean
How to charge nintendo switch?
What is shortest u.s. tips bond available
what does a karen mean
What is frosted tips?
What would make just the tips of my dogs ears swollen
what does boho style mean
what does laden mean
How to make roman shades
what does variable mean
Where to buy magic tricks in buford
How to get stripped screw out
How to tell if a diamond is real?
How to make collard greens?
what do pd mean
How to screenshot on asus laptop?
How is shin lim doing his tricks
How to see who liked your tiktok
How to thin hair?
How to fry pork chops
How to cook pork chops on the grill
What magazines are good for internet tricks reddit
Who makes cue tips
How do you teachg lion head rabbits tricks
How to teach your betta tricks
what does urge mean
what does wasp mean
what does e mean on spotify
Diving event where they do cool tricks
How much can i contribute to my roth ira?
How to edit a video on iphone?
How to ride a llama in minecraft
what does acne on cheeks mean
Tips on how to swallow a pill
what are you grateful for today
How to cook spiral ham?
What kind of meat is used for beef tips
what time does csl plasma close
what does msw stand for
How to stop chest pain
How much does average waiter make each year with tips
what does ea mean
what does bl stand for
what does upmost mean
what does root mean in australia
7 tips for self-motivation/how to learn.com
what does elevated liver enzymes mean
what does urology mean
How to migrate minecraft account
what does soho stand for
what heart emojis mean
Why dont women do the same snowboard tricks as men
Where can i watch dirty tricks documentary
what does filler mean in anime
What do servers make an hour without tips
What to do if kayak tips over
what does a deductible mean
How to dial an extension?
What negotiation tips did you discover?