• R/O
  • SSH

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

修订版a9e469879f744abd94629bafa82ac94557f8bb55 (tree)
时间2020-03-26 20:17:31
作者Albert Mietus < albert AT mietus DOT nl >
CommiterAlbert Mietus < albert AT mietus DOT nl >

Log Message

PubSub: finisched practice (final draft)

更改概述

差异

diff -r 79d39aa88931 -r a9e469879f74 SoftwareCompetence/DesignWorkShops/PubSub/practice/index.rst
--- a/SoftwareCompetence/DesignWorkShops/PubSub/practice/index.rst Thu Mar 26 11:05:57 2020 +0100
+++ b/SoftwareCompetence/DesignWorkShops/PubSub/practice/index.rst Thu Mar 26 12:17:31 2020 +0100
@@ -4,11 +4,14 @@
44 Practice
55 ========
66
7+This last section of this :ref:`PubSub` workshop is short. It only contain some practice (ideas). Two are on practicing
8+your design skills, the other two are more coding-oriented.
79
8-Design Analye
10+
11+Design Analyse
912 ==============
1013
11-Given the python implementation, including the shown “Use-Cases”: Analyse the design in detail
14+Given the python implementation, including the shown “Use-Cases”: Analyse the design in detail:
1215
1316 1. Make a (quick) static design-analyse.
1417
@@ -19,18 +22,66 @@
1922 At least a sequence-diagram for each of the “use-cases”
2023
2124 Port to C/C++
22-=============
25+--------------
2326
2427 3. Can you port (or re-implement) the python examples to C/C++?
2528
26- Surely, you have to change some details; as a generic data-type (“value”) is not available.
27-
28- It is fine, to use a *string-type*. And just “print” it in the demo-callbacks (like we do)
29+ Surely, you have to change some details; as a generic data-type (“value”) is not available. It is fine, to use a
30+ *string-type*. And just “print” it in the demo-callbacks (like I did).
2931
3032 Design a cached, distributed one
3133 ================================
3234
35+The shown (conceptional) implementation works for a single process; optional with threads. In this exercise, you are
36+going to extent that for “network use”; although it will be a simple, conceptional one. Many existing protocols and
37+frameworks do exist already! The goal is *not* to challenge them, nor to *use* them.
3338
34-.. todo:: Complete this section
39+The goal is to practice your design skills!
40+|BR|
41+So, this is a (fun) design-exercise. You should be able to make a (full, conceptional) design in about an hour. That does
42+imply many fancy options should be left-out:-)
3543
36- * Design a cached, distributed one
44+4. Extent the current interface to allow pub/sub between multiple processes; optionally running on multiple computers
45+ (on the same network).
46+
47+ * The current API (:class:`~pubsub.Topic`, :meth:`~pubsub.Topic.publish` & :meth:`~pubsub.Topic.subscribe`) are not
48+ allowed to change. Adding parameters to the class initiation (“the constructor” in C++) is allowed. Adding extra
49+ methods is also allowed (but see below!).
50+
51+ * All existing Use-Cases **should** keep working (both the shown one, as many others).
52+
53+ * The main methods (:meth:`~pubsub.Topic.publish` & :meth:`~pubsub.Topic.subscribe`) should remain exactly the
54+ same. No more parameters!
55+
56+ * The default behavior should be “local” (not distributed).
57+
58+ * There is no requirement for performance. But it is expected that a second “network-get” will be resolved
59+ locally. So, use a cache to minimize networking
60+
61+ * The networking should use standard TCP/IP networking (“sockets”). No other network libraries/frameworks are
62+ allowed.
63+
64+ * A simple “serialise” will do. Assume, all computers/processes use the same endianness and other encodings.
65+ |BR|
66+ Again, use “strings” (only); then this part is easy.
67+
68+.. hint:: `Deamon <https://en.wikipedia.org/wiki/Daemon_(computing)>`_ & `lib <https://en.wikipedia.org/wiki/Library_(computing)>`_
69+
70+ An easy way to design this is to foresee *one* processes handle all the administration (the core of
71+ :class:`~pubsub.Topic`); including “calling” all the callbacks.
72+ |BR|
73+ This is typically called a **daemon**, or *services* on Windows.
74+
75+ To hide all the networking stuff, arrange a (small) library, that acts as `facade <https://en.wikipedia.org/wiki/Facade_pattern>`_
76+ and provides the (extended) :ref:`PubSub_API`.
77+
78+
79+Implement it
80+------------
81+
82+5. To check your design above is great, now implement it.
83+
84+ Or better: implement the design of you co-trainee, and ask him to implement yours!
85+
86+Remember, a design is a communication-tool: A great design contains exactly those details that your coworker needs to
87+implement is as it is meant to be, but no more. (S)He should have some freedom to optimize implementation-details.