Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
Samenvatting

COMPLETE EXTENSIVE Summary for COS3711

Beoordeling
4.0
(3)
Verkocht
16
Pagina's
100
Geüpload op
08-09-2020
Geschreven in
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.

Meer zien Lees minder
Instelling
Vak

Voorbeeld van de inhoud

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.

Gekoppeld boek

Geschreven voor

Instelling
Vak

Documentinformatie

Heel boek samengevat?
Ja
Geüpload op
8 september 2020
Aantal pagina's
100
Geschreven in
2018/2019
Type
SAMENVATTING

Onderwerpen

$5.57
Krijg toegang tot het volledige document:
Gekocht door 16 studenten

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF


Ook beschikbaar in voordeelbundel

Beoordelingen van geverifieerde kopers

Alle 3 reviews worden weergegeven
2 jaar geleden

5 jaar geleden

4 jaar geleden

4.0

3 beoordelingen

5
1
4
1
3
1
2
0
1
0
Betrouwbare reviews op Stuvia

Alle beoordelingen zijn geschreven door echte Stuvia-gebruikers na geverifieerde aankopen.

Maak kennis met de verkoper

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
francoissmit University of South Africa (Unisa)
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
467
Lid sinds
5 jaar
Aantal volgers
264
Documenten
4
Laatst verkocht
6 maanden geleden
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 beoordelingen

5
43
4
9
3
5
2
0
1
1

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen