Object Oriented Analysis and Design

--Originally published at diegotc2016

Understanding the object-oriented analysis and design processes

There’s a process in order to identify the classes in an application.

  1. Gather Requirements: What’s the program you trying to solve? What does the app do?
  2. Describe the app: Write in a coloquial way how people use the app. You could create a mockup or a prototype of the app.
  3. Identify the main objects: With the two last points you’re trying to get the most important ideas that are essential for the app to work.
  4. Describe the Interactions: Specify how one class interacts with another. For example: A  customer opens his/her bank account.
  5. Create a class diagram: A visual representation of the classes you need

Object Oriented Analysis and Design

Defining Requirements

There are two types of requirements:

  • Functional: What does it do? Features and Capabilities. For example: Application must allow user to search by customer’s last name, telephone number and order number.
  • Non-Functional: What else? Help, Legal, Performance, Support  and Security. System must respond to searches within two seconds.

FURPS/FURPS+

Functional Requirements

Usabilitity Requirements

Reliability Requirements

Performance Requirements

Supportability Requirements

+ Design Requirements, Implementation Requirements, Interphase Requirements, Physichal Requirements.

Introduction to the Unified Modeling Language (UML)

The UML isn’t a programming language, it is a graphical notation for drawing diagrams of an object oriented system

  • Name of the class: BankAccount
  • Attributes: accountNumber, balance, dateOpened, accountType
  • Behaviors: open(), close(), deposit(), withdraw()

 


Object Oriented Analysis and Design

What are the mechanics for class description (coding) in the JavaProgramming Language?

--Originally published at diegotc2016

Classes are defined by the following way:

class MyClass {
    // field, constructor, and 
    // method declarations
}

In the space that is between the braces you can give instrucitons, you can define objects or declarations that will make your code work. 

You can also get the name subclasses and superclasses. This can be represented in the next way: 

class MyClass extends MySuperClass implements YourInterface {
    // field, constructor, and
    // method declarations
}

The following means that MyClass is a subclass of MySuperClass and that it implements the YourInterface interface. 

You can also modify the classes from the beginning. Class declarations can include these components, in order:

  1. Modifiers such as public, private, and a number of others that you will encounter later.
  2. The class name, with the initial letter capitalized by convention.
  3. The name of the class’s parent (superclass), if any, preceded by the keyword extends. A class can only extend (subclass) one parent.
  4. A comma-separated list of interfaces implemented by the class, if any, preceded by the keyword implements. A class can implement more than one interface.
  5. The class body, surrounded by braces, {}.

I got this out of:

https://docs.oracle.com/javase/tutorial/java/javaOO/classdecl.html

and I received help from the teacher

What are the mechanics for class description (coding) in the JavaProgramming Language?


What are the mechanics for class description (coding) in the JavaProgramming Language?

What are inheritance and polymorphism? (Specification and implementation)

--Originally published at diegotc2016

Inheritance is when a class, which is called the sub class, has the main elements of another class (super class) and has another one or more. For example:

Class: Person Class: PersonTwo
Name

Age

Height

Name

Age

Height

Weight

Polymorphism means the many uses or functionalities an object ar operator or a class can have. For example:

a=4

b=5

Then you want to print a+b your output will be 9

a=”4”

b=”5”

Then you want to print a+b your output will be “45”

I got this out of object oriented course at lynda.com

What are inheritance and polymorphism? (Specification and implementation)


What are inheritance and polymorphism? (Specification and implementation)

What are visibility modifiers, their purpose and use in practice?

--Originally published at diegotc2016

Public

Public: it is visible to the world. A class, method, constructor, interface etc declared public can be accessed from any other class.

Private

Private: it is visible to the class only. Methods, Variables and Constructors that are declared private can only be accessed within the declared class itself.

No Modifier

No Modifier: it is the default and it is visible to the package. A variable or method declared without any access control modifier is available to any other class in the same package.

Protected

Protected: visible to the package and all the subclases. Variables, methods and constructors which are declared protected in a superclass can be accessed only by the subclasses in other package or any class within the package of the protected members’ class

I got this out of:

https://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html

What are visibility modifiers, their purpose and use in practice?


What are visibility modifiers, their purpose and use in practice?

“Has a” is a “Relationship”

--Originally published at diegotc2016

Has a relationship is based on object composition while is a relationship is based on inheritance. For Example:

Person                                                                  is a FootballPlayer
Has an adress

Has an age

Has a name

Has a dog

Has a helmet

Has shoulder pads

Has cleats

Has gloves

This video would get it clearer, I understood this concept thanks to this video:


“Has a” is a “Relationship”

Abstraction & Encapsulation

--Originally published at diegotc2016

Abstraction

For example if I say a table you understand the concept it does not matter I I said it was a wooden table or a glass table. Abstraction means that we focus of the certain qualities of something. You have to take what is relevant. For example the taste of a table or the smell of a table are irrelevant

Abstraction & Encapsulation

Encapsulation

Encapsulation can be defined by the fields of an object and class should only be read or written by the method of that class. Hide some parts of the code except for a few that are most necessary. For example a phone , you don’t care how your phone works, you only care that you can take pictures with it, use apps, watch videos, hear to music, etc.

Abstraction & Encapsulation

I got this out of lynda.com Foundations of Programming: Object-Oriented Design by Simon Allardice

 


Abstraction & Encapsulation

What is an object, attribute and method? #Object #Attribute #Method

--Originally published at diegotc2016

Object

Wikipedia defines Object as:

“In computer science, an object can be a variable, a data structure, or a function, and as such, is a location in memory having a value and possibly referenced by an identifier.”

Ken’s definition of object:

“Something that has state and behavior”

My definition of Object:

A varible or a function that has a state and behavior

Attribute

Wikipedia defines Attribute as:

“In computing, an attribute is a specification that defines a property of an object, element, or file.”

Ken’s definition of Attribute:

“A value that an object can have (variable)”

My definition of Attribute:

A value given to a variable

Method

Wikipedia defines Method as:

“A method (or message) in object-oriented programming (OOP) is a procedure associated with an object class.

Ken’s definition of Method:

“The implementation of an attribute, kind of a function, but inside a class”

My definition of Method:

Use the attributes or variables in order to perform a certain action

 

 


What is an object, attribute and method? #Object #Attribute #Method