Menu

Comments on Total Beginners Tutorial

technocrat
2008-04-09
2013-04-09
  • technocrat

    technocrat - 2008-04-09

    Mark,

       Your efforts and skill are remarkable.  Many beginning students
    fail to grasp the process of programming (to include debugging).
    Looking at reams of code printed nicely within a text book can
    be most depressing for a newbie since they have no clue as to
    where to start.  Using Eclipse screencasts to teach Java is a
    wonderful idea since you have added the dimension of time.  You
    are teaching the process dynamically.

       Judging how the audience these tutorials have already reached,
    you are destined to influence Java education.  Soon you may exceed
    the reach of David Flanagan.

       I will add my two cents.  These are not criticisms per se,
    rather consider them quibbles...

    -----------------------------------------------------------

    A few minor suggestions based on my own experiences:

    1.  One useful thing to teach Java beginners is the Eclipse
    formatting source wizard.

        Source -> Format

    Watching the control structures indent dynamically according to
    a style reinforces what is going on.  Often a student fools
    themselves with free-form indentation based on intent as opposed
    compiler semantics.  Just as you introduced the idea of saving
    one's work during the process of coding, I have found reflex
    formatting to be useful as well :-)

    2.  Arguments versus parameters.  Since the parameters of a method
    are just placeholders, I would use more generic looking names
    to emphasize that point.  For example:

            public void addBook(Book b) {
               books.add(b);
        }

    instead of

            // within MyLibrary.java
            public void addBook(Book b1) {
               books.add(b1);
            }

    used in Lesson 11 to match the argument used in TestMyLibrary.java.
    Not matching is a better lesson for the beginner.

    3.  I dislike more than one return statement within a method.
    Soon one gets the look of spaghetti GOTO statements of Fortran lore.
    Furthermore, creating a local boolean can improve code clarity.

            public boolean checkIn(Book b) {
               boolean back = false;
               if (b.getPerson() != null) {
                  b.setPerson(null);
                  back = true;
               }
               return back;
            }

    instead of this code in Lesson 12

            public boolean checkIn(Book b) {
           if (b.getPerson() != null) {
                  b.setPerson(null);
                  return true;
               }
               else {
                  return false;
               }
            }

    4.  Short-circuited, compound logic within IF blocks may be too
    terse for beginners.  I prefer the easier to read:

            public boolean checkOut(Book b, Person p) {
               boolean checked = false;
               if (b.getPerson() == null) {  // book not checked to a person yet?
                    if (p.getMaxBooks() > getBooksForPerson(p).size()) {
                     b.setPerson(p);
                     checked = true;
                  }
               }

               return checked;
            }

    I am of the school that easier to read makes for better code :-)

     
    • Mark Dexter

      Mark Dexter - 2008-04-09

      Hi. Thanks very much for the kind words and the specific feedback. I very much appreciate the code examples, and I agree with your suggestions. I plan to revise the Total Beginners tutorial at some point to incorporate JUnit 4 (instead of 3.8) and I have gather up a few suggestions to help make it better. I will certainly add yours. Thanks again. Mark

       
    • Neo

      Neo - 2008-04-09

      Hi techno,

      I don't agree with point 4 : as a beginner in Java, I would like to learn early such important operator as && .
      I could even go as far as emphasize the difference between && and & .

       

Log in to post a comment.