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

Summary System Design Methods (final-term) | UU informatiekunde

Puntuación
-
Vendido
11
Páginas
11
Subido en
11-04-2022
Escrito en
2021/2022

This is a handy overview and summary of the final-term material for UU System Design Methods. I wrote it in a way that it is easy to understand, as this subject is quite hard and difficult to understand from the lectures only. Good luck with learning!

Mostrar más Leer menos
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
Grado

Información del documento

Subido en
11 de abril de 2022
Número de páginas
11
Escrito en
2021/2022
Tipo
Resumen

Temas

Vista previa del contenido

Final-term exam
Abstract factory (design pattern)

The factory pattern separates creation from usage. Instead of class A directly creating a concrete
strategy object, it uses a factory that creates the desired concrete strategy for class A. This way, class
A doesn’t know anything directly of the subclasses of class B, but the factory does.
The context class (A) uses methods from the abstract class(es), and creates the concrete strategy
objects using methods from the abstract factory class.




Design by contract & hoarer logic

Software crisis: In the early days, hardware was expensive and tricky to develop. However, with the
invention of programming languages and compilers that made building systems easier, programmers
could build more complex systems. Software became much more expensive than hardware.


Hoare logic: In order to battle the complexity of code, Tony Hoar came up with a logic language to
prove things about programs → Hoare logic. A Hoare logic statement has 3 parts:

1. A precondition (P) 2. A program (C) 3. A postcondition (Q)

, If a precondition P holds before the execution of program C, then the postcondition Q will hold after.
Otherwise, C does not terminate. Examples of Hoare logic statements:


o P: x > 3 | C: x+1 | Q: x > 4) → Valid

o P: x > 3 | C: x+1 | Q: x > 40) → Invalid

o P : x > 3 | C : y=4, x=y | Q : x=4 → Valid
o The precondition is stronger than needed here, because the statement is not only
valid for all x’s above 3, but for all x’s in general.

o When there is ‘while true’ in there, the execution of the program never ends / it does
not terminate, so you can never ascertain a postcondition → always valid.



Reasoning rules: Hoare designed a series of rules to reason about programs, with which you can
write more robust software and proof things about your code (e.g. show that it terminates).

❖ Skip: if you do nothing, the precondition will hold.

❖ Assignment: the precondition is also true when you substitute the x’s in the precondition by
the value that you assign to x in the ‘program’ part. You can use this rule to determine the
precondition if it is not given. If the program and postcondition are given, you replace the x’s
in the postcondition with the assigned value in the program.
o Example: → precondition is

❖ Composition: suppose we know that , we can deduce that to


❖ Conditional rule: allows us to combine two logic statements with the same post condition
into a single one with an if-statement.

You can use the conditional rule to split up an if-statement into two separate logic
statements, the then- and else-statement.


❖ Consequence rule: if we know that , then is also
valid. This may strengthen preconditions and weaken postconditions. Example:
o If the precondition of a Hoar statement is “1 <= x <= 9”, the Hoar statement would be
valid for any precondition that can be implied from the initial precondition. In this
case, that could be for example “0 <= x <= 15”. The same rule accounts for
postconditions.



PS, remember: if a predicate A implies B, then A is stronger / more specific than B.
Range [2-9] can imply [0-14], since that includes all the values of the range [2-9]. The other way
around, [0-14] does not imply [2-9], since values like 10, 11, 12… are left out then.
$4.82
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
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.
semstroop Universiteit Utrecht
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
442
Miembro desde
6 año
Número de seguidores
247
Documentos
99
Última venta
2 semanas hace

3.9

68 reseñas

5
24
4
30
3
6
2
1
1
7

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