190 likes | 280 Views
Review Programming Style. Joe McCarthy. File Names. Assign1.java assign1.java Assignment1.java. Scanner type = new Scanner (System.in); … newline(); repeat(); newline(); end();. Method & variable names. Scanner type = new Scanner (System.in); … newline();
E N D
ReviewProgramming Style Joe McCarthy CSS 161: Fundamentals of Computing
File Names • Assign1.java • assign1.java • Assignment1.java CSS 161: Fundamentals of Computing
Scanner type = new Scanner (System.in); • … • newline(); • repeat(); • newline(); • end(); CSS 161: Fundamentals of Computing
Method & variable names • Scanner type = new Scanner (System.in); • … • newline(); • repeat(); • newline(); • end(); CSS 161: Fundamentals of Computing
Ithink(); • System.out.println(); • Ifeel(); • System.out.println(); CSS 161: Fundamentals of Computing
CamelCase • iThink(); • System.out.println(); • iFeel(); • System.out.println(); CSS 161: Fundamentals of Computing
public class Assignment1a { public static void main (String[] args) { System.out.println("\nI'll tell you something"); … public static void hide () { System.out.println("I can't hide"); } public static void pleaseSay () { System.out.print("please say to me\nyou'll let me"); } CSS 161: Fundamentals of Computing
Indentation & Spacing public class Assignment1a { public static void main (String[] args) { System.out.println("\nI'll tell you something"); … public static void hide () { System.out.println("I can't hide"); } public static void pleaseSay () { System.out.print("please say to me\nyou'll let me"); } CSS 161: Fundamentals of Computing
public class Assign1{ public static void main (String[] args) { vsOne(); System.out.println(); vsTwo(); vsRep(); vsRep2(); vsRep(); vsRep2(); } public static void holdHand() { System.out.println("I want to hold your hand"); } CSS 161: Fundamentals of Computing
Indentation & Spacing public class Assign1 { public static void main (String[] args) { vsOne(); System.out.println(); vsTwo(); vsRep(); vsRep2(); vsRep(); vsRep2(); } public static void holdHand() { System.out.println("I want to hold your hand"); } CSS 161: Fundamentals of Computing
public static void main (String[] args) { first(); hold(); space(); say(); space(); chorus(); space(); second(); hold(); space(); chorus(); space(); second(); hold(); } CSS 161: Fundamentals of Computing
Spacing public static void main (String[] args) { first(); hold(); space(); say(); space(); chorus(); space(); second(); hold(); space(); chorus(); space(); second(); hold(); } CSS 161: Fundamentals of Computing
public class Assign1 { public static void main (String[] args) { // display first verse System.out.print("I'll tell you something"); System.out.println(); CSS 161: Fundamentals of Computing
Indentation & Spacing public class Assign1 { public static void main (String[] args) { // display first verse System.out.print("I'll tell you something"); System.out.println(); CSS 161: Fundamentals of Computing
public class Assign1{ public static void main (String[]args){ // display first verse System.out.println("I'll tell you something"); CSS 161: Fundamentals of Computing
Indentation & Spacing public class Assign1{ public static void main (String[]args){ // display first verse System.out.println("I'll tell you something"); CSS 161: Fundamentals of Computing
System.out.println(); System.out.println("Oh please say to me \nyou'll let me be your man \nand please say to me \nyou'll let me hold your hand \nNow, let me hold your hand \nI want to hold your hand"); System.out.println(); CSS 161: Fundamentals of Computing
Run-on statements System.out.println(); System.out.println( "Oh please say to me \n" + "you'll let me be your man \n" + "and please say to me \n" + "you'll let me hold your hand \n" + "Now, let me hold your hand \n" + "I want to hold your hand" ); System.out.println(); CSS 161: Fundamentals of Computing
System.out.println(); System.out.println( "Oh please say to me\n" + "you'll let me be your man\n" + "and please say to me\n" + "you'll let me hold your hand\n" + "Now, let me hold your hand\n" + "I want to hold your hand\n" ); CSS 161: Fundamentals of Computing