Software Development | Fundamentals of Programming | Working with Java | Java Identifiers
Weeks of coding can save you hours of planning.
If you take a bird's eye view of the idea of software development, you can see that it is important for programmers to follow guidelines. The rules that guide programmers help make sure that programs are easily maintainable.
Software development is the process of computer programming, documenting, testing, and error fixing involved in creating and maintaining applications and frameworks resulting in a software product. Software development is a process of writing and maintaining the source code, but in a broader sense, it includes all that is involved between the conception of the desired software through to the final manifestation of the software, sometimes in a planned and structured process. Software development may include research, new development, prototyping, modification, reuse, re-engineering, maintenance, or any other activities that result in software products. Wikipedia
Directions: Several different kinds of problems can occur in software, particular during program development. You will encounter three kinds of errors as you develop programs:
Briefly explain what each type of error is or does and give an example. Submit your response directly to the itsLearning textbox. Do not attach a separate document and make sure you proofread.
Directions: Create an infographic of the software development model assigned to you. Your infographic must include a title, definition, picture, advantages, disadvantages, and other information that you feel is fundamental to your model. Download the full assignment and rubric in itsLearning.
Directions: After watching the video and completing your software development model infographic, complete the Software Development worksheet in itsLearning.
Directions: Create your first program, HelloWorld, in BlueJ. Download the step-by-step HelloWorld document to assist you with writing your program.
Directions: Write a Java program that prints the message, "Roses are red". Your program will be a class definition containing a main method. See the HelloWorld example if you need guidance. Download Poem document for the instructions.
Directions: When you make syntax errors in your program the compiler gives error messages and does not create the bytecode file. It saves time and frustration to learn what some of these messages are and what they mean. Unfortunately, at this stage in the game many of the messages will not be meaningful except to let you know where the first error occurred. Your only choice is to carefully study your program to find the error.
Download the Errors document to practice in BlueJ. Submit your answers to questions 2-6 in the assignment in itsLearning.
Java is a high level, object orientated, platform independent programming language. It promises write once, run anywhere.
Java's name-formatting convention is so widely used that if you don't follow it, people will probably complain about it. A Java name can be any combination of letters, numbers, underscores, and dollar signs, as long as it doesn't start with a number. Spaces aren't allowed, and certain patterns have become so widely used that people expect to see them.
Programs: Don't start program names with dollar signs or underscores. Those are usually reserved for system names, not document names. A name should describe the document's purpose, so use names like accountNumber, firstName, etc.
Classes: Class names are nouns that describe the entity they represent. They start with an uppercase letter, and all words after also start with uppercase letters (this style is known as UpperCameCase). String, Math, and Graphics are examples of class names.
Variables: There are a few rules to follow when naming variables. First, variable names are nouns that describe the data they hold so you should choose a meaningful name. When you or someone else reads your code, it should be clear what each variable represents. Therefore, if you have a variable that represents the number of days then use the name days. Variable names that do not make sense or match the purpose of the variables can be very confusing for people to read and understand.
All variables should start with a lowercase letter. They can contain letters, number, and underscores, however, it must start with a letter.
If a variable is more than one word long, capitalize the start of each word except the first. This is called lowerCamelCase, i.e. daysOfTheWeek
Sometimes variables are referred to as identifiers. Think of it as your name. It is a way to identify yourself. It's the same with variables. If I have two integer variables, I will want to have two different names to tell them apart. Also be aware that Java is case sensitive. It will interpret upper and lower case letters differently. For example, Angelina does not equal angelina.
Starting an identifier with an underscore is a valid identifier name but it is consider bad style meaning that the programming community frowns upon underscore as a first letter use. Another example is camelCase; camelCase is style and not validity. It is a preferred naming convention that is expected in the programming community but Java does not care either way so it will not throw an error if you don't follow style.
Methods: Method names are verbs that describe the action they provide. They should follow the same formatting rules as variable names, but method names always have parentheses after them. Some examples are setColor() and getText().
Constants: Constant names are for values that can't change. These are nouns and they're all uppercase. Separate words with underscore since we can't use camel case. Java constant names look like this: PI, MAX_VALUE, and MIN_VALUE.
The last thing to know about identifiers, is that you cannot use any of the Java keywords as variable names. Some of the keywords that we have studied so far are:
There are many more. For a complete listing of Java keywords visit http://docs.oracle.com/javase/tutorial/java/nutsandbolts/_keywords.html.
Directions: An identifier is a letter followed by zero or more letters and digits. A Java Letter includes the 26 letters of the English alphabet in both uppercase and lowercase, the $ and the _ (underscore) characters, as well as alphabetic characters from other languages. A Java Digit includes the numbers 0 through 9. Identifiers cannot begin with a digit.
Study each of the identifiers listed in the itsLearning worksheet and indicate whether each is valid or invalid. For each invalid identifier, be prepared to tell why it is invalid.
You should always include comments in your code:
The goals of comments is readability. Make sure:
We have seen multi-line comments at the top of BlueJ. But there are also single line comments and end of line comments.
// This is a single line comment.
The comment above would sit on a line by itself above the line of code it refers too. However, the same type of comment can follow the line of code like this:
System.out.println("Hello World!") //Output demonstrating the use of a string literal
Directions: On paper, write an application that prints, on separate lines, your name, your birthday, your hobbies, your favorite book, and your favorite movie. Use comments to label each piece of information in the output. Now, input your application into BlueJ and correct any errors so that your code compiles. Submit to itsLearning, a picture of your handwritten code, your code from BlueJ (copy & paste the code into the itsLearning textbox) and a screenshot from the BlueJ terminal window demonstrating that the program worked as intended.
Directions: Complete the Unit 1 Review worksheet in itsLearning to review for the unit assessment.
The Software Development Cycle presentation
Fundamentals of Programming presentation
Working with Java presentaton
High-Level Language image: https://corejava25hours.com/category/java/
Platform Independent image: https://corejava25hours.com/category/java/
Software Development: https://en.wikipedia.org/wiki/Software_development