Freecodecamp: Ambiguous Challenge Instructions

Created on 6 Jan 2017  路  10Comments  路  Source: freeCodeCamp/freeCodeCamp

Challenge Make Object Properties Private has an issue.

Please describe how to reproduce this issue, and include links to screenshots if possible.

Over the past couple days I've noticed a GH issue (#12385) and a few questions in the Javascript chat room about this challenge, all of which have all had to do with confusion about the purpose of the getGear and setGear functions. The challenge instructions explain private variables and private methods well, but doesn't explain the purpose of getters and setters.

I think adding a simple explanation of getters and setters without going too deep into encapsulation would benefit campers greatly. The new instructions would include something along these lines:

Getter functions such as getSpeed() are meant to simply return (get) the value of an object's private variable to the user without the user directly accessing the private variable.

Setter functions such as accelerate(change) are meant to modify (set) the value of an object's private variable based on the value passed into the setter function. This change could involve calculations, or even overwriting the previous value completely.

If people have other opinions on the current instructions or proposed changes, please share 馃槃

help wanted discussing

Most helpful comment

Since the challenge asks you to define getGear and setGear I think the explanation would be welcome. Yes it is a paradigm, but it is a pretty standard one.

I'm :+1: for a change to the instructions

All 10 comments

@robbawebba Thanks for the insight. Yep... I like the idea of more clarifications, but IMHO what you propose about getter and setter functions are more of a best practice/paradigm than just concept.

I am up for the change, but not really sure if this challenge's scope should be covering it or this should be a new challenge of itself.

/cc @FreeCodeCamp/moderators

Since the challenge asks you to define getGear and setGear I think the explanation would be welcome. Yes it is a paradigm, but it is a pretty standard one.

I'm :+1: for a change to the instructions

How about a one or two line introduction to Encapsulation? Along with private variables, it would serve as the basis for the need of getter and setter methods.

Does sound good. But again I am not convinced if all these should go into this challenge itself.

/cc @HKuz

@raisedadead I see what you mean about how encapsulation is more of a paradigm than a core concept of JavaScript, but I think that it ___does___ belong in this challenge because it is essentially already covering the "best practice" of encapsulation. It covers constructors for objects with private variables, and asks for campers to create public methods to access/modify the private variables (AKA encapsulation). So the challenge is already covering this topic but without explaining it fully. There's already sufficient explaination for constructors and private variables, but I think the discussion of setters and getters will help clear up any more confusion.

Thanks for flagging this for me, @raisedadead. So this challenge is in the current Object Oriented and Functional Programming section on FCC. Part of the curriculum expansion efforts created two new sections with new challenges (one for Objected Oriented Programming and one for Functional Programming) that will replace this one. The OOP section does cover encapsulation and private variables - if you're curious, you can check out the issue with the challenge list here. For getters and setters, the new ES6 section has a challenge specifically for the new get and set functions.

As for how to move forward - I really like how @robbawebba describes getter and setter up top. We can include it in the existing challenge, but know that ultimately, it'll be replaced once the curriculum expansion goes to production. I'd actually like to include those explanations in the ES6 challenge I linked to above. I think it would improve the challenge.

Of course, the timing to edit the new challenge right now is tough. The ES6 challenges are being pulled into the seed files this week as part of the big pull request to get the new challenges on the beta site. We may have to hang tight and wait for it to go live, then open an issue/PR to get that change in. In the meantime, I'll go edit the challenge on the issue, and we'll see if we beat Quincy's seeding efforts...

@robbawebba @HKuz thanks a lot for chiming in. From the way I see, if we do edit this challenge as you say it would be going into the same branch (staging) later.

So it's best as you say to let this wait and get this fixed in the curriculum expansion effort (even if this goes after an initial merge), as a second level pull request.

Count me in if you need help in anything, on merging it in.

@raisedadead @HKuz Sounds good for me! Thank you for the helpful information about the curriculum expansion - looking forward to it! I'd be happy to help if there's any way to get involved 馃檪

@robbawebba sure thing, follow the issues on the https://github.com/FreeCodeCamp/CurriculumExpansion repo and join the conversation in the Contributors Chat room.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jurijuri picture jurijuri  路  3Comments

SaintPeter picture SaintPeter  路  3Comments

vaibsharma picture vaibsharma  路  3Comments

DaphnisM picture DaphnisM  路  3Comments

bagrounds picture bagrounds  路  3Comments