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
Resumen

COMPLETE EXTENSIVE Summary for COS3711

Puntuación
4.0
(3)
Vendido
16
Páginas
100
Subido en
08-09-2020
Escrito en
2018/2019

This summary contains in depth concepts, explanations and examples which will not only allow you to reduce the amount of time you have to study, but will also assist you with getting a distinction for this module. The following concepts are covered in this summary: UML Diagrams, OOP, Design patterns, Writing and reading XLM, Writing and reading files, Threads, Processes, Qt, QMetaObjects and QProperties, Widgets & GUI and Model-View architecture. In addition, this summary includes examples, exam questions and code which assists in studying and understanding concepts.

Mostrar más Leer menos
Institución
Grado

















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

Libro relacionado

Escuela, estudio y materia

Institución
Grado

Información del documento

¿Un libro?
Subido en
8 de septiembre de 2020
Número de páginas
100
Escrito en
2018/2019
Tipo
Resumen

Temas

Vista previa del contenido

UML diagrams & class design:
Syntax:




Syntax for variable and parameters: - NameVar : Type
Syntax for functions: Basically the same except it has () with parameters in
them. E.g. +FuncName(parameter list): return Type
Note: Parameters must also be name: Type
Note: Constructors don’t have type
When we inherit then child class point to parent:




Arrow points to parent class.

,When they say client they mean a class that will manage all the other classes.
Client can be class, function or just code (driver program).




Assuming that PhoneReader is class that
reads in Phone’s from a file and convert them to QList of Phone objects.


Example:

,Note if they say data members should not have to be repeated in sub-classes
means that they should be under protected.
The Reader and Writer objects can either use FilmList object or QList<Film>(i.e.
read function can return FilmList(in this case this case) or it can return
QList<Film>. But always try for FilmList
Example:




Answer

Example:




 MyPrepaid and MyContract inherit from Contract
 ContractList contains (diamond) Contract.
 Contract inherits from QObject
 Note the # sign is protected specifier.
Note:
This arrow is for inheritance:

,This arrow is for associations:




Design patterns:
 Serializer pattern
 Saves the state of an object and state is to be output to a Device,
i.e. a File, or Console window. In memento, state is saved to a list.
 Creating separate classes responsible for reading and writing of
objects.
 Pattern’s job is to store and load the state of class objects.

, o Here our objects are FilmList’s which we trying to read and write.
o Note: The reader don’t have constructor or filename member, you
pass name with read() function. The writer have constructor and
filename member. You specify filename when you create writer
Client:

,Reader and writer classes definition and implementation:
Writer:

,Reader:




**For practice change this to when Film has 2 members

, MVC design pattern
o Used to separate application’s concerns
o This pattern specifies that an application consists of data model,
presentation information and control information. These must be
separated.
o Model: is the application object that carries data.
o View: is the screen representation of the model
o Controller: defines a way the user interface reacts to user input
o Advantages:
MVC patterns says that the Model (responsible for maintaining
the data), the view (responsible for displaying data) and the
controller (responsible for handling events that impact both data
and model) be kept separate classes.
 Extensibility: This separation enables views and controllers
to be added or removed without requiring changes to the
model which allows for additional functionality to be added.
 Maintainability: Separating the model, view and controller
code means that we can focus on managing them
separately instead of managing all of them at once. This
makes it easier to maintain.
 Reusability: The MVC pattern allows us to reuse code by
enabling substitution of one model for another, or one view
for another.
o d

, Implementation:
Model: Responsible to retrieve data and to set the data.
// Model is responsible for data get and set
class Model {
public:
Model(const string &data) {
this->SetData(data); Set data in constructor
}
Model() { } // default constructor
string Data(){
return this->data;
}

void SetData(const string &data) {
this->data = data;
if (this->event != nullptr) { // data change callback event
this->event(data);
}
}
// register the event when data changes.
void RegisterDataChangeHandler(DataChangeHandler handler) {

, this->event = handler;
}
private:
string data = "";
DataChangeHandler event = nullptr;
};



View: Responsible to present data to users. Use the model to represent
thus must have Model instance
#pragma once
#include <iostream>
#include "model.h"
// View is responsible to present data to users
class View {
public:
View(const Model &model) {
this->model = model;
}
View() {}
void SetModel(const Model &model) {
this->model = model;
}
void Render() {
std::cout << "Model Data = " << model.Data() << endl;
}
private:
Model model; //model instance
};
Controller: Can ask Model to update data thus have object of Model in this
class. Can ask View to change it’s presentation, thus it also have instance of
View
// Controller combines Model and View
class Controller {
public:
Controller(const Model &model, const View &view) {
this->SetModel(model);
this->SetView(view);
}
void SetModel(const Model &model) {
this->model = model;
}
void SetView(const View &view) {
this->view = view;
}
// when application starts
void OnLoad() {
this->view.Render();
}
private:
//instance of view and model
Model model;
View view;
};
Client: Uses the pattern.
$5.38
Accede al documento completo:
Comprado por 16 estudiantes

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


Documento también disponible en un lote

Reseñas de compradores verificados

Se muestran los 3 comentarios
2 año hace

4 año hace

4 año hace

4.0

3 reseñas

5
1
4
1
3
1
2
0
1
0
Reseñas confiables sobre Stuvia

Todas las reseñas las realizan usuarios reales de Stuvia después de compras verificadas.

Conoce al vendedor

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
francoissmit University of South Africa (Unisa)
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
467
Miembro desde
5 año
Número de seguidores
264
Documentos
4
Última venta
3 semanas hace
Computer Science Notes guaranteed to make you pass and finished my BSc in Computing degree

Over the years I have excelled at making summaries. These summaries I used to get 27/31 distinctions. What are you waiting for? You can get a distinction as well if you use my summaries and notes.

4.6

58 reseñas

5
43
4
9
3
5
2
0
1
1

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