Answers.Body: <p>I don't actually think it is necessary to show the differences (or the similarities). Treat Java as a new thing rather than trying to connect the new thing to the old (for these students only). Instead teach Java as a stand alone complete language. My preference would be to teach it from a high level rather than a low level, stressing abstractions via classes and (for you) the interfaces defining the data structures. </p>
  
  <p>There is no reason in a Java course to discuss pointers or the preprocessor. Objects are "referred to" by reference variables, not "pointed to" by pointers. Learn and use the Java vocabulary for things. Once sends a message to an object, not "calls" a method. </p>
  
  <p>In this way, your C students have a leg up on syntax, and the places where the "look of the language" helps them without getting into, likely only partially correct, analogies that may confuse them. </p>
  
  <p>Work on the big ideas, encapsulation, abstraction, information management (hiding), polymorphism, etc, not the (possible, but likely not completely correct) explanation of the implementation. Treat a variable as a reference, not a "box". An object is a thing. The thing responds to messages, just like people do. Use Java analogies, not C based or assembly based analogies. There is no need of the higher to lower mapping. It will confuse some of your students. It buys you nothing. It may be the way you learned, but it is not optimal. </p>
  
  <p>The purpose of a compiler for a high level language is to make it unnecessary to consider the mapping to the machine. Too many people forget that and try to teach as if that mapping is essential to understand to use the language. For them, computing is always and only about moving bits. They have learned nothing since 1955. Learn the language, learn the abstractions. Fly, don't crawl. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-11-06T13:02:53.730Z
Answers.Text: Since it's the purpose of Java to abstract those kind of things, it is just better to stress it out to the students : "different language for different purposes".
Answers.UserDisplayName: Walfrat
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-11-05T21:21:40.920Z
Answers.LastActivityDate: 2017-11-05T21:21:40.920Z
Answers.UserDisplayName: Buffy
Answers.Body: <p>I agree wholeheartedly with @buffy. However there are some things that could be of use. </p>
  
  <p>Explain that C is a bottom up language, that its philosophy starts at the machine. Java is, to some extent, a top down language. Its philosophy starts at the human.</p>
  
  <p>I have worked with students that show me their code, and it is covered with <code>static</code>. They tell me that they have tried to remove the <code>static</code>s but get errors. (This is because a static method can not use non-static methods/data.) This traps them in the non-OO world.</p>
  
  <p>Therefore write the OO bootstrap code for them. Start with OO, don't do anything that is not OO (except the OO bootstrap).</p>
  
  <pre><code>public static void main (String [ ] args) {
      new Program().run(args);
  }
  </code></pre>
  
  <p>The following would especially confuse those that have not done C, so don't tell the whole class.</p>
  
  <ul>
  <li>Java has no pre-processor.</li>
  <li>Java references are like C pointers, but can only point to a valid object or null. see also <a href="https://ctrlaltdelor.wordpress.com/2009/08/10/types-of-reference/" rel="nofollow noreferrer">https://ctrlaltdelor.wordpress.com/2009/08/10/types-of-reference/</a></li>
  <li>Java has this extra stuff, to support object orientation.</li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-11-06T10:44:05.203Z
Answers.LastActivityDate: 2017-11-06T19:51:04.813Z
Answers.LastEditDate: 2017-11-06T19:51:04.813Z
Answers.UserDisplayName: ctrl-alt-delor
Body: <p>The class I teach (a class whose teacher I assist<sup>1</sup>, to be precise) is learning intermediate Java this year (data structures, basic OOP and a few lessons about how Java actually works).</p>
  
  <p>A few of the students have some familiarity with C and it would seem as though this makes some points or subjects difficult for them to understand (such as preprocessor, explicit pointers etc.).</p>
  
  <p>This raises the issue of helping these students overcome the differences between a C mindset and a Java one. It was proven time and again that simply saying "That's just how Java works" is not enough (and frankly not very helpful).</p>
  
  <p>So I'm looking for explanations (or analogies or examples) that might help students see the differences between the two mindsets in a clearer way.  </p>
  
  <p>Which points must be present in such an analogy, to properly show the main differences between the two?</p>
  
  <hr>
  
  <p><sup>1</sup> I'm a teacher assistant in a high school.</p>
  
Tags: <teaching-analogy><java><c>
Title: Teaching intermediate Java to students familiar with C
ThreadText: # Teaching intermediate Java to students familiar with C
  
  (Asked by: username_0 on 2017-11-05)
  
  The class I teach (a class whose teacher I assist1, to be precise) is learning intermediate Java this year (data structures, basic OOP and a few lessons about how Java actually works).
  
  A few of the students have some familiarity with C and it would seem as though this makes some points or subjects difficult for them to understand (such as preprocessor, explicit pointers etc.).
  
  This raises the issue of helping these students overcome the differences between a C mindset and a Java one. It was proven time and again that simply saying "That's just how Java works" is not enough (and frankly not very helpful).
  
  So I'm looking for explanations (or analogies or examples) that might help students see the differences between the two mindsets in a clearer way.
  
  Which points must be present in such an analogy, to properly show the main differences between the two?
  
  ---
  
  1 I'm a teacher assistant in a high school.
  
  **Tags:** teaching-analogy, java, c
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2017-11-05. Score: 2
  
  I don't actually think it is necessary to show the differences (or the similarities). Treat Java as a new thing rather than trying to connect the new thing to the old (for these students only). Instead teach Java as a stand alone complete language. My preference would be to teach it from a high level rather than a low level, stressing abstractions via classes and (for you) the interfaces defining the data structures.
  
  There is no reason in a Java course to discuss pointers or the preprocessor. Objects are "referred to" by reference variables, not "pointed to" by pointers. Learn and use the Java vocabulary for things. Once sends a message to an object, not "calls" a method.
  
  In this way, your C students have a leg up on syntax, and the places where the "look of the language" helps them without getting into, likely only partially correct, analogies that may confuse them.
  
  Work on the big ideas, encapsulation, abstraction, information management (hiding), polymorphism, etc, not the (possible, but likely not completely correct) explanation of the implementation. Treat a variable as a reference, not a "box". An object is a thing. The thing responds to messages, just like people do. Use Java analogies, not C based or assembly based analogies. There is no need of the higher to lower mapping. It will confuse some of your students. It buys you nothing. It may be the way you learned, but it is not optimal.
  
  The purpose of a compiler for a high level language is to make it unnecessary to consider the mapping to the machine. Too many people forget that and try to teach as if that mapping is essential to understand to use the language. For them, computing is always and only about moving bits. They have learned nothing since 1955. Learn the language, learn the abstractions. Fly, don't crawl.
  
  > **Comments:**
  > **username_2**: Since it's the purpose of Java to abstract those kind of things, it is just better to stress it out to the students : "different language for different purposes".  
  
  ---
  
  ### Answer by username_3 on 2017-11-06. Score: 1
  
  I agree wholeheartedly with @username_1. However there are some things that could be of use.
  
  Explain that C is a bottom up language, that its philosophy starts at the machine. Java is, to some extent, a top down language. Its philosophy starts at the human.
  
  I have worked with students that show me their code, and it is covered with `static`. They tell me that they have tried to remove the `static`s but get errors. (This is because a static method can not use non-static methods/data.) This traps them in the non-OO world.
  
  Therefore write the OO bootstrap code for them. Start with OO, don't do anything that is not OO (except the OO bootstrap).
  
  ```
  public static void main (String [ ] args) {
      new Program().run(args);
  }
  
  ```
  
  The following would especially confuse those that have not done C, so don't tell the whole class.
  
  * Java has no pre-processor.
  * Java references are like C pointers, but can only point to a valid object or null. see also <https://username_3.wordpress.com/2009/08/10/types-of-reference/>
  * Java has this extra stuff, to support object orientation.
  
  
  ---
  
  