• Sign in to Neowin Faster!

    Create an account on Neowin to contribute and support the site.

  • 0
Sign in to follow this  

Data Dictionary vs Object

Question

Brian Miller    1,618

I have two developers, one web and one mobile.  When looking at the following data, my web developer calls it an "object" and my mobile developer calls it a "dictionary".  They argue among themselves as to what it's called, and I can't chime in as I've never heard of the term "dictionary" before.  Are they both right, or is there a difference between the two?

 

Here's my JSON object:

 

{
	"votes":{
		"republicans":		46.09,
		"democratics":		48.18,
		"libertarians":		3.28,
		"greens":		1.07,
		"independents":		0.54,
		"others":		0.84
	}
}

 

Share this post


Link to post
Share on other sites

8 answers to this question

Recommended Posts

  • 0
adrynalyne    10,349

This is pretty easy to clear up. A dictionary is an object. So I guess they can both be right. Web is calling it an object most likely due to working with JavaScript, would be my guess. Mobile developer is being more specific. A dictionary is just an object that contains key-value pairs. 

Share this post


Link to post
Share on other sites
  • 0
Brian Miller    1,618

Thanks. So they're actually is the difference. What is the difference?

Share this post


Link to post
Share on other sites
  • 0
adrynalyne    10,349
3 minutes ago, Brian Miller said:

Thanks. So they're actually is the difference. What is the difference?

A dictionary is an object but not all objects are dictionaries. 

 

An object can be a collection of dictionaries, for example. Or a collection of Lists. Or a button. Etc. 

Share this post


Link to post
Share on other sites
  • 0
Brian Miller    1,618

That's great. Thank you

Share this post


Link to post
Share on other sites
  • 0
adrynalyne    10,349
Just now, Brian Miller said:

That's great. Thank you

👍

Share this post


Link to post
Share on other sites
  • 0
virtorio    2,846

Whether what you posted is an object or a dictionary depends entirely on what language and libraries the developer is using and how they intend to load/parse it.

 

So they both wrong.

Share this post


Link to post
Share on other sites
  • 0
astropheed    2,011

It's an Object, but more specifically it's a Dictionary Object. It's also an Associate Array, a Map, and a Symbol Table.

 

Don't get caught up on semantics. It's an object represented by key/value pairs and if you keep the naming convention within context most people will know what you mean. I personally call it an Object when I'm writing JavaScript, an Associative Array when I'm writing PHP, and a Dictionary when writing Python. I call it "JSON" when it's JSON :/

  • Like 2

Share this post


Link to post
Share on other sites
  • 0
adrynalyne    10,349
1 minute ago, astropheed said:

It's an Object, but more specifically it's a Dictionary Object. It's also an Associate Array, a Map, and a Symbol Table.

 

Don't get caught up on semantics. It's an object represented by key/value pairs and if you keep the naming convention within context most people will know what you mean. I personally call it an object when I'm writing JavaScript and a Dictionary when writing Python.

I think you probably said it more eloquently than I did. 

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.