Results 1 to 3 of 3
  1. #1
    egrizzly is offline Member
    Join Date
    Jun 2016
    Rep Power

    Default Speed technique for solving "Code Magnets" exercise.

    Hello All,

    In college we're often given surprise quizzes featuring "code magnets" which are snippets of java code that have to be re-arranged correctly so to produce
    a given output (which is shown next to the code pieces). The code that appears are often simple java code however the issue I have is that I'm never able to get
    it done on time.

    ** I attached a copy of the code magnet question **.

    For all programmers out there what kind of speed techniques would you suggest to adopt in piecing together this code in the shortest time possible??? It seems that
    I can identify the "public static void main..." line as well as the class titles (class DrumKitTestdrive) very quickly however when it comes to the other pieces of code
    I'm running in circles to figure out what goes the time expires on me. Is there a "system" of thinking that you can use to piece together the code? Thanks in advance
    for your help and advice.

    - egrizzly
    Attached Files Attached Files

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Northern Virginia, United States
    Rep Power

    Default Re: Speed technique for solving "Code Magnets" exercise.

    So this is how they teach programming today? I am not certain what to recommend. For experienced programmers
    the exercise is not that hard (even a non-Java programmer could probably figure it out). I think this has more to
    do with developing a general thought process for coding than anything to do with Java. And that thought process
    continually develops over years of writing programs. It really can't be taught (imho).

    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  3. #3
    Ewe Loon's Avatar
    Ewe Loon is offline Member
    Join Date
    Jun 2016
    Rep Power

    Default Re: Speed technique for solving "Code Magnets" exercise.

    identifying the class and main method is a good place to start next i would recommend looking for methods and constructors (in the example you provided (playsnare and playtophat) and put them into the class

    at this point most of what is left will probably (no being sure though) go into the main method and its a case of arranging them so get the desired output
    unfortunately there is no way of simplifying this part of it
    Note, as you do more programming and Debugging you will get better at recognizing what the code does
    also dont be discouraged by not being fast, in my opinion the ability to be a good programmer is more about recognizing errors and faults, and being able to fix them
    unfortunately thats not the commercial viewpoint

Similar Threads

  1. Replies: 1
    Last Post: 03-30-2016, 11:43 PM
  2. Replies: 0
    Last Post: 12-07-2012, 08:29 AM
  3. Replies: 5
    Last Post: 04-29-2012, 07:18 AM
  4. Program skips "If" code and goes straight to "Else"
    By Logik22 in forum New To Java
    Replies: 12
    Last Post: 01-21-2012, 05:40 PM
  5. Replies: 1
    Last Post: 10-20-2008, 07:35 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts