Introduction to Computer Science, IDC Herzliya


  • News
  • Lectures
  • Recitations
    • Week 1, Introduction
      • Week 2, Data and Variables
        • Week 3, Flow Control
          • Weeks 4-5, arrays and classes>
            • Arrays
              • Writing classes
              • Week 6>
                • VIC
                  • Exceptions
                  • Week 8, Javadoc + TicTacToe
                    • Week 9, Algorithms
                      • Week 10, collections and text
                        • Week 11, Inheritance
                          • Week 12, Polymorphism
                          • Homework
                            • Exercise 1>
                              • Exercise 1
                                • Solution 1
                                • Exercise 2>
                                  • Exercise 2
                                    • Solution 2
                                    • Exercise 3, Flow Control>
                                      • Exercise 3
                                        • Solution 3
                                        • Exercise 4, arrays and writing classes I>
                                          • Exercise 4
                                            • Solution 4
                                            • Exercise 5 (VIC)>
                                              • Exercise 5
                                                • Solution 5
                                                • Exercise 6 (previously 5), arrays and writing classes II>
                                                  • Exercise 6
                                                    • Solution 6
                                                    • Exercise 7 (algorithms)>
                                                      • Exercise 7
                                                        • Solution
                                                        • Exercise 8>
                                                          • Exercise 8
                                                            • Solution 8
                                                            • Exercise 9>
                                                              • Exercise 9
                                                                • Solution
                                                                • Exercise 10>
                                                                  • Exercise 10
                                                                    • Solution
                                                                  • Questions and Answers
                                                                    • HowTo
                                                                      • Rules
                                                                        • Forum
                                                                        • Syllabus
                                                                        • Grades
                                                                        • Team
                                                                        • Resources
                                                                          • Links and Books
                                                                            • Homework Submission Guidelines
                                                                              • Individual Work Policy
                                                                                • Programming Style Guidelines
                                                                                  • Soft Landing
                                                                                    • Java Development Environment

                                                                                    What Are Styling Conventions?

                                                                                    When there are several ways to do the same thing, everybody acts differently. 
                                                                                    Programming languages provide leeway and allow writing the exact same command in different ways.
                                                                                    For example, the following commands are exactly the same in the eyes of the compiler:



                                                                                    while (v1 > v2 + 3) v1=v1+1;

                                                                                    while (v1 > (v2 + 3)) 
                                                                                    {
                                                                                    v1=v1+1;
                                                                                    } 

                                                                                    while (v1 > (v2 + 3)) {
                                                                                        v1++;
                                                                                    }

                                                                                    Styling conventions, like most conventions, provide uniformity of code. Reading the code of different programmers does not require adapting, and since most of the time we'll be maintaining code, this saves a lot of time (and anger).

                                                                                    Our Course Conventions

                                                                                    Sun Microsystems have written general guidelines for style conventions. We tend to conform to their styling conventions, so you should adhere to their document. The document can be found here.


                                                                                    Create a free website with Weebly