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

Decide on JSON schema #6

Open
Bishwin opened this issue Sep 16, 2018 · 4 comments
Open

Decide on JSON schema #6

Bishwin opened this issue Sep 16, 2018 · 4 comments

Comments

@Bishwin
Copy link
Contributor

Bishwin commented Sep 16, 2018

json schema for knowledge entries

@Stivaros
Copy link
Contributor

{
    "title": "String Keep your code DRY",
    "desc": "String Two or three sentences explaining the title",
    "code": "String Code example, escaped as JSON",
    "pros": [
        "String - Bullet Point",
        "String - Another BP",
        "String - Final BP"
    ],
    "cons": [
        "String - Negative BP",
        "String - Another BP",
        "String - Final NP"
    ],
    "tags": [
        "String - First tag is the primary tag and is very important",
        "***Strings - As many tags as relevant, ideally as one or two words each"
    ],
    "upvote": 42,
    "downvote": 2,
    "references": [
        "String - http://www.google.com",
        "String - http://google.com"
    ]
}

@Bishwin
Copy link
Contributor Author

Bishwin commented Sep 18, 2018

we have suggested links on the side in the mock, should we add tags/category section?

@Stivaros
Copy link
Contributor

The links on the side of the mock are the tags, I fluffed up n forgot the references. I'll see if I can update the wireframe.

@Stivaros
Copy link
Contributor

        [params.tipId]: {
          title: "Keep your code DRY",
          desc: "DRY: \"Don't Repeat Yourself\"." +
            "DRY is a software principle which aims to prevent you writing code more than once. " +
            "Instead of writing code twice, place it in a class or method that can be called when necessary.",
          code: `// BAD:
                 function differenceInTemperature(locationOneInFahrenheit, locationTwoInFahrenheit) {
                     // We're repeating the algorithm twice
                     locationOneInCelsius = locationOneInFahrenheit * 9 / 5 + 32;
                     locationTwoInCelsius = locationTwoInFahrenheit * 9 / 5 + 32;
                    
                     return locationOneInCelsius - locationOneInCelsius;
                  }
                  
                  // DRY:
                  function convertToCelsius(temperature) {
                      // The algorithm is in one place
                      return temperature * 9 / 5 + 32;
                  }
                  
                  function differenceInTemperature(locationOneInFahrenheit, locationTwoInFahrenheit) {
                      // We call it twice, as needed
                      return convertToCelsius(locationOneInFahrenheit) - convertToCelsius(locationOneInFahrenheit);
                  }
                `,
          pros: [
            "It is easier to identify and maintain code (as it only exists once)",
            "Code becomes easier to read, provided you use good variable and function names",
            "It is quicker to code something once and refer to it when necessary than rewrite code the same code"
          ],
          cons: [
            "It can take a while to get used to writing DRY code",
            "Attempting to DRY up code that is similar but functionally different is an easy, time-consuming, mistake",
            "DRY code can end up in multiple files, classes and methods and can take a while to find and understand"
          ],
          tags: [
            "Software Principles",
            "Refactoring",
            "OOP"
          ],
          upvotes: 1,
          downvotes: 1,
          references: [
            "https://en.wikipedia.org/wiki/Don%27t_repeat_yourself",
            "https://www.codementor.io/joshuaaroke/dry-code-vs-wet-code-89xjwv11w"
          ]
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants