Preventing Verbatim Answers that Match Examples?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
12
down vote

favorite












When teaching students (especially in code, but this can apply to any subject), how do you prevent near verbatim answers that match your examples?



For example, I tell students how to find a document by ID in an array of documents. I show them the code foundDocument = documentArray.find(singleDocument => singleDocument._id = id). I then ask students to find a fruit in fruitArray. The answer I'll get is foundDocument = fruitArray.find(singleDocument => singleDocument._id = id), which works, but not the ideal answer.



Some notes based on the content discussion and answers so far:



This is sort of for a project. I teach both one off weekend classes and long term coding mentorship and this comes up in both. The goal of the weekend class is to build a website by the end. The goal of the mentorship is for the singular student to have built an MVP of their product.



The array example above was the simplest and shortest example I could think of to demonstrate my issue. I also see this happen where whole files get copied and the students expects something different to happen.



What I'm hoping to prevent is the pattern matching that students sometimes do but they don't fully understand the why of what they are doing. I've also seen (and done this myself) often in the STEM fields. You find a formula that works and re apply it but not understand what you're doing.










share|improve this question



















  • 30




    What do you think the ideal answer is? If you gave me that example and that instruction I would produce exactly what you are bothered by getting. I would probably consider any other approach to be needless work.
    – Bryan Krause
    Sep 10 at 20:11










  • Hmmm. I think you need a lesson on "intention revealing names". I hope you emphasize that and make them practice it. Otherwise, copy, paste, fixup, is always the student's preferred strategy. Some professionals too, sad to say.
    – Buffy
    Sep 10 at 21:02






  • 28




    This sort of question works much better and will get more relevant answers if you post it instead at CSEducators: cseducators.stackexchange.com. That site is optimized for questions like this.
    – Buffy
    Sep 10 at 21:04






  • 5




    @merlinpatt: Before you ask on Computer Science Educators, note that copy-pasting of questions is frowned upon here (oh, the irony), but it’s usually okay to re-ask a question if you want a different perspective from another community for some reason, emphasise on this, and reference the previous incarnation of your question. I will not migrate the question (as requested by flags) as I do not consider it off-topic and several answers are not CS-specific.
    – Wrzlprmft♦
    Sep 11 at 5:53






  • 5




    I'm a programmer and I don't really understand what sort of answer you were expecting here. foundFruit = fruitArray.find(singleFruit => singleFruit._id = id)? x = fruitArray.find(y => y.z = z)? There's not really any room for variation other than changing variable names. (ignoring that that should be == in most languages)
    – immibis
    Sep 11 at 10:36















up vote
12
down vote

favorite












When teaching students (especially in code, but this can apply to any subject), how do you prevent near verbatim answers that match your examples?



For example, I tell students how to find a document by ID in an array of documents. I show them the code foundDocument = documentArray.find(singleDocument => singleDocument._id = id). I then ask students to find a fruit in fruitArray. The answer I'll get is foundDocument = fruitArray.find(singleDocument => singleDocument._id = id), which works, but not the ideal answer.



Some notes based on the content discussion and answers so far:



This is sort of for a project. I teach both one off weekend classes and long term coding mentorship and this comes up in both. The goal of the weekend class is to build a website by the end. The goal of the mentorship is for the singular student to have built an MVP of their product.



The array example above was the simplest and shortest example I could think of to demonstrate my issue. I also see this happen where whole files get copied and the students expects something different to happen.



What I'm hoping to prevent is the pattern matching that students sometimes do but they don't fully understand the why of what they are doing. I've also seen (and done this myself) often in the STEM fields. You find a formula that works and re apply it but not understand what you're doing.










share|improve this question



















  • 30




    What do you think the ideal answer is? If you gave me that example and that instruction I would produce exactly what you are bothered by getting. I would probably consider any other approach to be needless work.
    – Bryan Krause
    Sep 10 at 20:11










  • Hmmm. I think you need a lesson on "intention revealing names". I hope you emphasize that and make them practice it. Otherwise, copy, paste, fixup, is always the student's preferred strategy. Some professionals too, sad to say.
    – Buffy
    Sep 10 at 21:02






  • 28




    This sort of question works much better and will get more relevant answers if you post it instead at CSEducators: cseducators.stackexchange.com. That site is optimized for questions like this.
    – Buffy
    Sep 10 at 21:04






  • 5




    @merlinpatt: Before you ask on Computer Science Educators, note that copy-pasting of questions is frowned upon here (oh, the irony), but it’s usually okay to re-ask a question if you want a different perspective from another community for some reason, emphasise on this, and reference the previous incarnation of your question. I will not migrate the question (as requested by flags) as I do not consider it off-topic and several answers are not CS-specific.
    – Wrzlprmft♦
    Sep 11 at 5:53






  • 5




    I'm a programmer and I don't really understand what sort of answer you were expecting here. foundFruit = fruitArray.find(singleFruit => singleFruit._id = id)? x = fruitArray.find(y => y.z = z)? There's not really any room for variation other than changing variable names. (ignoring that that should be == in most languages)
    – immibis
    Sep 11 at 10:36













up vote
12
down vote

favorite









up vote
12
down vote

favorite











When teaching students (especially in code, but this can apply to any subject), how do you prevent near verbatim answers that match your examples?



For example, I tell students how to find a document by ID in an array of documents. I show them the code foundDocument = documentArray.find(singleDocument => singleDocument._id = id). I then ask students to find a fruit in fruitArray. The answer I'll get is foundDocument = fruitArray.find(singleDocument => singleDocument._id = id), which works, but not the ideal answer.



Some notes based on the content discussion and answers so far:



This is sort of for a project. I teach both one off weekend classes and long term coding mentorship and this comes up in both. The goal of the weekend class is to build a website by the end. The goal of the mentorship is for the singular student to have built an MVP of their product.



The array example above was the simplest and shortest example I could think of to demonstrate my issue. I also see this happen where whole files get copied and the students expects something different to happen.



What I'm hoping to prevent is the pattern matching that students sometimes do but they don't fully understand the why of what they are doing. I've also seen (and done this myself) often in the STEM fields. You find a formula that works and re apply it but not understand what you're doing.










share|improve this question















When teaching students (especially in code, but this can apply to any subject), how do you prevent near verbatim answers that match your examples?



For example, I tell students how to find a document by ID in an array of documents. I show them the code foundDocument = documentArray.find(singleDocument => singleDocument._id = id). I then ask students to find a fruit in fruitArray. The answer I'll get is foundDocument = fruitArray.find(singleDocument => singleDocument._id = id), which works, but not the ideal answer.



Some notes based on the content discussion and answers so far:



This is sort of for a project. I teach both one off weekend classes and long term coding mentorship and this comes up in both. The goal of the weekend class is to build a website by the end. The goal of the mentorship is for the singular student to have built an MVP of their product.



The array example above was the simplest and shortest example I could think of to demonstrate my issue. I also see this happen where whole files get copied and the students expects something different to happen.



What I'm hoping to prevent is the pattern matching that students sometimes do but they don't fully understand the why of what they are doing. I've also seen (and done this myself) often in the STEM fields. You find a formula that works and re apply it but not understand what you're doing.







teaching






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 11 at 13:34

























asked Sep 10 at 20:02









merlinpatt

16714




16714







  • 30




    What do you think the ideal answer is? If you gave me that example and that instruction I would produce exactly what you are bothered by getting. I would probably consider any other approach to be needless work.
    – Bryan Krause
    Sep 10 at 20:11










  • Hmmm. I think you need a lesson on "intention revealing names". I hope you emphasize that and make them practice it. Otherwise, copy, paste, fixup, is always the student's preferred strategy. Some professionals too, sad to say.
    – Buffy
    Sep 10 at 21:02






  • 28




    This sort of question works much better and will get more relevant answers if you post it instead at CSEducators: cseducators.stackexchange.com. That site is optimized for questions like this.
    – Buffy
    Sep 10 at 21:04






  • 5




    @merlinpatt: Before you ask on Computer Science Educators, note that copy-pasting of questions is frowned upon here (oh, the irony), but it’s usually okay to re-ask a question if you want a different perspective from another community for some reason, emphasise on this, and reference the previous incarnation of your question. I will not migrate the question (as requested by flags) as I do not consider it off-topic and several answers are not CS-specific.
    – Wrzlprmft♦
    Sep 11 at 5:53






  • 5




    I'm a programmer and I don't really understand what sort of answer you were expecting here. foundFruit = fruitArray.find(singleFruit => singleFruit._id = id)? x = fruitArray.find(y => y.z = z)? There's not really any room for variation other than changing variable names. (ignoring that that should be == in most languages)
    – immibis
    Sep 11 at 10:36













  • 30




    What do you think the ideal answer is? If you gave me that example and that instruction I would produce exactly what you are bothered by getting. I would probably consider any other approach to be needless work.
    – Bryan Krause
    Sep 10 at 20:11










  • Hmmm. I think you need a lesson on "intention revealing names". I hope you emphasize that and make them practice it. Otherwise, copy, paste, fixup, is always the student's preferred strategy. Some professionals too, sad to say.
    – Buffy
    Sep 10 at 21:02






  • 28




    This sort of question works much better and will get more relevant answers if you post it instead at CSEducators: cseducators.stackexchange.com. That site is optimized for questions like this.
    – Buffy
    Sep 10 at 21:04






  • 5




    @merlinpatt: Before you ask on Computer Science Educators, note that copy-pasting of questions is frowned upon here (oh, the irony), but it’s usually okay to re-ask a question if you want a different perspective from another community for some reason, emphasise on this, and reference the previous incarnation of your question. I will not migrate the question (as requested by flags) as I do not consider it off-topic and several answers are not CS-specific.
    – Wrzlprmft♦
    Sep 11 at 5:53






  • 5




    I'm a programmer and I don't really understand what sort of answer you were expecting here. foundFruit = fruitArray.find(singleFruit => singleFruit._id = id)? x = fruitArray.find(y => y.z = z)? There's not really any room for variation other than changing variable names. (ignoring that that should be == in most languages)
    – immibis
    Sep 11 at 10:36








30




30




What do you think the ideal answer is? If you gave me that example and that instruction I would produce exactly what you are bothered by getting. I would probably consider any other approach to be needless work.
– Bryan Krause
Sep 10 at 20:11




What do you think the ideal answer is? If you gave me that example and that instruction I would produce exactly what you are bothered by getting. I would probably consider any other approach to be needless work.
– Bryan Krause
Sep 10 at 20:11












Hmmm. I think you need a lesson on "intention revealing names". I hope you emphasize that and make them practice it. Otherwise, copy, paste, fixup, is always the student's preferred strategy. Some professionals too, sad to say.
– Buffy
Sep 10 at 21:02




Hmmm. I think you need a lesson on "intention revealing names". I hope you emphasize that and make them practice it. Otherwise, copy, paste, fixup, is always the student's preferred strategy. Some professionals too, sad to say.
– Buffy
Sep 10 at 21:02




28




28




This sort of question works much better and will get more relevant answers if you post it instead at CSEducators: cseducators.stackexchange.com. That site is optimized for questions like this.
– Buffy
Sep 10 at 21:04




This sort of question works much better and will get more relevant answers if you post it instead at CSEducators: cseducators.stackexchange.com. That site is optimized for questions like this.
– Buffy
Sep 10 at 21:04




5




5




@merlinpatt: Before you ask on Computer Science Educators, note that copy-pasting of questions is frowned upon here (oh, the irony), but it’s usually okay to re-ask a question if you want a different perspective from another community for some reason, emphasise on this, and reference the previous incarnation of your question. I will not migrate the question (as requested by flags) as I do not consider it off-topic and several answers are not CS-specific.
– Wrzlprmft♦
Sep 11 at 5:53




@merlinpatt: Before you ask on Computer Science Educators, note that copy-pasting of questions is frowned upon here (oh, the irony), but it’s usually okay to re-ask a question if you want a different perspective from another community for some reason, emphasise on this, and reference the previous incarnation of your question. I will not migrate the question (as requested by flags) as I do not consider it off-topic and several answers are not CS-specific.
– Wrzlprmft♦
Sep 11 at 5:53




5




5




I'm a programmer and I don't really understand what sort of answer you were expecting here. foundFruit = fruitArray.find(singleFruit => singleFruit._id = id)? x = fruitArray.find(y => y.z = z)? There's not really any room for variation other than changing variable names. (ignoring that that should be == in most languages)
– immibis
Sep 11 at 10:36





I'm a programmer and I don't really understand what sort of answer you were expecting here. foundFruit = fruitArray.find(singleFruit => singleFruit._id = id)? x = fruitArray.find(y => y.z = z)? There's not really any room for variation other than changing variable names. (ignoring that that should be == in most languages)
– immibis
Sep 11 at 10:36











6 Answers
6






active

oldest

votes

















up vote
82
down vote














When teaching students...how do you prevent near verbatim answers that match your examples?




I ask questions that cannot be answered correctly by near-verbatim matches of my examples.






share|improve this answer
















  • 3




    While generally a good idea, this answer doesn't entirely work for software engineering. The example given in the question demonstrates using a lambda to locate an element in an array based on a specific property. There isn't really a way to make a verbatim copy of the example not work; the example shows the correct syntax, so it'll work, that's just how the programming language functions.
    – anaximander
    Sep 11 at 14:19






  • 10




    @anaximander: In that case you ask a different simple question that requires understanding how lambdas and find works. Software engineering is not special in this regard.
    – BlueRaja - Danny Pflughoeft
    Sep 11 at 16:17







  • 6




    @anaximander I think in the given example it would help to at least use different properties (e.g. ask to find by name instead of id). Instead of such generic properties you could also use something more realistic (e.g. document.charCount, fruit.calories). Then you can make slightly more complex examples, like find all documents with more than X characters and ask for find all fruits with less than X calories in the hopes that at least some students notice that document.calories does not make much sense.
    – kapex
    Sep 11 at 18:31


















up vote
25
down vote













This answer is specific to the field of computer science, in keeping with the OP's question. Obviously the answer is much different if we were talking about a creative writing class or something.



In the field of computer science, there sometimes is a "best way" to do something. In your example, you are searching an array for a specified object. In most languages, array type objects have a find() function. This is the "best way" to access the array. I would actually consider it to be more wrong if a student used another approach to iterate over an array looking for a specific element.



I will touch on the nuance of using the identifier singleDocument in searching for a fruit in a fruit array. Perhaps this is what worries you? Yes, ideally a student should change singleDocument to something like singleFruit. Perhaps make a side comment to students in class about such practices, as it does indeed matter if we care about intelligible code. I would then leave it at that. Students who persist in using bad naming practices in their code usually end up getting themselves twisted up in longer projects and learn the folly of their ways.



I will add as an aside that when I first was learning to write computer code (Java), I sometimes made "mistakes" like the one you show (no identifier name change). This was due to the fact that I did not fully understand what could be changed in code and what could not be. I was more worried about finishing the project and less worried about writing really clean code. As I became more advanced, I quickly learned how to rectify issues such as changing identifier names to be more meaningful.






share|improve this answer
















  • 5




    Students who persist in using bad naming practices in their code usually end up getting themselves twisted up in longer projects and learn the folly of their ways. - Is this true? I don't teach a lot of coding, so maybe I don't see it, but it has not been my experience that "students usually learn the folly of their ways."
    – Kimball
    Sep 11 at 14:57






  • 2




    @Kimball This depends a lot on how far they go in the subject. In the case of CS, sure, you can have bad coding practices and finish the 150 line solutions in CS 101. But when you get to CS 201, 202, 203, etc. and have to produce projects of 1000+ lines and multiple classes, you either correct your ways or fail.
    – Vladhagen
    Sep 11 at 15:11






  • 5




    Re "bad naming practices": The length of a variable name should be directly proportional to the amount of code that can interact with it. In this case, the parameter is used exactly once, right next to its definition. It should be neither singleDocument nor singleFruit, but rather something short like x. Then you wouldn't have this copy & paste problem in the first place, because there would be nothing to change.
    – Kevin
    Sep 11 at 17:19










  • @Kimball - I'm not sure I agree with Vladhagen's comment that writing projects with longer chunks of code will break students of bad habits like inappropriate identifiers. In practice, most courses are short enough that if you can write your code int the first place, you may not be away from it long enough to forget what things mean, even with multiple courses. Maintaining code written a few months ago will do that. However, courses where you're programming as a team with other students can also do this, and is likely to happen in at least one course.
    – RDFozz
    Sep 12 at 18:01










  • @RDFozz At least in the CS classes I took, the upper division courses had projects that were 1) much too long to get away with bad naming conventions and 2) usually collaborative. There is obviously no way to force good naming conventions, but I found that very, very, very few people made it to the upper division CS course and still had bad naming conventions.
    – Vladhagen
    Sep 12 at 18:19

















up vote
5
down vote













It looks like the problem is correctness output vs clarity of code? In which case, a consistently used markscheme that gives/docks points for correct output and further points for correct use of variable names and any other relevant conventions would motivate students to pay attention to such issues, in the same way that eg English teachers give/dock points for grammar and spelling, math teachers for showing working, physics teachers for drawing diagrams...



If they are not first year students, you could also motivate the practice by asking them to bring along some code from previous years and getting them to edit/extend it. Or providing examples with the same functionality but different readability for them to alter.






share|improve this answer



























    up vote
    1
    down vote













    Why not do a multiple choice question “ which of the following will do x?” with one correct version and slight errors in the others - can even do partial marking depending on the error.



    I have this in excel functions like vlookup with a list that asks which version will return the name or price etc






    share|improve this answer



























      up vote
      1
      down vote













      If you are marking the students answers/project/exercises (that contain code), one trick is to leave 5% to code quality.



      This means clean comments, sensible variable names and no useless code. Its minor and unlikely to be the edge between fail and pass, but helps encourage good practice (and most of the times students realise that it is in fact easier for them to use good practices!)






      share|improve this answer



























        up vote
        -1
        down vote













        When tutoring my fellow students it is of utmost important that they understand the basic concept behind what they are doing or else they will just come again and ask me the next week. As far as I have experienced learning only really takes place if they figure out the solution on their own instead of copy pasting. This will take a lot more effort and time at the beginning but the payoff is well worth it.



        Depending on the age of your students you should point them to the documentation of a function/object and let them figure it out by themselves. If they want to program properly reading documentation is one of the most essential parts, if this is too hard (especially at the beginning) you can give them the method signature and an abstract explanation.



        Arrays.find(item => item.property == needle)

        haystack = ....
        item = ....
        needle = ...


        In this case they have to at least replace the variable names with matching names and abstract the assignment part. If lambdas are required make sure that you have covered them in an earlier example and reference it, in this case you can even keep the example more general






        share|improve this answer




















          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "415"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          noCode: true, onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2facademia.stackexchange.com%2fquestions%2f116685%2fpreventing-verbatim-answers-that-match-examples%23new-answer', 'question_page');

          );

          Post as a guest






























          6 Answers
          6






          active

          oldest

          votes








          6 Answers
          6






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          82
          down vote














          When teaching students...how do you prevent near verbatim answers that match your examples?




          I ask questions that cannot be answered correctly by near-verbatim matches of my examples.






          share|improve this answer
















          • 3




            While generally a good idea, this answer doesn't entirely work for software engineering. The example given in the question demonstrates using a lambda to locate an element in an array based on a specific property. There isn't really a way to make a verbatim copy of the example not work; the example shows the correct syntax, so it'll work, that's just how the programming language functions.
            – anaximander
            Sep 11 at 14:19






          • 10




            @anaximander: In that case you ask a different simple question that requires understanding how lambdas and find works. Software engineering is not special in this regard.
            – BlueRaja - Danny Pflughoeft
            Sep 11 at 16:17







          • 6




            @anaximander I think in the given example it would help to at least use different properties (e.g. ask to find by name instead of id). Instead of such generic properties you could also use something more realistic (e.g. document.charCount, fruit.calories). Then you can make slightly more complex examples, like find all documents with more than X characters and ask for find all fruits with less than X calories in the hopes that at least some students notice that document.calories does not make much sense.
            – kapex
            Sep 11 at 18:31















          up vote
          82
          down vote














          When teaching students...how do you prevent near verbatim answers that match your examples?




          I ask questions that cannot be answered correctly by near-verbatim matches of my examples.






          share|improve this answer
















          • 3




            While generally a good idea, this answer doesn't entirely work for software engineering. The example given in the question demonstrates using a lambda to locate an element in an array based on a specific property. There isn't really a way to make a verbatim copy of the example not work; the example shows the correct syntax, so it'll work, that's just how the programming language functions.
            – anaximander
            Sep 11 at 14:19






          • 10




            @anaximander: In that case you ask a different simple question that requires understanding how lambdas and find works. Software engineering is not special in this regard.
            – BlueRaja - Danny Pflughoeft
            Sep 11 at 16:17







          • 6




            @anaximander I think in the given example it would help to at least use different properties (e.g. ask to find by name instead of id). Instead of such generic properties you could also use something more realistic (e.g. document.charCount, fruit.calories). Then you can make slightly more complex examples, like find all documents with more than X characters and ask for find all fruits with less than X calories in the hopes that at least some students notice that document.calories does not make much sense.
            – kapex
            Sep 11 at 18:31













          up vote
          82
          down vote










          up vote
          82
          down vote










          When teaching students...how do you prevent near verbatim answers that match your examples?




          I ask questions that cannot be answered correctly by near-verbatim matches of my examples.






          share|improve this answer













          When teaching students...how do you prevent near verbatim answers that match your examples?




          I ask questions that cannot be answered correctly by near-verbatim matches of my examples.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Sep 11 at 0:25









          JeffE

          86.1k13199346




          86.1k13199346







          • 3




            While generally a good idea, this answer doesn't entirely work for software engineering. The example given in the question demonstrates using a lambda to locate an element in an array based on a specific property. There isn't really a way to make a verbatim copy of the example not work; the example shows the correct syntax, so it'll work, that's just how the programming language functions.
            – anaximander
            Sep 11 at 14:19






          • 10




            @anaximander: In that case you ask a different simple question that requires understanding how lambdas and find works. Software engineering is not special in this regard.
            – BlueRaja - Danny Pflughoeft
            Sep 11 at 16:17







          • 6




            @anaximander I think in the given example it would help to at least use different properties (e.g. ask to find by name instead of id). Instead of such generic properties you could also use something more realistic (e.g. document.charCount, fruit.calories). Then you can make slightly more complex examples, like find all documents with more than X characters and ask for find all fruits with less than X calories in the hopes that at least some students notice that document.calories does not make much sense.
            – kapex
            Sep 11 at 18:31













          • 3




            While generally a good idea, this answer doesn't entirely work for software engineering. The example given in the question demonstrates using a lambda to locate an element in an array based on a specific property. There isn't really a way to make a verbatim copy of the example not work; the example shows the correct syntax, so it'll work, that's just how the programming language functions.
            – anaximander
            Sep 11 at 14:19






          • 10




            @anaximander: In that case you ask a different simple question that requires understanding how lambdas and find works. Software engineering is not special in this regard.
            – BlueRaja - Danny Pflughoeft
            Sep 11 at 16:17







          • 6




            @anaximander I think in the given example it would help to at least use different properties (e.g. ask to find by name instead of id). Instead of such generic properties you could also use something more realistic (e.g. document.charCount, fruit.calories). Then you can make slightly more complex examples, like find all documents with more than X characters and ask for find all fruits with less than X calories in the hopes that at least some students notice that document.calories does not make much sense.
            – kapex
            Sep 11 at 18:31








          3




          3




          While generally a good idea, this answer doesn't entirely work for software engineering. The example given in the question demonstrates using a lambda to locate an element in an array based on a specific property. There isn't really a way to make a verbatim copy of the example not work; the example shows the correct syntax, so it'll work, that's just how the programming language functions.
          – anaximander
          Sep 11 at 14:19




          While generally a good idea, this answer doesn't entirely work for software engineering. The example given in the question demonstrates using a lambda to locate an element in an array based on a specific property. There isn't really a way to make a verbatim copy of the example not work; the example shows the correct syntax, so it'll work, that's just how the programming language functions.
          – anaximander
          Sep 11 at 14:19




          10




          10




          @anaximander: In that case you ask a different simple question that requires understanding how lambdas and find works. Software engineering is not special in this regard.
          – BlueRaja - Danny Pflughoeft
          Sep 11 at 16:17





          @anaximander: In that case you ask a different simple question that requires understanding how lambdas and find works. Software engineering is not special in this regard.
          – BlueRaja - Danny Pflughoeft
          Sep 11 at 16:17





          6




          6




          @anaximander I think in the given example it would help to at least use different properties (e.g. ask to find by name instead of id). Instead of such generic properties you could also use something more realistic (e.g. document.charCount, fruit.calories). Then you can make slightly more complex examples, like find all documents with more than X characters and ask for find all fruits with less than X calories in the hopes that at least some students notice that document.calories does not make much sense.
          – kapex
          Sep 11 at 18:31





          @anaximander I think in the given example it would help to at least use different properties (e.g. ask to find by name instead of id). Instead of such generic properties you could also use something more realistic (e.g. document.charCount, fruit.calories). Then you can make slightly more complex examples, like find all documents with more than X characters and ask for find all fruits with less than X calories in the hopes that at least some students notice that document.calories does not make much sense.
          – kapex
          Sep 11 at 18:31











          up vote
          25
          down vote













          This answer is specific to the field of computer science, in keeping with the OP's question. Obviously the answer is much different if we were talking about a creative writing class or something.



          In the field of computer science, there sometimes is a "best way" to do something. In your example, you are searching an array for a specified object. In most languages, array type objects have a find() function. This is the "best way" to access the array. I would actually consider it to be more wrong if a student used another approach to iterate over an array looking for a specific element.



          I will touch on the nuance of using the identifier singleDocument in searching for a fruit in a fruit array. Perhaps this is what worries you? Yes, ideally a student should change singleDocument to something like singleFruit. Perhaps make a side comment to students in class about such practices, as it does indeed matter if we care about intelligible code. I would then leave it at that. Students who persist in using bad naming practices in their code usually end up getting themselves twisted up in longer projects and learn the folly of their ways.



          I will add as an aside that when I first was learning to write computer code (Java), I sometimes made "mistakes" like the one you show (no identifier name change). This was due to the fact that I did not fully understand what could be changed in code and what could not be. I was more worried about finishing the project and less worried about writing really clean code. As I became more advanced, I quickly learned how to rectify issues such as changing identifier names to be more meaningful.






          share|improve this answer
















          • 5




            Students who persist in using bad naming practices in their code usually end up getting themselves twisted up in longer projects and learn the folly of their ways. - Is this true? I don't teach a lot of coding, so maybe I don't see it, but it has not been my experience that "students usually learn the folly of their ways."
            – Kimball
            Sep 11 at 14:57






          • 2




            @Kimball This depends a lot on how far they go in the subject. In the case of CS, sure, you can have bad coding practices and finish the 150 line solutions in CS 101. But when you get to CS 201, 202, 203, etc. and have to produce projects of 1000+ lines and multiple classes, you either correct your ways or fail.
            – Vladhagen
            Sep 11 at 15:11






          • 5




            Re "bad naming practices": The length of a variable name should be directly proportional to the amount of code that can interact with it. In this case, the parameter is used exactly once, right next to its definition. It should be neither singleDocument nor singleFruit, but rather something short like x. Then you wouldn't have this copy & paste problem in the first place, because there would be nothing to change.
            – Kevin
            Sep 11 at 17:19










          • @Kimball - I'm not sure I agree with Vladhagen's comment that writing projects with longer chunks of code will break students of bad habits like inappropriate identifiers. In practice, most courses are short enough that if you can write your code int the first place, you may not be away from it long enough to forget what things mean, even with multiple courses. Maintaining code written a few months ago will do that. However, courses where you're programming as a team with other students can also do this, and is likely to happen in at least one course.
            – RDFozz
            Sep 12 at 18:01










          • @RDFozz At least in the CS classes I took, the upper division courses had projects that were 1) much too long to get away with bad naming conventions and 2) usually collaborative. There is obviously no way to force good naming conventions, but I found that very, very, very few people made it to the upper division CS course and still had bad naming conventions.
            – Vladhagen
            Sep 12 at 18:19














          up vote
          25
          down vote













          This answer is specific to the field of computer science, in keeping with the OP's question. Obviously the answer is much different if we were talking about a creative writing class or something.



          In the field of computer science, there sometimes is a "best way" to do something. In your example, you are searching an array for a specified object. In most languages, array type objects have a find() function. This is the "best way" to access the array. I would actually consider it to be more wrong if a student used another approach to iterate over an array looking for a specific element.



          I will touch on the nuance of using the identifier singleDocument in searching for a fruit in a fruit array. Perhaps this is what worries you? Yes, ideally a student should change singleDocument to something like singleFruit. Perhaps make a side comment to students in class about such practices, as it does indeed matter if we care about intelligible code. I would then leave it at that. Students who persist in using bad naming practices in their code usually end up getting themselves twisted up in longer projects and learn the folly of their ways.



          I will add as an aside that when I first was learning to write computer code (Java), I sometimes made "mistakes" like the one you show (no identifier name change). This was due to the fact that I did not fully understand what could be changed in code and what could not be. I was more worried about finishing the project and less worried about writing really clean code. As I became more advanced, I quickly learned how to rectify issues such as changing identifier names to be more meaningful.






          share|improve this answer
















          • 5




            Students who persist in using bad naming practices in their code usually end up getting themselves twisted up in longer projects and learn the folly of their ways. - Is this true? I don't teach a lot of coding, so maybe I don't see it, but it has not been my experience that "students usually learn the folly of their ways."
            – Kimball
            Sep 11 at 14:57






          • 2




            @Kimball This depends a lot on how far they go in the subject. In the case of CS, sure, you can have bad coding practices and finish the 150 line solutions in CS 101. But when you get to CS 201, 202, 203, etc. and have to produce projects of 1000+ lines and multiple classes, you either correct your ways or fail.
            – Vladhagen
            Sep 11 at 15:11






          • 5




            Re "bad naming practices": The length of a variable name should be directly proportional to the amount of code that can interact with it. In this case, the parameter is used exactly once, right next to its definition. It should be neither singleDocument nor singleFruit, but rather something short like x. Then you wouldn't have this copy & paste problem in the first place, because there would be nothing to change.
            – Kevin
            Sep 11 at 17:19










          • @Kimball - I'm not sure I agree with Vladhagen's comment that writing projects with longer chunks of code will break students of bad habits like inappropriate identifiers. In practice, most courses are short enough that if you can write your code int the first place, you may not be away from it long enough to forget what things mean, even with multiple courses. Maintaining code written a few months ago will do that. However, courses where you're programming as a team with other students can also do this, and is likely to happen in at least one course.
            – RDFozz
            Sep 12 at 18:01










          • @RDFozz At least in the CS classes I took, the upper division courses had projects that were 1) much too long to get away with bad naming conventions and 2) usually collaborative. There is obviously no way to force good naming conventions, but I found that very, very, very few people made it to the upper division CS course and still had bad naming conventions.
            – Vladhagen
            Sep 12 at 18:19












          up vote
          25
          down vote










          up vote
          25
          down vote









          This answer is specific to the field of computer science, in keeping with the OP's question. Obviously the answer is much different if we were talking about a creative writing class or something.



          In the field of computer science, there sometimes is a "best way" to do something. In your example, you are searching an array for a specified object. In most languages, array type objects have a find() function. This is the "best way" to access the array. I would actually consider it to be more wrong if a student used another approach to iterate over an array looking for a specific element.



          I will touch on the nuance of using the identifier singleDocument in searching for a fruit in a fruit array. Perhaps this is what worries you? Yes, ideally a student should change singleDocument to something like singleFruit. Perhaps make a side comment to students in class about such practices, as it does indeed matter if we care about intelligible code. I would then leave it at that. Students who persist in using bad naming practices in their code usually end up getting themselves twisted up in longer projects and learn the folly of their ways.



          I will add as an aside that when I first was learning to write computer code (Java), I sometimes made "mistakes" like the one you show (no identifier name change). This was due to the fact that I did not fully understand what could be changed in code and what could not be. I was more worried about finishing the project and less worried about writing really clean code. As I became more advanced, I quickly learned how to rectify issues such as changing identifier names to be more meaningful.






          share|improve this answer












          This answer is specific to the field of computer science, in keeping with the OP's question. Obviously the answer is much different if we were talking about a creative writing class or something.



          In the field of computer science, there sometimes is a "best way" to do something. In your example, you are searching an array for a specified object. In most languages, array type objects have a find() function. This is the "best way" to access the array. I would actually consider it to be more wrong if a student used another approach to iterate over an array looking for a specific element.



          I will touch on the nuance of using the identifier singleDocument in searching for a fruit in a fruit array. Perhaps this is what worries you? Yes, ideally a student should change singleDocument to something like singleFruit. Perhaps make a side comment to students in class about such practices, as it does indeed matter if we care about intelligible code. I would then leave it at that. Students who persist in using bad naming practices in their code usually end up getting themselves twisted up in longer projects and learn the folly of their ways.



          I will add as an aside that when I first was learning to write computer code (Java), I sometimes made "mistakes" like the one you show (no identifier name change). This was due to the fact that I did not fully understand what could be changed in code and what could not be. I was more worried about finishing the project and less worried about writing really clean code. As I became more advanced, I quickly learned how to rectify issues such as changing identifier names to be more meaningful.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Sep 10 at 20:29









          Vladhagen

          4,20611737




          4,20611737







          • 5




            Students who persist in using bad naming practices in their code usually end up getting themselves twisted up in longer projects and learn the folly of their ways. - Is this true? I don't teach a lot of coding, so maybe I don't see it, but it has not been my experience that "students usually learn the folly of their ways."
            – Kimball
            Sep 11 at 14:57






          • 2




            @Kimball This depends a lot on how far they go in the subject. In the case of CS, sure, you can have bad coding practices and finish the 150 line solutions in CS 101. But when you get to CS 201, 202, 203, etc. and have to produce projects of 1000+ lines and multiple classes, you either correct your ways or fail.
            – Vladhagen
            Sep 11 at 15:11






          • 5




            Re "bad naming practices": The length of a variable name should be directly proportional to the amount of code that can interact with it. In this case, the parameter is used exactly once, right next to its definition. It should be neither singleDocument nor singleFruit, but rather something short like x. Then you wouldn't have this copy & paste problem in the first place, because there would be nothing to change.
            – Kevin
            Sep 11 at 17:19










          • @Kimball - I'm not sure I agree with Vladhagen's comment that writing projects with longer chunks of code will break students of bad habits like inappropriate identifiers. In practice, most courses are short enough that if you can write your code int the first place, you may not be away from it long enough to forget what things mean, even with multiple courses. Maintaining code written a few months ago will do that. However, courses where you're programming as a team with other students can also do this, and is likely to happen in at least one course.
            – RDFozz
            Sep 12 at 18:01










          • @RDFozz At least in the CS classes I took, the upper division courses had projects that were 1) much too long to get away with bad naming conventions and 2) usually collaborative. There is obviously no way to force good naming conventions, but I found that very, very, very few people made it to the upper division CS course and still had bad naming conventions.
            – Vladhagen
            Sep 12 at 18:19












          • 5




            Students who persist in using bad naming practices in their code usually end up getting themselves twisted up in longer projects and learn the folly of their ways. - Is this true? I don't teach a lot of coding, so maybe I don't see it, but it has not been my experience that "students usually learn the folly of their ways."
            – Kimball
            Sep 11 at 14:57






          • 2




            @Kimball This depends a lot on how far they go in the subject. In the case of CS, sure, you can have bad coding practices and finish the 150 line solutions in CS 101. But when you get to CS 201, 202, 203, etc. and have to produce projects of 1000+ lines and multiple classes, you either correct your ways or fail.
            – Vladhagen
            Sep 11 at 15:11






          • 5




            Re "bad naming practices": The length of a variable name should be directly proportional to the amount of code that can interact with it. In this case, the parameter is used exactly once, right next to its definition. It should be neither singleDocument nor singleFruit, but rather something short like x. Then you wouldn't have this copy & paste problem in the first place, because there would be nothing to change.
            – Kevin
            Sep 11 at 17:19










          • @Kimball - I'm not sure I agree with Vladhagen's comment that writing projects with longer chunks of code will break students of bad habits like inappropriate identifiers. In practice, most courses are short enough that if you can write your code int the first place, you may not be away from it long enough to forget what things mean, even with multiple courses. Maintaining code written a few months ago will do that. However, courses where you're programming as a team with other students can also do this, and is likely to happen in at least one course.
            – RDFozz
            Sep 12 at 18:01










          • @RDFozz At least in the CS classes I took, the upper division courses had projects that were 1) much too long to get away with bad naming conventions and 2) usually collaborative. There is obviously no way to force good naming conventions, but I found that very, very, very few people made it to the upper division CS course and still had bad naming conventions.
            – Vladhagen
            Sep 12 at 18:19







          5




          5




          Students who persist in using bad naming practices in their code usually end up getting themselves twisted up in longer projects and learn the folly of their ways. - Is this true? I don't teach a lot of coding, so maybe I don't see it, but it has not been my experience that "students usually learn the folly of their ways."
          – Kimball
          Sep 11 at 14:57




          Students who persist in using bad naming practices in their code usually end up getting themselves twisted up in longer projects and learn the folly of their ways. - Is this true? I don't teach a lot of coding, so maybe I don't see it, but it has not been my experience that "students usually learn the folly of their ways."
          – Kimball
          Sep 11 at 14:57




          2




          2




          @Kimball This depends a lot on how far they go in the subject. In the case of CS, sure, you can have bad coding practices and finish the 150 line solutions in CS 101. But when you get to CS 201, 202, 203, etc. and have to produce projects of 1000+ lines and multiple classes, you either correct your ways or fail.
          – Vladhagen
          Sep 11 at 15:11




          @Kimball This depends a lot on how far they go in the subject. In the case of CS, sure, you can have bad coding practices and finish the 150 line solutions in CS 101. But when you get to CS 201, 202, 203, etc. and have to produce projects of 1000+ lines and multiple classes, you either correct your ways or fail.
          – Vladhagen
          Sep 11 at 15:11




          5




          5




          Re "bad naming practices": The length of a variable name should be directly proportional to the amount of code that can interact with it. In this case, the parameter is used exactly once, right next to its definition. It should be neither singleDocument nor singleFruit, but rather something short like x. Then you wouldn't have this copy & paste problem in the first place, because there would be nothing to change.
          – Kevin
          Sep 11 at 17:19




          Re "bad naming practices": The length of a variable name should be directly proportional to the amount of code that can interact with it. In this case, the parameter is used exactly once, right next to its definition. It should be neither singleDocument nor singleFruit, but rather something short like x. Then you wouldn't have this copy & paste problem in the first place, because there would be nothing to change.
          – Kevin
          Sep 11 at 17:19












          @Kimball - I'm not sure I agree with Vladhagen's comment that writing projects with longer chunks of code will break students of bad habits like inappropriate identifiers. In practice, most courses are short enough that if you can write your code int the first place, you may not be away from it long enough to forget what things mean, even with multiple courses. Maintaining code written a few months ago will do that. However, courses where you're programming as a team with other students can also do this, and is likely to happen in at least one course.
          – RDFozz
          Sep 12 at 18:01




          @Kimball - I'm not sure I agree with Vladhagen's comment that writing projects with longer chunks of code will break students of bad habits like inappropriate identifiers. In practice, most courses are short enough that if you can write your code int the first place, you may not be away from it long enough to forget what things mean, even with multiple courses. Maintaining code written a few months ago will do that. However, courses where you're programming as a team with other students can also do this, and is likely to happen in at least one course.
          – RDFozz
          Sep 12 at 18:01












          @RDFozz At least in the CS classes I took, the upper division courses had projects that were 1) much too long to get away with bad naming conventions and 2) usually collaborative. There is obviously no way to force good naming conventions, but I found that very, very, very few people made it to the upper division CS course and still had bad naming conventions.
          – Vladhagen
          Sep 12 at 18:19




          @RDFozz At least in the CS classes I took, the upper division courses had projects that were 1) much too long to get away with bad naming conventions and 2) usually collaborative. There is obviously no way to force good naming conventions, but I found that very, very, very few people made it to the upper division CS course and still had bad naming conventions.
          – Vladhagen
          Sep 12 at 18:19










          up vote
          5
          down vote













          It looks like the problem is correctness output vs clarity of code? In which case, a consistently used markscheme that gives/docks points for correct output and further points for correct use of variable names and any other relevant conventions would motivate students to pay attention to such issues, in the same way that eg English teachers give/dock points for grammar and spelling, math teachers for showing working, physics teachers for drawing diagrams...



          If they are not first year students, you could also motivate the practice by asking them to bring along some code from previous years and getting them to edit/extend it. Or providing examples with the same functionality but different readability for them to alter.






          share|improve this answer
























            up vote
            5
            down vote













            It looks like the problem is correctness output vs clarity of code? In which case, a consistently used markscheme that gives/docks points for correct output and further points for correct use of variable names and any other relevant conventions would motivate students to pay attention to such issues, in the same way that eg English teachers give/dock points for grammar and spelling, math teachers for showing working, physics teachers for drawing diagrams...



            If they are not first year students, you could also motivate the practice by asking them to bring along some code from previous years and getting them to edit/extend it. Or providing examples with the same functionality but different readability for them to alter.






            share|improve this answer






















              up vote
              5
              down vote










              up vote
              5
              down vote









              It looks like the problem is correctness output vs clarity of code? In which case, a consistently used markscheme that gives/docks points for correct output and further points for correct use of variable names and any other relevant conventions would motivate students to pay attention to such issues, in the same way that eg English teachers give/dock points for grammar and spelling, math teachers for showing working, physics teachers for drawing diagrams...



              If they are not first year students, you could also motivate the practice by asking them to bring along some code from previous years and getting them to edit/extend it. Or providing examples with the same functionality but different readability for them to alter.






              share|improve this answer












              It looks like the problem is correctness output vs clarity of code? In which case, a consistently used markscheme that gives/docks points for correct output and further points for correct use of variable names and any other relevant conventions would motivate students to pay attention to such issues, in the same way that eg English teachers give/dock points for grammar and spelling, math teachers for showing working, physics teachers for drawing diagrams...



              If they are not first year students, you could also motivate the practice by asking them to bring along some code from previous years and getting them to edit/extend it. Or providing examples with the same functionality but different readability for them to alter.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Sep 11 at 11:55









              Rosemary7391

              3106




              3106




















                  up vote
                  1
                  down vote













                  Why not do a multiple choice question “ which of the following will do x?” with one correct version and slight errors in the others - can even do partial marking depending on the error.



                  I have this in excel functions like vlookup with a list that asks which version will return the name or price etc






                  share|improve this answer
























                    up vote
                    1
                    down vote













                    Why not do a multiple choice question “ which of the following will do x?” with one correct version and slight errors in the others - can even do partial marking depending on the error.



                    I have this in excel functions like vlookup with a list that asks which version will return the name or price etc






                    share|improve this answer






















                      up vote
                      1
                      down vote










                      up vote
                      1
                      down vote









                      Why not do a multiple choice question “ which of the following will do x?” with one correct version and slight errors in the others - can even do partial marking depending on the error.



                      I have this in excel functions like vlookup with a list that asks which version will return the name or price etc






                      share|improve this answer












                      Why not do a multiple choice question “ which of the following will do x?” with one correct version and slight errors in the others - can even do partial marking depending on the error.



                      I have this in excel functions like vlookup with a list that asks which version will return the name or price etc







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Sep 10 at 20:24









                      Solar Mike

                      8,93632038




                      8,93632038




















                          up vote
                          1
                          down vote













                          If you are marking the students answers/project/exercises (that contain code), one trick is to leave 5% to code quality.



                          This means clean comments, sensible variable names and no useless code. Its minor and unlikely to be the edge between fail and pass, but helps encourage good practice (and most of the times students realise that it is in fact easier for them to use good practices!)






                          share|improve this answer
























                            up vote
                            1
                            down vote













                            If you are marking the students answers/project/exercises (that contain code), one trick is to leave 5% to code quality.



                            This means clean comments, sensible variable names and no useless code. Its minor and unlikely to be the edge between fail and pass, but helps encourage good practice (and most of the times students realise that it is in fact easier for them to use good practices!)






                            share|improve this answer






















                              up vote
                              1
                              down vote










                              up vote
                              1
                              down vote









                              If you are marking the students answers/project/exercises (that contain code), one trick is to leave 5% to code quality.



                              This means clean comments, sensible variable names and no useless code. Its minor and unlikely to be the edge between fail and pass, but helps encourage good practice (and most of the times students realise that it is in fact easier for them to use good practices!)






                              share|improve this answer












                              If you are marking the students answers/project/exercises (that contain code), one trick is to leave 5% to code quality.



                              This means clean comments, sensible variable names and no useless code. Its minor and unlikely to be the edge between fail and pass, but helps encourage good practice (and most of the times students realise that it is in fact easier for them to use good practices!)







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Sep 11 at 14:50









                              Ander Biguri

                              3,78411528




                              3,78411528




















                                  up vote
                                  -1
                                  down vote













                                  When tutoring my fellow students it is of utmost important that they understand the basic concept behind what they are doing or else they will just come again and ask me the next week. As far as I have experienced learning only really takes place if they figure out the solution on their own instead of copy pasting. This will take a lot more effort and time at the beginning but the payoff is well worth it.



                                  Depending on the age of your students you should point them to the documentation of a function/object and let them figure it out by themselves. If they want to program properly reading documentation is one of the most essential parts, if this is too hard (especially at the beginning) you can give them the method signature and an abstract explanation.



                                  Arrays.find(item => item.property == needle)

                                  haystack = ....
                                  item = ....
                                  needle = ...


                                  In this case they have to at least replace the variable names with matching names and abstract the assignment part. If lambdas are required make sure that you have covered them in an earlier example and reference it, in this case you can even keep the example more general






                                  share|improve this answer
























                                    up vote
                                    -1
                                    down vote













                                    When tutoring my fellow students it is of utmost important that they understand the basic concept behind what they are doing or else they will just come again and ask me the next week. As far as I have experienced learning only really takes place if they figure out the solution on their own instead of copy pasting. This will take a lot more effort and time at the beginning but the payoff is well worth it.



                                    Depending on the age of your students you should point them to the documentation of a function/object and let them figure it out by themselves. If they want to program properly reading documentation is one of the most essential parts, if this is too hard (especially at the beginning) you can give them the method signature and an abstract explanation.



                                    Arrays.find(item => item.property == needle)

                                    haystack = ....
                                    item = ....
                                    needle = ...


                                    In this case they have to at least replace the variable names with matching names and abstract the assignment part. If lambdas are required make sure that you have covered them in an earlier example and reference it, in this case you can even keep the example more general






                                    share|improve this answer






















                                      up vote
                                      -1
                                      down vote










                                      up vote
                                      -1
                                      down vote









                                      When tutoring my fellow students it is of utmost important that they understand the basic concept behind what they are doing or else they will just come again and ask me the next week. As far as I have experienced learning only really takes place if they figure out the solution on their own instead of copy pasting. This will take a lot more effort and time at the beginning but the payoff is well worth it.



                                      Depending on the age of your students you should point them to the documentation of a function/object and let them figure it out by themselves. If they want to program properly reading documentation is one of the most essential parts, if this is too hard (especially at the beginning) you can give them the method signature and an abstract explanation.



                                      Arrays.find(item => item.property == needle)

                                      haystack = ....
                                      item = ....
                                      needle = ...


                                      In this case they have to at least replace the variable names with matching names and abstract the assignment part. If lambdas are required make sure that you have covered them in an earlier example and reference it, in this case you can even keep the example more general






                                      share|improve this answer












                                      When tutoring my fellow students it is of utmost important that they understand the basic concept behind what they are doing or else they will just come again and ask me the next week. As far as I have experienced learning only really takes place if they figure out the solution on their own instead of copy pasting. This will take a lot more effort and time at the beginning but the payoff is well worth it.



                                      Depending on the age of your students you should point them to the documentation of a function/object and let them figure it out by themselves. If they want to program properly reading documentation is one of the most essential parts, if this is too hard (especially at the beginning) you can give them the method signature and an abstract explanation.



                                      Arrays.find(item => item.property == needle)

                                      haystack = ....
                                      item = ....
                                      needle = ...


                                      In this case they have to at least replace the variable names with matching names and abstract the assignment part. If lambdas are required make sure that you have covered them in an earlier example and reference it, in this case you can even keep the example more general







                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Sep 12 at 8:37









                                      Kilian

                                      101




                                      101



























                                           

                                          draft saved


                                          draft discarded















































                                           


                                          draft saved


                                          draft discarded














                                          StackExchange.ready(
                                          function ()
                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2facademia.stackexchange.com%2fquestions%2f116685%2fpreventing-verbatim-answers-that-match-examples%23new-answer', 'question_page');

                                          );

                                          Post as a guest













































































                                          Popular posts from this blog

                                          How to check contact read email or not when send email to Individual?

                                          Displaying single band from multi-band raster using QGIS

                                          How many registers does an x86_64 CPU actually have?