Merge lp:~julien-spautz/cable/authors-hacking-thanks into lp:cable

Proposed by Julien Spautz
Status: Merged
Approved by: Eduard Gotwig
Approved revision: 119
Merged at revision: 118
Proposed branch: lp:~julien-spautz/cable/authors-hacking-thanks
Merge into: lp:cable
Diff against target: 297 lines (+142/-123)
5 files modified
AUTHORS (+5/-0)
HACKING (+121/-0)
README.rst (+0/-121)
THANKS (+10/-0)
src/Cable.vala (+6/-2)
To merge this branch: bzr merge lp:~julien-spautz/cable/authors-hacking-thanks
Reviewer Review Type Date Requested Status
Eduard Gotwig (community) Needs Fixing
Review via email: mp+180967@code.launchpad.net

Description of the change

added AUTHORS and THANKS files
renamed README to HACKING

To post a comment you must log in.
Revision history for this message
Tom Beckmann (tombeckmann) wrote :

My email changed a while ago, it's tomjonabc(at)gmail(dot)com now, did you find it that way somewhere else? Maybe I should fix it there too. Thanks!

Revision history for this message
Julien Spautz (julien-spautz) wrote :

I found it in the src/Cable.vala file. Don't worry, I'll fix it for you.

118. By Julien Spautz

fixed Tom's email

Revision history for this message
Eduard Gotwig (gotwig) wrote :

I would be glad if you could add

https://launchpad.net/~oppifjellet

and

https://launchpad.net/~nkanaev

to the contributors part.

They've done a great job on Cable development and bug fixing!

btw. when can we merge this?

review: Needs Fixing
119. By Julien Spautz

added 2 more contributors

Revision history for this message
Julien Spautz (julien-spautz) wrote :

The branch is ready to be merged now.

> I would be glad if you could add
>
>
> https://launchpad.net/~oppifjellet
>
> and
>
> https://launchpad.net/~nkanaev
>
> to the contributors part.
>
> They've done a great job on Cable development and bug fixing!
>
> btw. when can we merge this?

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'AUTHORS'
--- AUTHORS 1970-01-01 00:00:00 +0000
+++ AUTHORS 2013-08-21 01:40:39 +0000
@@ -0,0 +1,5 @@
1Akshay Shekher <voldyman666@gmail.com>
2Auroral Xylon <avlabs314@gmail.com>
3Eduard Gotwig <gotwig@ubuntu.com>
4Julien Spautz <spautz.julien@gmail.com
5Tom Beckmann <tomjonabc@gmail.com>
06
=== added file 'HACKING'
--- HACKING 1970-01-01 00:00:00 +0000
+++ HACKING 2013-08-21 01:40:39 +0000
@@ -0,0 +1,121 @@
1Developer Documentation
2=======================
3
4This document explains how cable works internally and what guidelines you should follow when developing for it.
5
6Design Pattern
7==============
8
9The current design pattern could be called "Passive View", see http://martinfowler.com/eaaDev/PassiveScreen.html.
10
11The View
12--------
13
14The View is a software layer that acts as an interface between the program and the user. The View can be acted upon by the user and notify the application of these events (using signals). But its state can also be changed by the application to present some content to the user or request input from the user.
15
16In the ``src/View`` folder you will find interfaces that the Controller uses to communicate with the View. The actual implementation can be found in the ``src/Widgets`` folder. This separation bears the advantage that we can change the implementation of the View completely as long as we implement the interfaces. This makes the application independant of the GUI, and we could replace it by a text-based UI or even by a computer simulated UI to run unit tests.
17
18Nota bene: The View does not know about any other module (except possibly ``src/Utils`` which contains functions accessible to everyone)
19
20The Model/Backend
21-----------------
22
23The traditional name 'Model' doesn't really fit Cable's architecture, as it is based on an interactive networking protocol (namely the IRC protocol) and not on a set of data or even a database. The following modules form the backend of the app and are more or less independant of each other.
24
25**Irc**
26
27The Irc namespace contains wrapper classes that provide convenient methods, properties and signals that map to dbus calls to the maki IRC daemon. Following naming conventions have been used:
28
29 - All signals are prefixed with ``event_``
30 - All methods that send commands to the server are prefixed with ``send_``
31 - Most methods that yield an immediate return value are properties, if it makes sense
32
33Examples:
34
35 ``public void send_join (string key = "");``
36
37 ``public void event_join (string from);``
38
39 ``public bool joined { get; }``
40
41**Settings**
42
43The Settings namespace contains convenient interfaces to the dconf/gsettings using Granite.Services.Settings.
44
45**Services**
46
47The Services should (whenever possible) be static classes. Currently there is a ``Launcher`` class as interface to libunity and a ``Notification`` class as interface to libnotify. They should have an extremely simple API and contain only functions that are actually used in the app. For example, here you see the ``Cable.Services.Launcher`` API:
48
49 ``public static int64 jobs { get; set }``
50
51 ``public static double progress { get; set }``
52
53 ``public static bool urgent { get; set }``
54
55 ``public static void init ();``
56
57**Utils**
58
59This namespace contains some useful functions and classes that are used in multiple places in the app. The Network and Identity classes, for example, store all networks and identities in a convenient way and make sure no duplicates will be created.
60
61The Controller
62--------------
63
64The controller is the brain of the app in the sense that it connects different classes that don't know about each other and contains most of the program logic. Conversely, no one knows about the Controller, which means no one can actively act upon the Controller. To communicate with other parts of the application, the Controller connects to their public signals, or uses their public methods and properties.
65
66********************************************************************************
67
68Tiers
69=====
70
71Now that you know about the separation of concerns implemented by the Passive View pattern, I want to explain a recurring pattern in the app which can be broken up into 3 (or 4) tiers, a tree-like hierarchial structure. It looks like this:
72
73 Application Tier (one instance)
74
75 ↓ (n)
76
77 Window Tier (n windows per application, unless artificially restricted)
78
79 ↓ (n)
80
81 Server Tier (n server connections can be established per window)
82
83 ↓ (n)
84
85 Channel Tier (n channels per server)
86
87This means that the app owns multiple windows, each window has a list of servers, which in turn own any number of channels. This structure exists in many places in the program, which is why it is worth noticing. Obviously it exists in the View/Widgets layer, but also the controller is split into multiple classes, to get cleaner code.
88
89In order to make communication between different parts of the application as clean and abstract as possible, it shall *only* occur via these tiers. That is you should not (and cannot) access, any widgets from the Controller, as all communication has to happen via ``View.Window``, ``View.Server`` or ``View.Channel``.
90
91So instead of calling something like this from the controller:
92
93 ``channel_view.room.topic.text = new_topic;``
94
95you would use:
96
97 ``channel_view.topic = new_topic;``
98
99and the channel widget will take care of the forwarding.
100
101********************************************************************************
102
103Unit Testing
104============
105
106Unit Testing, Test Driven Development, Extreme Programming… What can we learn from these techniques?
107
108GLib provides a very basic way to implement unit tests, and libgee built their TestCase class on it. It allows for simple unit tests, nothing fancy but really straight forward. The main question is where does it make sense to apply unit tests and how do we implement them in a sensible way.
109
110Most (virtually all) of the logic lies in the Controller module, as intended. This allows us to bypass the View and replace it by a fake View that implements the same interface but is controlled by the programm. In the same way, we can replace the backend and imitate it's interface to provide a fake backend and simulate really weird server bugs that only happen very rarely and can therefore not be reproduced reliably in a real world environement.
111
112Functions and classes in the Utils namespace can also easily be unit tested as they are not connected with the rest of the program. An example would be the URL parsing function.
113
114Note that none of this has been implemented (except to a very simple test which can be run using the ``--unit-test`` CLI switch, just as a proof of concept).
115
116********************************************************************************
117
118Questions?
119==========
120
121If you have any questions relating to the architecture of the app, shoot me an email at <spautz.julien@gmail.com> or ask me on IRC (#elementary-dev or #elementary-apps on irc.freenode.net). My nick is julienspautz.
0\ No newline at end of file122\ No newline at end of file
1123
=== removed file 'README.rst'
--- README.rst 2013-08-06 15:32:12 +0000
+++ README.rst 1970-01-01 00:00:00 +0000
@@ -1,121 +0,0 @@
1Developer Documentation
2=======================
3
4This document explains how cable works internally and what guidelines you should follow when developing for it.
5
6Design Pattern
7==============
8
9The current design pattern could be called "Passive View", see http://martinfowler.com/eaaDev/PassiveScreen.html.
10
11The View
12--------
13
14The View is a software layer that acts as an interface between the program and the user. The View can be acted upon by the user and notify the application of these events (using signals). But its state can also be changed by the application to present some content to the user or request input from the user.
15
16In the ``src/View`` folder you will find interfaces that the Controller uses to communicate with the View. The actual implementation can be found in the ``src/Widgets`` folder. This separation bears the advantage that we can change the implementation of the View completely as long as we implement the interfaces. This makes the application independant of the GUI, and we could replace it by a text-based UI or even by a computer simulated UI to run unit tests.
17
18Nota bene: The View does not know about any other module (except possibly ``src/Utils`` which contains functions accessible to everyone)
19
20The Model/Backend
21-----------------
22
23The traditional name 'Model' doesn't really fit Cable's architecture, as it is based on an interactive networking protocol (namely the IRC protocol) and not on a set of data or even a database. The following modules form the backend of the app and are more or less independant of each other.
24
25**Irc**
26
27The Irc namespace contains wrapper classes that provide convenient methods, properties and signals that map to dbus calls to the maki IRC daemon. Following naming conventions have been used:
28
29 - All signals are prefixed with ``event_``
30 - All methods that send commands to the server are prefixed with ``send_``
31 - Most methods that yield an immediate return value are properties, if it makes sense
32
33Examples:
34
35 ``public void send_join (string key = "");``
36
37 ``public void event_join (string from);``
38
39 ``public bool joined { get; }``
40
41**Settings**
42
43The Settings namespace contains convenient interfaces to the dconf/gsettings using Granite.Services.Settings.
44
45**Services**
46
47The Services should (whenever possible) be static classes. Currently there is a ``Launcher`` class as interface to libunity and a ``Notification`` class as interface to libnotify. They should have an extremely simple API and contain only functions that are actually used in the app. For example, here you see the ``Cable.Services.Launcher`` API:
48
49 ``public static int64 jobs { get; set }``
50
51 ``public static double progress { get; set }``
52
53 ``public static bool urgent { get; set }``
54
55 ``public static void init ();``
56
57**Utils**
58
59This namespace contains some useful functions and classes that are used in multiple places in the app. The Network and Identity classes, for example, store all networks and identities in a convenient way and make sure no duplicates will be created.
60
61The Controller
62--------------
63
64The controller is the brain of the app in the sense that it connects different classes that don't know about each other and contains most of the program logic. Conversely, no one knows about the Controller, which means no one can actively act upon the Controller. To communicate with other parts of the application, the Controller connects to their public signals, or uses their public methods and properties.
65
66********************************************************************************
67
68Tiers
69=====
70
71Now that you know about the separation of concerns implemented by the Passive View pattern, I want to explain a recurring pattern in the app which can be broken up into 3 (or 4) tiers, a tree-like hierarchial structure. It looks like this:
72
73 Application Tier (one instance)
74
75 ↓ (n)
76
77 Window Tier (n windows per application, unless artificially restricted)
78
79 ↓ (n)
80
81 Server Tier (n server connections can be established per window)
82
83 ↓ (n)
84
85 Channel Tier (n channels per server)
86
87This means that the app owns multiple windows, each window has a list of servers, which in turn own any number of channels. This structure exists in many places in the program, which is why it is worth noticing. Obviously it exists in the View/Widgets layer, but also the controller is split into multiple classes, to get cleaner code.
88
89In order to make communication between different parts of the application as clean and abstract as possible, it shall *only* occur via these tiers. That is you should not (and cannot) access, any widgets from the Controller, as all communication has to happen via ``View.Window``, ``View.Server`` or ``View.Channel``.
90
91So instead of calling something like this from the controller:
92
93 ``channel_view.room.topic.text = new_topic;``
94
95you would use:
96
97 ``channel_view.topic = new_topic;``
98
99and the channel widget will take care of the forwarding.
100
101********************************************************************************
102
103Unit Testing
104============
105
106Unit Testing, Test Driven Development, Extreme Programming… What can we learn from these techniques?
107
108GLib provides a very basic way to implement unit tests, and libgee built their TestCase class on it. It allows for simple unit tests, nothing fancy but really straight forward. The main question is where does it make sense to apply unit tests and how do we implement them in a sensible way.
109
110Most (virtually all) of the logic lies in the Controller module, as intended. This allows us to bypass the View and replace it by a fake View that implements the same interface but is controlled by the programm. In the same way, we can replace the backend and imitate it's interface to provide a fake backend and simulate really weird server bugs that only happen very rarely and can therefore not be reproduced reliably in a real world environement.
111
112Functions and classes in the Utils namespace can also easily be unit tested as they are not connected with the rest of the program. An example would be the URL parsing function.
113
114Note that none of this has been implemented (except to a very simple test which can be run using the ``--unit-test`` CLI switch, just as a proof of concept).
115
116********************************************************************************
117
118Questions?
119==========
120
121If you have any questions relating to the architecture of the app, shoot me an email at <spautz.julien@gmail.com> or ask me on IRC (#elementary-dev or #elementary-apps on irc.freenode.net). My nick is julienspautz.
122\ No newline at end of file0\ No newline at end of file
1231
=== added file 'THANKS'
--- THANKS 1970-01-01 00:00:00 +0000
+++ THANKS 2013-08-21 01:40:39 +0000
@@ -0,0 +1,10 @@
1The Cable team would like to thank the following code contributors:
2
3Alexander Wilms <alexander.wilms@zoho.com>
4Corentin Noël
5Daniele Simonetti
6Evan Banyash <ebanyash@gmail.com>
7Kristjan Vool <tictac7x@gmail.com>
8Mario Guerriero
9nkanaev <nkanaev@live.com>
10Paulo Galardi
011
=== modified file 'src/Cable.vala'
--- src/Cable.vala 2013-08-06 15:32:12 +0000
+++ src/Cable.vala 2013-08-21 01:40:39 +0000
@@ -66,8 +66,12 @@
66 help_url = "https://answers.launchpad.net/cable";66 help_url = "https://answers.launchpad.net/cable";
67 translate_url = "https://translations.launchpad.net/cable";67 translate_url = "https://translations.launchpad.net/cable";
6868
69 about_authors = {"Akshay Shekher <voldyman666@gmail.com", "Auroral Xylon <avlabs314@gmail.com>", "Eduard Gotwig <gotwig@ubuntu.com>", "Julien Spautz <spautz.julien@gmail.com", "Tom Beckmann <tombeckmann@online.de>"};69 about_authors = {"Akshay Shekher <voldyman666@gmail.com>",
70 about_documenters = {"Tom Beckmann <tombeckmann@online.de>"};70 "Auroral Xylon <avlabs314@gmail.com>",
71 "Eduard Gotwig <gotwig@ubuntu.com>",
72 "Julien Spautz <spautz.julien@gmail.com>",
73 "Tom Beckmann <tomjonabc@gmail.com>"};
74 about_documenters = {};
71 about_artists = {"Harvey Cabaguio <harveycabaguio@gmail.com"};75 about_artists = {"Harvey Cabaguio <harveycabaguio@gmail.com"};
72 about_comments = _("Development release, not all features implemented");76 about_comments = _("Development release, not all features implemented");
73 about_translators = "Launchpad Translators";77 about_translators = "Launchpad Translators";

Subscribers

People subscribed via source and target branches

to all changes: