Over a million developers have joined DZone.

Deciding On Graphs: Four Questions

· Java Zone

Check out this 8-step guide to see how you can increase your productivity by skipping slow application redeploys and by implementing application profiling, as you code! Brought to you in partnership with ZeroTurnaround.

Originally Written by

Originally Posted on Medium

Take 5 minutes. Ask yourself the four questions listed below. Answer ‘yes’ to at least one of them, and you might want to consider looking into graph databases like Neo4j. While this checklist is by no means exhaustive, it covers some of the lowest common denominators of real Neo4j projects.

Question 1: Will I be evolving this project and data model over time?

Let me guess. You know about the schema migrations that await. Perhaps you’ve experienced the constant updating of unrelated queries and code as your schema changes. The one-off columns that creep into your tables. The heavy data lifting in your application code. You’ve been down this road before. You know exactly where it ends. And I know that’s not where you want to be.

Take the red pill.

Question 2: Am I doing more than one JOIN?

You have no conceptual problem with JOINs. They are, in fact, very logical. But when you ask your database to do several of them, it just doesn’t seem to run as smoothly as it should. When you return to that beautiful query months later, you struggle to remember why the sixth JOIN was a FULL OUTER one. Soon you start dreading making changes to your queries, and you only do it when you have to. You stop pushing the boundaries of your data. You are eyeing the blue pill.

Take the red pill.

Question 3: Will I potentially want to ask other things of this data later?

The schema makes you feel safe. You know what’s in your database. But as the saying goes, you don’t know what you don’t know. Rue the day when you get asked to figure out how these things over here relate to those things over there. Don’t think it will happen? It will. And when it does, you will build a glorious denormalized, pre-computed view of that data. It may be a bit stale, but hey, it works. Before you know it though, you’ll be herding static views like they were cats, i.e. not at all. You know what to do, right?

Take the red pill.

Question 4: Do I feel inclined to draw the graph on a whiteboard?

This is actually my favorite question. The human brain’s urge to look for patterns in information is exceptionally strong. Put a human in front of a whiteboard with a pen, give them a problem to solve, and they will draw something — I guarantee it. What if your application and domain design worked exactly like a whiteboard? Wouldn’t that be something?

Take the red pill.

 

The Java Zone is brought to you in partnership with ZeroTurnaround. Check out this 8-step guide to see how you can increase your productivity by skipping slow application redeploys and by implementing application profiling, as you code!

Topics:

Published at DZone with permission of Andreas Kollegger, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}