Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Learn JSON by Building a Sports Team #113

Closed
QuincyLarson opened this issue Mar 8, 2019 · 8 comments
Closed

Learn JSON by Building a Sports Team #113

QuincyLarson opened this issue Mar 8, 2019 · 8 comments
Assignees

Comments

@QuincyLarson
Copy link
Contributor

No description provided.

@HKuz
Copy link
Member

HKuz commented Mar 23, 2019

Here are my initial thoughts for the project - I made a sports team vs a league, but can tweak this if we want. I went for an international, retro flair with the Argentinian World Cup winning team in 1986, mainly because I think the story that one of their players (Diego Maradona) hand-balled a goal in the tournament and called it the 'hand of god' is funny 🤣 .

JSON Project

Concepts to teach

  • JavaScript Object Notation (JSON) is a text file format to structure data
  • Popular structure to exchange data over the web because: lightweight, easily exchanged, human readable, easily parsed by machines
  • JSON started as a JavaScript standard, but it's language independent and can be used in many programming languages
  • Build JSON using two structures:
    1. Objects: an unordered collection of name-value pairs
    2. Arrays: an ordered collection of values
  • Values can be:
    • Numbers
    • Boolean values
    • Strings (must use double quotes)
    • Objects
    • Arrays
    • null
  • UPDATE: use JSON.stringify() and JSON.parse()
  • How to access data in JSON format
    • Dot notation (objects only, uses name but it can't have spaces)
    • Bracket notation (arrays use index, object uses name)

Data

The example structure below would make for a lot of typing for campers in its entirety, so I see them building it up only in the beginning. They can add the first several fields with different data types, then 1-2 entries in the players array. The project can end with some practice accessing different items.

@HKuz
Copy link
Member

HKuz commented Mar 23, 2019

First draft of the JSON project:

{
    "Team": "Argentina",
    "Sport": "Football",
    "Year": 1986,
    "World Cup Winner": true,
    "Head Coach": {
        "Name": "Carlos Bilardo",
        "Matches": 7
    },
    "Players": [
        {
            "Name": "Sergio Almirón",
            "Position": "FW",
            "Number": 1,
            "isCaptain": false,
            "Nickname": null
        },
        {
            "Name": "Sergio Batista",
            "Position": "MF",
            "Number": 2,
            "isCaptain": false,
            "Nickname": null
        },
        {
            "Name": "Ricardo Bochini",
            "Position": "MF",
            "Number": 3,
            "isCaptain": false,
            "Nickname": "El Bocha"
        },
        {
            "Name": "Claudio Borghi",
            "Position": "MF",
            "Number": 4,
            "isCaptain": false,
            "Nickname": "Bichi"
        },
        {
            "Name": "José Luis Brown",
            "Position": "DF",
            "Number": 5,
            "isCaptain": false,
            "Nickname": "Tata"
        },
        {
            "Name": "Daniel Passarella",
            "Position": "DF",
            "Number": 6,
            "isCaptain": false,
            "Nickname": "El Gran Capitán"
        },
        {
            "Name": "Jorge Burruchaga",
            "Position": "FW",
            "Number": 7,
            "isCaptain": false,
            "Nickname": "Burru"
        },
        {
            "Name": "Néstor Clausen",
            "Position": "DF",
            "Number": 8,
            "isCaptain": false,
            "Nickname": null
        },
        {
            "Name": "José Luis Cuciuffo",
            "Position": "DF",
            "Number": 9,
            "isCaptain": false,
            "Nickname": "El Cuchu"
        },
        {
            "Name": "Diego Maradona",
            "Position": "MF",
            "Number": 10,
            "isCaptain": true,
            "Nickname": "El Pibe de Oro"
        },
        {
            "Name": "Jorge Valdano",
            "Position": "FW",
            "Number": 11,
            "isCaptain": false,
            "Nickname": "The Philosopher of Football"
        },
        {
            "Name": "Héctor Enrique",
            "Position": "MF",
            "Number": 12,
            "isCaptain": false,
            "Nickname": "El Negro"
        },
        {
            "Name": "Oscar Garré",
            "Position": "DF",
            "Number": 13,
            "isCaptain": false,
            "Nickname": null
        },
        {
            "Name": "Ricardo Giusti",
            "Position": "MF",
            "Number": 14,
            "isCaptain": false,
            "Nickname": null
        },
        {
            "Name": "Luis Islas",
            "Position": "GK",
            "Number": 15,
            "isCaptain": false,
            "Nickname": "El loco"
        },
        {
            "Name": "Julio Olarticoechea",
            "Position": "DF",
            "Number": 16,
            "isCaptain": false,
            "Nickname": null
        },
        {
            "Name": "Pedro Pasculli",
            "Position": "FW",
            "Number": 17,
            "isCaptain": false,
            "Nickname": null
        },
        {
            "Name": "Nery Pumpido",
            "Position": "GK",
            "Number": 18,
            "isCaptain": false,
            "Nickname": null
        },
        {
            "Name": "Oscar Ruggeri",
            "Position": "DF",
            "Number": 19,
            "isCaptain": false,
            "Nickname": "El Cabezón"
        },
        {
            "Name": "Carlos Tapia",
            "Position": "MF",
            "Number": 20,
            "isCaptain": false,
            "Nickname": null
        },
        {
            "Name": "Marcelo Trobbiani",
            "Position": "MF",
            "Number": 21,
            "isCaptain": false,
            "Nickname": "Calesita"
        },
        {
            "Name": "Héctor Zelada",
            "Position": "GK",
            "Number": 22,
            "isCaptain": false,
            "Nickname": null
        }
    ]
}

@karuppiah7890
Copy link

karuppiah7890 commented Mar 23, 2019 via email

@QuincyLarson
Copy link
Contributor Author

@HKuz This looks great! Your concepts section is really well done and clear, and I think it sets the standard for how we discuss and organize these projects going forward.

Also, good job on coming up with the subject matter and deciding which attributes to use.

My only feedback would be to reduce the number of team members a bit so people don't have to type in quite so many. I think 5 would be enough repetition. That way, we can have separate tests for each line of the JSON without it getting to tedious. We probably do want to test every line or risk people getting upset about missing commas and quotation marks.

@HKuz
Copy link
Member

HKuz commented Mar 27, 2019

Thanks @QuincyLarson and @karuppiah7890! The concept outline was more to organize my thoughts to make sure the project covered all the points I thought the section needed to - if it's helpful to others to use a similar approach, that's awesome!

And I agree on the team members comment - sorry if it weren't clear, my intention with the entire data structure was to make the campers type the first few items and maybe 2 players (as you suggested), then provide the entire thing to them afterwards and have a few challenges accessing specific items or looping over the player array.

I'll take a look at the open PRs and start modeling these challenges off them. Onwards and upwards!

@QuincyLarson
Copy link
Contributor Author

@HKuz Ah - that clears things up. We definitely want repetition, but we don't want them to feel like they're working a data entry job 😉

I'm excited to see your PRs. Have a fun weekend, and happy coding! 👍

@QuincyLarson QuincyLarson changed the title Learn JSON by Building a Sports League Learn JSON by Building a Sports Team Apr 1, 2019
@julienawonga
Copy link

I would be interested in helping with this project.

@jdwilkin4
Copy link
Contributor

Hi @julien-aw !

Thank you for your interest in freeCodeCamp.

All of the project development has been moved in house by the fcc team.
If you are interested in contributing please look at our other repos with help wanted or good first issue labels.
https://github.com/freeCodeCamp/freeCodeCamp/issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Writing Test Descriptions
Development

No branches or pull requests

5 participants