Usability the ease with which users can learn and

Info icon This preview shows pages 6–9. Sign up to view the full content.

View Full Document Right Arrow Icon
Usability - The ease with which Users can learn and executes tasks within the software Mainability - The ease with which changes can be made to the software. Reusability - The ease with which software components can be reused in the development of other software systems. Portability - The ease with which software components can be used in multiple computer environments Efficiency - The degree to which the software fulfills its purpose without wasting resources. STRUCTURED PROGRAMMING GOTO Considered Harmful - Structured Programming was a term coined by Edsger Dijkstra in the 1960s. - Main principles: Control Structures, Modularity, Top-Down Design Goals of Structured Programming - Clarity, Quality, Speedy Development Control Structures - Sequence | statement | statement - Selection | condition | | yes no | | statement statement - Iteration | ---condition<--- | |yes |
Image of page 6

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
| statement -- -------------| V no Modularity - Code should be organized in modules (methods). - Methods should have one entry-point and one exit point. - Methods should only do one thing. - Methods should be only as long a necessary (<20 lines of code) Top-Down Design - Start with a module that solves a problem at a high-level. - Break it into a sequence of small steps. - Break each of those into smaller steps, repeating until the steps solve a probem that cannot be divided Methods - A method is a named sequence of intructions. absoluteValue (n) | -------- n<0 | | yes | no n=-n | | ------>return n System.out.prinln String.substring and Math.abs - We "call a method" to execute the named sequence of instructions. - A method call is indicated by an identifier (the method name) followed by parenthesis containing arguments. - Methods are great way to reuse code - Method Syntax - The "return type" is the data type that the function will return. - The "method name" is the name we call whenever we want to use a method in out program - The "parameters" are the variable declarations inside the parenthesis. - Methods return one value or none at all ONLY ONE VALUE - The "Method Body" is a code block containing the statements to be executed when the method is called. Calling a Method - When we call a method, we refer to it by name and supply a value for each parameter. These values are referred to as "arguments". -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- ---------------------------------------------------------- Problems 11/8/2017 Scope - Availability of a method - Write a method that calculates n! public class Week10Lab2 { int factorial (int n){ int result=1; for (int i=n; i>0; i--){ result *= i; } return result; } public static void main(String[] args) { Week10Lab2 example = new Week10Lab2();
Image of page 7
for (int i=1; i<10; i++){ System.out.println(i + "! = " + example.factorial(i)); } System.out.println( example.factorial(100)); } } Write a method that prints a given String s in reverse order -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------- Topics Java,Literals,Primitive Data Types, Variables, Expressions, If-statements, loops, Methods 3x5 Index Card of Notes 30 - 40 questions Wednesday, In class Primitive Data Types Numbers: byte, char, short, int, long, float, double Text: char, String Other: Boolean --------- Single Dimensional Arrays 11/27/2017 - An array is an aggregate data structure IMAGINE ARRAY AS A BUCKET - It has a single name (identifier) but many elements - Each element has a position (0,1,2,...) - An array is represented in Java by an object
Image of page 8

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern