How to Succeed in CMPINF0401, Intermediate Programming

Rohaan Wasim

What Is Java?

Java is a high-level, object-oriented programming language that runs on billions of devices worldwide. Java is used across the industry and easier to learn than many other programming languages, making it a good language to learn and become proficient in.

Should I Take CMPINF-0401 or CS-007?

This is a common question many students have when deciding if they should skip CS-007 and take CMPINF-0401 directly. Learning Java can be daunting for various reasons, from the verbose syntax to the logic required to construct programs. If you don’t have any experience with Java or other programming languages, I recommend taking CS-007 before CMPINF-0401. CS-007 will provide you with a programming foundation that CMPINF-0401 will build off of. Another viable option is learning programming fundamentals and Java on your own before taking CMPINF-0401. This is a good option, but you will need to put in a reasonable amount of effort outside of the classroom. If you choose this option, try to complete your independent learning before the class starts to be prepared from day one. If you have experience with Java or other programming languages, you should have little to no trouble taking CMPINF-0401 without taking CS-007 beforehand.

What Does This Course Cover?

  • Concepts from CS 007 (Covered During the Beginning of the Course)

    • Java Basics – Variables, Operators, Data Types, Compiling and Running Java programs.
    • Console I/O – Reading arguments from the command line when a Java program is run and printing to the terminal.
    • Loops – Code structures that allow for the repeated execution of a block of code until a condition is met. There are two types you should know:
    • For Loops – Loop that defines a loop variable (a variable that is created before the first “iteration” (i.e. execution) of the loop), a condition utilizing the loop variable that determines when to stop looping, and the update to the loop variable which brings the loop closer to terminating.
    • While Loops – Loop that defines a condition that determines when to stop looping.
    • Text Files – Files stored on the disk that can be read from and written to. As data and variables created when a program is run vanish once the program stops running, text files are useful for storing data we want to keep past the program’s termination. Text files are also useful for storing large inputs to programs.
    • Arrays – Data structure that stores multiple data values or references. Items in an array are referred to as “elements.” Arrays store their elements in memory contiguously (one after the other) and allow for random access (elements can be accessed directly using indexing).
  • New Concepts

    • Multi-Dimensional Arrays – Array data structure whose elements are references to other arrays. It helps to think of a multi-dimensional array as a matrix, or square, with the first row containing the elements of the array the first array reference points to, the second row containing the elements of the array the second array reference points to, etc.
    • Classes – The backbone of Java’s object-oriented nature. Classes are blueprints defining the properties/attributes (represented by instance variables) and behaviors (represented by methods) of objects. Classes are used to create new objects containing the instance variables and methods described by the class.
    • Recursion – Recursion occurs when a function calls itself. In a nutshell, each recursive call (a function call to the function itself) puts a copy of the function with modified function arguments. Each recursive call reduces the problem space to eventually reach a base case; when the base case is reached, recursion stops, and the copies of the function are taken off of the stack.
    • Exceptions – Events that occur during execution which disrupt the normal flow of execution. In Java, exceptions are handled using the try-, catch-, and finally- blocks.
    • Linked Lists – Data structure composed of nodes, each containing 1) data 2) a reference to the next node. Linked Lists begin at the first node, called the “head,” and do not support random access. You might find this analogy helpful: If an array is a group of people in an ordered line, then linked lists are a group of people spread out, with each person pointing to the next person in order.

      How to Succeed in CMPINF-0401

      Readings

      Starting Out with Java by Tony Gaddis and Godfrey Muganda is a fantastic book for learning Java. It covers the core concepts of the course in great detail and provides numerous code examples that show the concepts in action. It also covers some concepts that are beyond the scope of the class if you are interested in exploring them further. Although it isn’t necessary to read the book to succeed in the course, it is a great resource for those who want to dig deeper into Java, see code examples that demonstrate where, how, and why the concepts covered in class are utilized, and gain a better understanding of Java overall.

      Projects

      This is a programming intensive course. You will be creating many Java programs that incorporate the concepts you cover in lecture. Anticipate spending a few hours on each project, although it may take you less time depending on your understanding of the concepts and proficiency in Java.

      Tips For Success

  • Recursion is arguably the hardest concept covered in this course, so don't feel bad if you can’t wrap your head around recursion the first few times you encounter it. Tracing recursive functions found in the textbook/course slides and attending Instructor/UTA office hours to get explanations on recursion and clear up confusion are great ways to learn this concept. Recursion may seem unnecessary at this stage, but you will really see its power in solving recursively defined problems in later CS courses.
  • You may be able to get by starting the projects on the day they are due. I strongly suggest that you Do Not do this. This can become a bad habit that won’t work in later CS courses that have projects which require much more time to complete. Start Early to Finish Early to Save Yourself a Lot of Stress.
  • In addition to programming, this course teaches Computer Science and problem solving fundamentals. Strive to acquire a deep understanding of the concepts, their purpose, and why they are used. Also try to understand in which situations one structure should be used over another and why (ex. arrays vs. linked lists, for vs. while loops).

    Conclusion

    Computer Science courses at Pitt are designed to build on top of each other to foster a holistic and complete understanding of CS. This course will strengthen your Java skills, teach you fundamental Computer Science data structures and principles, and improve your problem solving and critical thinking abilities, all things which will be invaluable in later courses and, if you choose to pursue it, a career in Computer Science.

Last updated: Feb 13th 2022