Self-Learning Module
Outcomes Covered
Coding Standards
- Explain the purpose of a coding standard
- Apply the MSOE Coding Standard
Introduction and Motivation [1:11]
- Skim sections 8.1-2 of the textbook but note that the coding conventions in the textbook do not always align with the conventions used in our class.
- Watch the following video [link]
The Rules [14:38]
- Study section 8.3 of the textbook
- Study the coding standard page
- Watch the following video [link]
Configuring CheckStyle in IntelliJ [7:05]
- Watch the following video [link]
- Configure IntelliJ to use CheckStyle with the MSOE configuration file
Activity
After installing Checkstyle, create a project with one Java source file called
CodingStandard.java
and copy the following code into it:
package weekfive;
import javax.swing.JOptionPane;
import java.util.concurrent.CyclicBarrier;
public class eunmest {
public static void main(String[] manybois) {
double Smooth,
bRaIn,u,boI;Smooth=bRaIn=1;
int STONKS = 18;
u=1;
boI = Smooth;
do{u += Smooth / bRaIn;
bRaIn*=boI++;
if(STONKS %23!=0)
STONKS--;
else
break;
} while(true);
System.out.println(u);}}
Before making any changes, read through the code and see if you can determine what
it is doing. Then, fix all of the Checkstyle errors that are highlighted. Some
of the variable names may need to be guessed at, but that is fine. Once it is
"cleaned up," in a block comment at the end of the file, tell us what you think
the code is supposed to do. If you are unsure, describe as best you can what the
code is doing, even if you aren't sure why. Submit your CodingStandard.java
file
in Canvas.
Bonus Material (optional)
Thoughts on Comments
- I encourage you to that a look at this article on good commenting: Writing System Software: Code Comments
Tip Videos
- Sabrina Stangler on what to do when you're overwhelmed [1:35] [link]
- Dr. Taylor on learning by teaching [1:20] [link]