Frequently Asked Questions (FAQs)

  1. Hints for optimal learning in online courses
  2. Posting in the Q&A Forums FAQs
  3. What is Pseudocode?
  4. Java-specific FAQs
  5. C++-specific FAQs

Hints for optimal learning in online courses

Thomas Carruthers once said, "A teacher is one who makes himself progressively unnecessary."

Nowhere is this more true than in online courses where, despite their greater flexibility, they inevitably shift the responsibility for learning onto the learner with the teacher become a "guide on the side" rather than a "sage on the stage". An online class, in my opinion, really isn't designed to teach but, instead, to facilitate learning. This is because an online course is usually intended for very independent learners comfortable with self-study, rather than those more comfortable with direct, structured, live and interactive pedagogy. And, in my experience, the Socratic approach is the best way to learn, rather than teach.

Often, different people need different perspectives on the same material; some are more visual learners, other kinesthetic, others aural. Most of us, in fact, respond best to some blend of these learning styles so seeing the same material from a different perspective can be invaluable when learning new material. This is why I highly recommend everyone should read the text AND check the youtube videos AND, most of all, write little programs as much as possible! All the helpful advice in the world cannot substitute for the learning that occurs from writing a piece of code and throwing it into the fires of the compiler. Then fixing it. Then recompiling. Then Googling the often-frustrating error messages that seem to make no sense. Then recompiling. Then celebrating! This is the absolute best and most efficient way to learn programming (and most other things, as well).

In fact, I assume that's exactly what you guys are doing: you should be writing, compiling, and then searching google for what the heck happened. This is one of the main reasons I encourage (some might say force :) everyone to post their technical questions in the Q&A forums and employ the socratic method which, in my opinon, is the best way to learn critical-thinking/evidence-based reasoning. This is where both your colleagues and I will take the examples you post and ask things like, "What if x fact is changed in y way? What results from that change?" Once you answer, your colleagues might ask, "Why does that necessarily result?" and you can, in turn, ask your colleagues if they think the change makes a significant difference.

My job is to help facilitate your learning (rather than just answer questions that are in the book or online) and the process outlined above is absolutely essential to that learning.

Also, when you feel stuck, one of the best things to do is consult one of the references in my references links and/or search on google. Almost every single question for a class at this level is likely already answered on the web and should show right up via a quick search.

Additional helpful hints for students

How to post in the Q&A Forums

  1. General Q&A Posting Format

    Saying "I'm lost" might help release some frustration (and accurately reflect your internal state! :) but it won't get you much help as no one is as familiar with your work as you. So the first step in getting help is explaining your problem precisely. Just imagine all the various things you'd explain to someone in person and how much of an iterative, back-and-forth process explaining the problem is, with the person trying to help asking many clarifying questions to get a handle on what might be wrong. Online, you have to be able to capture that same information in a single post!

    Remember, the people you're asking for help are at least as busy as you. In general, when posting questions online (either in classroom forums or in the wilds of the internet), please do follow the protocols outlined below for eliciting the best help. These protocols build upon the latest research in Cyberlearning/Social Learning from community/knowledge sites which suggests how best to ask questions and learn new material.

    Mandatory Posting Protocol

    The first step is to state your problem precisely; not only will this clearly communicate the issue you're trying to resolve but, as Charles Kettering said, "A problem well stated is a problem half solved."

    As you know, all technical questions should be posted in the Q&A Forum. Like all such communities, before posting, all posts are required to include the following basic information:

    1. List what you tried
    2. List what you expected it to do and what it actually did
      • It's very important to include a description or screenshot of what it actually did
    3. List why you think it failed or should have worked
    4. Summarize how you tried to research your question. Simply saying that you used Google and Wikipedia isn't enough. What are some of the search terms you tried? What articles did you read?
      • This information is essential as most errors can be solved by simply searching for the exact error (in quotes).
    5. If necessary/appropriate, post pseudocode (only!) of your actual program/script with the full text of all errors.
      • Expressing your program in pseudocode (YouTube video of pseudocode) will help you in understanding what you're doing and help others to understand what is going on. Please do not ever post your actual lab code for the lab that's due that week.
      • Besides pseudocode, as also stated in these FAQs, if you're programming in Java, you should post the full stacktrace (which is described here and here).
      • If absolutely necessary, you can include a short excerpt of just the specific block of actual code causing the error. When posting code, it is a requirement to follow the guidelines posted at sscce.org for creating a Short, Self Contained, Correct (Compilable), Example.

    It's necessary to follow the above 5 steps as not only does that communicate the issue plainly for potential helpers but clearly defining the problem will VERY much help you get a handle on it, too.

    For more generic issues, the follow-up will likely involve posting:

    1. Pseudocode of the relevant portion
    2. Specific code for just the block that's giving trouble + what you expect that block to do
    3. A screenshot of what happens when you try to compile/run that code

    Beyond this course: If you intend to do any programming after you're done with this course, you'll likely need some help down the line. Although our course Q&A Forums won't be available then, the same skills you acquired in asking questions here will aid you in getting answers from the programming community on the Web! Here is a little guide on how to ask questions on the Web Forums: http://www.catb.org/~esr/faqs/smart-questions.html

    Please remember, if you're in an academic situation, your professor likely has about 60 - 100 other students that are vying for his/her time; if you're in an industry-setting or seeking help online, the people you're approaching for help have other full-time jobs or tasks. Unless you've hired a personal tutor, the people helping you are likely giving of their own valuable time so it's incumbent upon you to make good use of it otherwise you'll get little to no help (and, on the internet, quite a few snarky responses, as explained here and here :).




  2. Posting C++ or Java questions in the Q&A Discussion Threads: When posting a request for help in the Q&A discussion threads, please do not include a full posting of the code. Instead:
    1. Post an anonymized version with the specific code snippet causing errors only. E.g., if I were having issues with creating a frame class, I'd post something analogous to:
      • Declare class
      • Create main
      • Add button listener: ButtonListener Listener = new ButtonListener(); // Error on this line FtoC.addActionListener(Listener);
    2. After posting the pseudocode/actual code, please give a hypothesis of why you think the error occurs (e.g., "I don't think I'm declaring the button listener in the correct location").
    3. This kind of posting not only shows us your understanding but also will help you understand the structure and potential source of error.
    4. And then include the error, itself, including the full stacktrace. If we still can't figure it out, then we'll request more elaboration or posting of code but please do not post your code in full as the first step.
    5. Java-specific: In order to post the error, please be sure to include the stack trace (which is described here).



  3. Why do we do it like this?
    The reason is that we are really interested in using the problems to learn the process of solving them rather than just in finding their solution.

    When posting for help in the Q&A forums, please ensure you do the following for full learning: rather than just giving a screenshot or printing an excerpt, you should ensure you:

    1. List what you tried
    2. List what you expected it to do and what it actually did (this is the most important part)
    3. List why you think it failed or should have worked


    Why is this? The reason is that as you clarify the problem, not only will it help the person helping you understand the problem but the solution will usually crystallize itself. That crystallization occurs as part of the software design process and troubleshooting a program is usually an indication of a software design flaw.

    Unless, of course, it's a compilation issue, in which case you should search google before posting in the Q&A forums as almost all questions you might have at this level have likely been answered there already.

    In fact, one of the goals of the course is to prepare you for independent work in this field (specifically, in our case, Java programming). And one of the most important skills to learn is how to solve this problems yourself as a professional software developer. Most professional software engineers do exactly this when stuck: search google and go to expert, community sites for help. When you solicit help from these newsgroups or community sites, you will be expected to make posts in roughly this format; if you just post your full code with pleas for help, you're likely to get flamed off the boards immediately. In fact, within organizations, that approach would be considered highly unprofessional (certainly in the various companies for which I've worked/consulted).

    And when you respond to someone, it's very important to not simply give them the answer, if it's not an administrative issue and is an issue of understanding. We should endeavour to:

    1. Give them a reference, if possible
    2. Hint at the next step
    3. Ask a question that might lead them to solution, if possible


    Why is this? The course is designed very much for learning, as opposed to tutorial teaching. Our task is not to give answers but to lead to insight/learning and then evaluate the answers. It's the transition from the approach taught in secondary schools to independent learning at the academic level and just giving direct answers would severely undermine that.

    This approach does not work for everyone, of course, as people fall on a spectrum of learning types. But, by and far, this is the most effective approach to *actual* learning for the vast majority of students.

What is Pseudocode?

Pseudocode is a very helpful tool for designing your algorithms; it provides a high-level, informal, language-independent representation of the solution you will eventually code in a specific programming language (or multiple languages).
  1. Videos on developing pseudocode:
  2. Flowcharts: Flowcharts are another tool to help develop algorithms in a language-independent manner. Here is a nice flowcharting tutorial that will also improve your algorithm development skills: http://aritzhaupt.com/resource/flowchart/Ritzhaupt_Module1_Workbook.pdf
  3. There is no standardized syntax for writing pseudocode. Thus, everyone writes slightly different pseudocode, which is okay since it's just a tool for drafting out the instruction sequence you intend to code in a specific programming language later.

Java-specific FAQs

  1. If you receive a javac not recognized type of error, the issue is with your PATH variable. If you don't have your Java IDE directory in your PATH environment variable, you'll likely have to use the full path to the javac executable. E.g., if you installed the Java IDE into c:\java\, you might have to use something like c:\java\jdk1.7\bin\javac.exe instead of just javac.

    Here's a great link about the PATH variable, as well:

    http://docs.oracle.com/javase/tutorial/essential/environment/paths.html

  2. For common errors when compiling/running Java programs: http://download.oracle.com/javase/tutorial/getStarted/problems/index.html
  3. To see various errors during compile-time, I highly recommend this site: http://mindprod.com/jgloss/compileerrormessages.html

    In particular, if you get the dreaded Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorldApp, it's a very common error and just means you need to set the classpath and make sure package directory exists (c.f., http://www.jarticles.com/package/package_eng.html. If needed, simply remove the package declaration temporarily to see if everything runs okay without it.

  4. What is a stacktrace?

    "Java stacktraces are one of the most universally used mechanisms to detect and resolve problems in a Java application. The Java stacktrace is a user-friendly snapshot of the threads and monitors in a Java Virtual Machine (JVM)."

    Look for line numbers and keywords and read top part for the last call and bottom part for the first call that resulted in the exception.

    REFERENCES: http://stackoverflow.com/questions/3988788/what-is-a-stack-trace-and-how-can-i-use-it-to-debug-my-application-errors and also here
  5. How come the Big Java text doesn't talk about JOptionPanes???

    Actually, it does! :) It talks about JOptionPanes quite extensively in Ch. 4 and Ch. 8 (of the 3rd and 4th editions) and also in the exercises in in Ch. 1 and Ch. 5. In addition, the Java-specific references contains tons of links that discuss this essential library.
  6. If you get errors about The method printf(String,Object[]) in the type PrintStream is not applicable for the arguments(String, double) or about String.format("Average:%.2f",average); and gives the error parameters should be (String,Object[]) not (String, double) then the problem is the compiler compatibility in Eclipse. To fix, choose Project → Properties, then choose the "Java Compiler" option on the left and then click "Enable project specific settings" and then finally set "Compiler compliance level" to "6.0". Or set the default in the Preferences → Java → Compiler, as per setting:
  7. Fixing the Workspace in use or cannot be created, choose a different one error:
    http://viralpatel.net/blogs/2009/10/eclipse-workspace-in-use-or-cannot-be-created-error.html
    If you have verified that there is no other Eclipse process running and yet still see the error message, it may be due to a permissions problem or an operating system lock release problem (e.g., on Windows) and the sure-fire remedy is to simply delete the .lock file and restart Eclipse.

    Another little hint/tip, which might get outdated soon:
    If anyone is having issues with the Eclipse over Citrix, you might have to change the work drive to f:\workspace to get it to work. Please also note that your host computer is on the v:\ drive, in-case you need to move any saved files.
    You might need to use File -> Switch Workspace.
    You might also need to change the workspace to the "Client" V: drive and then drill down to find the folder you want to use.
  8. Fixing the The serializable class does not declare a static final serialVersionUID warning:
    http://stackoverflow.com/questions/1514881/understanding-this-warning-the-serializable-class-does-not-declare-a-static-fina
    If you have any class (or its parent) that implements the Serializable interface (e.g., JFrame), you'll likely see this warning in Eclipse, unless you told it to either ignore this, instead of giving a warning OR to autogenerate a serialVersionUID for you. You could also add the @SuppressWarnings("serial") directive to the calling method. But, most simply, just adding a new field (private static final long serialVersionUID = -1113582265865921787L;) to your class should do the trick.
  9. If you run a Java GUI program and get a blank frame that is fixed by maximizing the window and restoring it, then you likely didn't put the setVisibility() call at the end of your GUI initialization. Please do check here and here.

C++-specific FAQs

  1. If you are unable to open a file in Micro$oft VC Express when you use ifstream, it might be because of the following reasons:

Ricky J. Sethi, PhD <rickys@sethi.org>
Last updated: Sunday, May 29 2016
(sethi.org/tutorials/faq.shtml)