Java Software Development Lecture Notes PDF

Summary

These lecture notes cover topics related to software development using Java, including object-oriented programming concepts, design patterns (Singleton, Composite, State, Observer, etc.), UML diagrams, and testing methodologies. It also touches on subjects like coupling and cohesion in object-oriented design. The notes reference materials from Ryerson University.

Full Transcript

CHAPTER 2 - Understanding Objects in Java Software Development Activities: ​ Requirements Analysis ​ Design ​ Implementation ​ Testing 1.​ Requirements Analysis: ​ Software Requirements: What a program must accomplish, not how it will perform it ​ Fu...

CHAPTER 2 - Understanding Objects in Java Software Development Activities: ​ Requirements Analysis ​ Design ​ Implementation ​ Testing 1.​ Requirements Analysis: ​ Software Requirements: What a program must accomplish, not how it will perform it ​ Functional Requirements ​ Non-functional Requirement (quality): -​ Efficiency or performance (Response time, throughput) -​ Reliability: continuity of service -​ Usability : easy to use -​ Availability : readiness of service -​ Security -​ Maintainability 2.​ Design: How a program will accomplish its requirements (UML class diagram, etc.) a.​ Object-oriented design: classes, objects, relationship among classes, methods(API),javadoc comments 3. Implementation: Source Code ( java) ​ Process of writing the source code ​ Translating the design into a particular programming language ​ Focus on coding details, coding guidelines and documentation 4. Testing: To ensure that a program does what it should do ​ Use JUnit framework… 5. Maintenance Disadvantages in Waterfall Method: -​ Requirements are locked, once requirement analysis is done, can’t change it during design anymore or implementation. Main Concepts of Object-oriented Programming: ​ Class, Object, Encapsulation, Inheritance, Polymorphism, What is an Object? ​ An object represents any object or entity that you may think of in the “real world”. E.g: Person, Car, table, bank account, employee ​ Every software object have state and behavior ​ State - is defined by one or more variables ​ Behavior - is defined by its methods What is a Class? ​ A class is a blueprint that defines the variables and the methods common to all objects of a certain kind Class vs. Object SUMMARY OF COE 318 IS STUDIED DURING WEEK 1 CHAPTER 1 - ABSTRACTION DECOMPOSITION WEEK 2 The Software Problem ​ Software means industrial strength software that solves a specific problem ​ 3 Basic forces at play when developing industrial strength software -​ Cost - Software is Expensive -​ Schedule - Software requires tigh schedule -​ Productivity - Quality of software is hard to define WATERFALL MODEL​ -Linear Sequence of stages/phases -​ Requirements - HighLevelDesign - DetailedDeisgn - Coding -Testing -Deploy -A phase starts only when the previous has completed; no feedback Advantages: Simple, divides the problem into distinct phases Disadvantages: Requirements are locked early before design begins, All or nothing delivery PROTOTYPING MODEL ​ Used for risky/unfamiliar projects ​ Prototyping addresses the requirement specification limitation of waterfall ​ Instead of freezing requirements only by discussions, a prototype is built to understand the requirements Advantages : Requirements will be more stable, requirements frozen later, experience helps in ​ ​ The main development Disadvantages: Potential hit on cost and schedule Iterative Model ​ Counters the “all nothing” drawback of the waterfall model ​ Combines benefit of prototyping and waterfall Advantages : Get as you pay, feedback for improvement Disadvantages: Architecture/design may not be optimal, rework may increase, total cost may ​ ​ ​ Be more Applicability: Risk of long projects cannot be taken, all requirements are not known. SUMMARY OF TYPES OF MODEL AA DEVELOPMENT PROCESS ​ Commonly has these phases: ○​ Requirements elicitation and analysis ○​ Design : how to solve a problem ○​ Coding ○​ Testing ○​ Delivery Decomposition and Abstraction ​ For large programs, monolithic structure is not reasonable ​ The program must be decomposed into small independent programs, called modules, that together provide the desired function Goal of Decomposition: ​ Create modules that are themselves small programs that interact with one another in a simple, well-defined ways ​ Achieved through conception of Abstraction Kinds of Abstractions ​ Procedural abstractions: introduce new operations ​ Data abstraction: introduce new data types ​ Iteration abstractions: iterate over items in a collection without revealing details of how items are obtained ​ Type hierarchy: abstract from individual types to families of related types Chapter 3 - Procedural Abstraction - Week 3 Procedures combine the methods of : ​ Abstraction by Parameterization -​ Create functions that operate on different data types , or values, depending on parameters passed to them. It hides details of operation and focuses on the parameters. -​ Focuses on what object does rather than how it does it. -​ Can be reused over and over promoting reusability and flexibility ​ Abstraction by Specification -​ Documentation according to our terminology or comments(useful for clients to use that method) -​ E.g A method that computes factorial Documentation (// comments) Static int factorial ( int n) { if (n>0) Return n * factorial(n-1); AVOID PARTIAL PROCEDURES else if (n==0)​ ​ ​ DOES NOT WORK FOR ALL VALUES Return 1;​ ​ ​ OF INPUT PARAMETERS } Preconditions: //Requires: n > 0 // Modifies : None Post condition //Effects: Returns the factorial of n where factorial means n*n-1*...*1 -​ Methods with a require clause: Called partial procedures -​ Methods with no requires clause: Total Procedures (safe ones) -​ Our goal is Total Procedures for public methods in a class -​ Private helper methods can be partial procedures (less safe and efficient) Now write Total procedure for the factorial example above //Requires: None //Modifies: None //Effects: if n is -ve, throws NegativeException, else it returns the factorial of n Static int factorial (int n){ If (n