100% de satisfacción garantizada Inmediatamente disponible después del pago Tanto en línea como en PDF No estas atado a nada 4.2 TrustPilot
logo-home
Notas de lectura

IB Computer Science Resources - Logic Gates, Recursion, Java

Puntuación
-
Vendido
-
Páginas
5
Subido en
22-03-2025
Escrito en
2022/2023

Complete collection of resources for IB computer science - Helped me get a 7 in HL Comp Sci

Institución
Grado









Ups! No podemos cargar tu documento ahora. Inténtalo de nuevo o contacta con soporte.

Escuela, estudio y materia

Institución
Estudio
Desconocido
Grado

Información del documento

Subido en
22 de marzo de 2025
Número de páginas
5
Escrito en
2022/2023
Tipo
Notas de lectura
Profesor(es)
Bob q.
Contiene
Todas las clases

Temas

Vista previa del contenido

OBJECT-ORIENTATED PROGRAMMING

Concept of OOP
Object: An abstract entity with attributes (that describe the entity) and methods it can perform, e.g.
car object's attributes= wheels, windows, brakes etc. Methods= start up, change gear, turn on
headlights etc.

An object is an instance/ instantiation of a class. A class is like a template for an object- code for
the methods and attributes but doesn't take up any memory until an object is instantiated from the
template, with its own copy of the class variables and methods. You can create multiple
instantiated objects from the same class.

Unified Modelling Language (UML)

Class Name
Data / variables / attributes


Actions/ methods




Dependency (“uses” relationship): Implementation of an object depends on/uses one or more
other objects. e.g. Client uses supplier, client is dependent on supplier. Student uses school, bus
uses roads.




Aggregation (“has a” relationship): One object belongs to another and no other object, but both
are independent and can exist without the other. e.g. Car has passengers, but passengers can still
exist and function normally without the car




Composition (“has a”): Like aggregation but the object can't function or exist without the other.
e.g. there can't be a certain department in a hospital if the hospital doesn't exist
Note: Sometimes in IB aggregations and composition are both referred to as aggregation. e.g. could say a
student having hands is an example of an aggregation




Inheritance (“is a”): One object/subclass is a specialised, altered form of another object. It
inherits all the attributes of the parent class, but also has additional ones e.g. Current account is a
type of bank account, bus is a vehicle so has an engine like all vehicles, student is a person so has
a name




Best to reduce dependencies to increase the ability to reuse code. If we depend on another class
to provide useful methods, have to have the parent class/object available whenever we use the
object.

, Data types
 Integer: Stores whole numbers (Java int)
 Real: Stores decimal numbers. Floating point. (Java double or float)
 String: Text data, characters (Java String)
 Boolean: True/ false value (Java boolean)
 Long: Stores a 64-bit integer, can be positive or negative

Data items are passed to and from methods as parameters, which are restricted by pass-by-value
of class relationship. Methods can return at most one data item, e.g. a method that can only return
int or is a void (doesn’t return anything).

Benefits of using different data types...
 Different operations- can be carried out depending upon the type, e.g. calculations with
integer “quantity” variable (can’t do that with a String), Double allows decimals (mirrors real-
life scenarios and allows precise calculations)
 Reduce memory usage- e.g. a whole number takes less space as an integer value than
as a double

Pass-by-value: Means that a value is copied from the main program into the parameter to be used
by the method. If the value (from the parameter) is changed in the method, it doesn’t affect the
original values in the main program. e.g. in Java, the method would have to return the new value,
and then you’d set the original value to the returned value- only then will it change.??
Pass-by-reference: Does not have the value copied into the parameter, only the memory location
(reference/ pointer) is copied. Method can change the variable values in the main program.
[don’t take my word on this one]


Features of OOP

Encapsulation: Data and methods/actions are limited to the object in which they are defined-
places all attributes and methods relating to a certain object/entity together. Private variables can
be used and only accessed outside the class by specific get and set methods.
Advantages
 Class can restrict the way data and methods are altered or called- increases security, since
it ensures variables aren't accidentally changed by another part of the program. Especially
important for team projects.
 Can hide the way data is stored- increase security
 Since relevant attributes/methods are all together, it provides a clearer understanding of
each section of the problem = more efficient programming (faster, less errors etc)

Inheritance: A parent object holds common data and methods for a group of related child objects-
it is extended to create a new object with more properties and methods. The new class can over-
ride old properties and methods in the original class.
Advantages
 Extensibility: Sub-classes inherit methods, can extend them. No need to re-write methods
 Reusability: Changes and upgrades to data and methods in super-class are inherited by
the sub-class, don't need to change each sub-class manually. Less maintenance

Polymorphism: Can have several methods with the same name but different processes- different
versions of the method essentially. If in the same class, must have different parameter lists so the
compiler can tell which one to use according to what values are passed in the parameters. If not in
the same class, compiler selects method in the class currently in use.
e.g. makeSound() is different for different sub-classes of Animal, add() to savings account is
different to add() in current account- current account could take an additional value for
interest rate in its parameters.
$4.12
Accede al documento completo:

100% de satisfacción garantizada
Inmediatamente disponible después del pago
Tanto en línea como en PDF
No estas atado a nada

Conoce al vendedor
Seller avatar
BobQ2

Documento también disponible en un lote

Conoce al vendedor

Seller avatar
BobQ2 Abacus College, Oxford
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
0
Miembro desde
9 meses
Número de seguidores
0
Documentos
10
Última venta
-
IB Resource Hub

0.0

0 reseñas

5
0
4
0
3
0
2
0
1
0

Recientemente visto por ti

Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes