Skip to main content
Tweeted twitter.com/#!/StackProgrammer/status/236703056304148481
Notice added Needs detailed answers by yannis
added 121 characters in body
Source Link

While the same as the JSON representation in code, it doesn't have the same creep because I don't have to redefine the tuple every time and property accessors hide the code retains a sortappearance of elegancecreep. Of course, this is an apples-to-oranges comparison, the above is code while the JSON is data.

While the same as the JSON representation, it doesn't have the same creep because I don't have to redefine the tuple every time and the code retains a sort of elegance.

While the same as the JSON representation in code, it doesn't have the same creep because I don't have to redefine the tuple every time and property accessors hide the appearance of creep. Of course, this is an apples-to-oranges comparison, the above is code while the JSON is data.

added 656 characters in body
Source Link

ThereThis leads to a creep of this tuple for every value. Take a fully-fleshed out value from the characters array:

{
    name : {
        value : "Hakan",
        confidence: 0.80
    }
    ultra : {
        value: 1,
        confidence: 0.90
    }
}

As the structures that represent the values become more and more detailed (and more analysis is something aboutdone on them to try and determine the JSON being structured this wayconfidence behind that has a smell/feels very unwieldyanalysis), perhaps due to the naturenesting of JSON.the tuples adds great deal of noise to the overall structure, considering that the final result (when verified) will be:

{
    name : "Hakan",
    ultra : 1
}

(And recall that this is just a nested value)

While the same as the JSON representation, it doesn't have the same smellcreep because I don't have to meredefine the tuple every time and the code retains a sort of elegance.

Is there a more formalized/cleaner/best practice way of representing these typecontaining the creep of these tuples (really scalars with a second value attached to it all the time) in JSON, or is the approach above an accepted approach for the type of data I'm trying to store (and I'm just perceiving it the wrong way)?

There is something about the JSON being structured this way that has a smell/feels very unwieldy, perhaps due to the nature of JSON.

While the same as the JSON representation, it doesn't have the same smell to me.

Is there a more formalized/cleaner/best practice way of representing these type of tuples (really scalars with a second value attached to it all the time) in JSON, or is the approach above an accepted approach for the type of data I'm trying to store?

This leads to a creep of this tuple for every value. Take a fully-fleshed out value from the characters array:

{
    name : {
        value : "Hakan",
        confidence: 0.80
    }
    ultra : {
        value: 1,
        confidence: 0.90
    }
}

As the structures that represent the values become more and more detailed (and more analysis is done on them to try and determine the confidence behind that analysis), the nesting of the tuples adds great deal of noise to the overall structure, considering that the final result (when verified) will be:

{
    name : "Hakan",
    ultra : 1
}

(And recall that this is just a nested value)

While the same as the JSON representation, it doesn't have the same creep because I don't have to redefine the tuple every time and the code retains a sort of elegance.

Is there a more formalized/cleaner/best practice way of containing the creep of these tuples in JSON, or is the approach above an accepted approach for the type of data I'm trying to store (and I'm just perceiving it the wrong way)?

deleted 3 characters in body
Source Link
yannis
  • 39.6k
  • 40
  • 184
  • 217
{
    // Basic key information.
    video : "http://www.youtube.com/watch?v=7uwfjpfK0jo",
    start : "00:00:00",
    end : null,

    // For results of analysis, to be populated:
    // *** This is where it gets interesting ***
    analysis : {
        game : {
            value: "Super Street Fighter 4: Arcade EditonEdition Ver. 2012",
            confidence: 0.9725
        }
        teams : [
            {
                player : {
                    value : "Desk",
                    confidence: 0.95,
                }
                characters : [
                    {
                        value : "Hakan",
                        confidence: 0.80
                    }
                ]
            }
        ]
    }
}

Note, I'm this is being represented in JSON because this will ultimately go in a document database (something like RavenDB or elasticsearch). I'm not concerned about being able to serialize into the object above, because I can always use data transfer objects to facilitate getting data into/out of my underlying data store.

{
    // Basic key information.
    video : "http://www.youtube.com/watch?v=7uwfjpfK0jo",
    start : "00:00:00",
    end : null,

    // For results of analysis, to be populated:
    // *** This is where it gets interesting ***
    analysis : {
        game : {
            value: "Super Street Fighter 4: Arcade Editon Ver. 2012",
            confidence: 0.9725
        }
        teams : [
            {
                player : {
                    value : "Desk",
                    confidence: 0.95,
                }
                characters : [
                    {
                        value : "Hakan",
                        confidence: 0.80
                    }
                ]
            }
        ]
    }
}

Note, I'm this is being represented in JSON because this will ultimately go in a document database (something like RavenDB or elasticsearch). I'm not concerned about being able to serialize into the object above, because I can always use data transfer objects to facilitate getting data into/out of my underlying data store.

{
    // Basic key information.
    video : "http://www.youtube.com/watch?v=7uwfjpfK0jo",
    start : "00:00:00",
    end : null,

    // For results of analysis, to be populated:
    // *** This is where it gets interesting ***
    analysis : {
        game : {
            value: "Super Street Fighter 4: Arcade Edition Ver. 2012",
            confidence: 0.9725
        }
        teams : [
            {
                player : {
                    value : "Desk",
                    confidence: 0.95,
                }
                characters : [
                    {
                        value : "Hakan",
                        confidence: 0.80
                    }
                ]
            }
        ]
    }
}

Note, this is being represented in JSON because this will ultimately go in a document database (something like RavenDB or elasticsearch). I'm not concerned about being able to serialize into the object above, because I can always use data transfer objects to facilitate getting data into/out of my underlying data store.

added 6 characters in body
Source Link
Loading
Source Link
Loading