Skip to content
This repository was archived by the owner on Nov 20, 2019. It is now read-only.

Commit 722fda1

Browse files
committed
Clarify callbacks, highlighting, minor stuff
1 parent f0e5df6 commit 722fda1

8 files changed

Lines changed: 455 additions & 36 deletions

File tree

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ FILTERS = -F "filters/abbrevs.py" -F "filters/pandoc-svg.py" -F pandoc-crossref
66
all: $(NAME).pdf
77

88
$(NAME).pdf: $(NAME).tex
9-
latexmk -interaction=nonstopmode -pdf $(NAME).tex
9+
latexmk -g -interaction=nonstopmode -pdf $(NAME).tex
1010

1111
$(NAME).tex: $(FILES)
12-
pandoc -o $@ --biblatex --template template.latex $(FILTERS) $(FILES)
12+
pandoc -o $@ --highlight-style=tango --biblatex --template template.latex $(FILTERS) $(FILES)
1313

1414
graphics:
1515
@for svg in `find images/*.svg`; \

ReleaseChecklist.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ Things that need to be done before release.
77
* [ ] Check cite ordering
88
* [ ] Update syntax highlighting
99
* [ ] Check citations in listings
10-
* [ ] Check for `code` in listing captions
10+
* [ ] Check for `code` in listing captions
11+
* [ ] Set \DataTypeTok to \KeywordTok

images/future_based.pdf

22.8 KB
Binary file not shown.

images/future_based.svg

Lines changed: 345 additions & 0 deletions
Loading

images/future_based.tex

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
\documentclass[crop,tikz]{standalone}
2+
\usetikzlibrary{positioning,arrows,fit,calc}
3+
\pgfdeclarelayer{bg}
4+
\pgfsetlayers{bg,main}
5+
\tikzset{
6+
>=stealth'
7+
}
8+
\usepackage{tikz-uml}
9+
\begin{document}
10+
\begin{tikzpicture}[
11+
node distance = 10mm,
12+
every node/.style = {
13+
font = \sffamily
14+
},
15+
instance/.style = {
16+
draw,
17+
minimum height = 1.5\baselineskip,
18+
thick
19+
},
20+
lifeline/.style = {
21+
dotted,
22+
thick
23+
},
24+
activity/.style = {
25+
draw,
26+
fill=white,
27+
minimum width = 0.5cm
28+
}
29+
]
30+
31+
\node[instance] (gui) {:GUI Thread};
32+
\node[instance, right=of gui] (background) {:Background Thread};
33+
\umlactor[left=1.3cm of gui, yshift=2mm] {User};
34+
\node[above=-2mm of User] {User};
35+
36+
37+
\draw[lifeline] (gui.south) -- +(0,-6);
38+
\draw[lifeline] (background.south) -- +(0,-6);
39+
\node[below=-3mm of User, fill=white, minimum height=0.75cm, minimum width=2cm] {};
40+
\draw[lifeline, yshift=2mm] (gui.south -| User.south) -- +(0,-6);
41+
42+
\node[activity, below=4mm of gui, minimum height=0.5cm] (call) {};
43+
\node[activity, below=4mm of background, minimum height=4cm] (exec) {};
44+
45+
\draw[->] (call) -- node[above]{verifyDuplicates()} (call -| exec.west);
46+
47+
\node[activity, below=40mm of gui, minimum height=1.5cm] (success) {};
48+
49+
\draw[->, dashed] (exec.262) -- node[above]{success} (exec.262 -| success.east);
50+
51+
\draw[->] (success) -- +(5mm,0) |- node[right, yshift=3mm] {handleDuplicates()} (success.295);
52+
53+
\node[activity, below=12mm of User, minimum height=2cm] (interaction) {};
54+
\node[activity, below=16mm of gui, minimum height=17mm] (action) {};
55+
56+
\draw[->] (interaction.70) -- (interaction.70 -| action.west);
57+
\draw[->, dashed] (action.250) -- (action.250 -| interaction.east);
58+
59+
\end{tikzpicture}
60+
61+
\end{document}

includes/config.tex

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -47,33 +47,6 @@
4747
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
4848
% use microtype if available
4949
\IfFileExists{microtype.sty}{\usepackage{microtype}}{}
50-
\usepackage{color}
51-
\usepackage{fancyvrb}
52-
\newcommand{\VerbBar}{|}
53-
\newcommand{\VERB}{\Verb[commandchars=\\\{\}]}
54-
\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}}
55-
% Add ',fontsize=\small' for more characters per line
56-
\usepackage{framed}
57-
\definecolor{shadecolor}{RGB}{248,248,248}
58-
\newenvironment{Shaded}{\begin{snugshade}}{\end{snugshade}}
59-
\newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.13,0.29,0.53}{\textbf{{#1}}}}
60-
\newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.13,0.29,0.53}{{#1}}}
61-
\newcommand{\DecValTok}[1]{\textcolor[rgb]{0.00,0.00,0.81}{{#1}}}
62-
\newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.00,0.00,0.81}{{#1}}}
63-
\newcommand{\FloatTok}[1]{\textcolor[rgb]{0.00,0.00,0.81}{{#1}}}
64-
\newcommand{\CharTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{{#1}}}
65-
\newcommand{\StringTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{{#1}}}
66-
\newcommand{\CommentTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textit{{#1}}}}
67-
\newcommand{\OtherTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{{#1}}}
68-
\newcommand{\AlertTok}[1]{\textcolor[rgb]{0.94,0.16,0.16}{{#1}}}
69-
\newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.00,0.00,0.00}{{#1}}}
70-
\newcommand{\RegionMarkerTok}[1]{{#1}}
71-
\newcommand{\ErrorTok}[1]{\textbf{{#1}}}
72-
\newcommand{\NormalTok}[1]{{#1}}
73-
\newcommand{\BuiltInTok}[1]{{#1}}
74-
\newcommand{\SpecialCharTok}[1]{\StringTok{#1}}
75-
\newcommand{\ImportTok}[1]{{#1}}
76-
\newcommand{\ExtensionTok}[1]{\textcolor[rgb]{0.13,0.29,0.53}{\textbf{{#1}}}}
7750

7851
%
7952
% Einbindung des Grafik-Pakets

template.latex

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
$for(header-includes)$
66
$header-includes$
77
$endfor$
8+
$if(highlighting-macros)$
9+
$highlighting-macros$
10+
$endif$
811

912
\addbibresource{$bibliography$}
1013
%

thesis.md

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ its dependencies as mentioned in [@sec:j9_adv]. This is done using a module
398398
descriptor, a file called `module-info.java` in the root package, that will be
399399
compiled as classes to a file called `module-info.class` [@Mac2017].
400400
[@lst:module-desc] shows the module descriptor of the default Java module
401-
`java.prefs` that contains Java's Preferences +API as an example^[All examples in [@sec:j9_impl] were taken from the source code of Oracle's JDK version 9.0.4. The source code is available in `${JAVA_HOME}/lib/src.zip`.].
401+
`java.prefs` that contains Java's Preferences +API as an example^[Most examples in [@sec:j9_impl] were taken from the source code of Oracle's JDK version 9.0.4. The source code is available in `${JAVA_HOME}/lib/src.zip`.].
402402

403403
```{#lst:module-desc .java caption="Excerpt of Module Descriptor of `java.prefs`"}
404404
module java.prefs {
@@ -1028,6 +1028,31 @@ open module org.jabref {
10281028
}
10291029
```
10301030

1031+
An event bus is an implementation of the Observer pattern, implementing a
1032+
publish-subscribe style communication.
1033+
The event bus handles the dispatching of events without requiring publishers to
1034+
explicitly know who the subscribers are or vice-versa.
1035+
As shown in [@lst:guava], Guava uses annotations, such as the `@Subscribe`
1036+
annotation, to register event listeners in an event bus.
1037+
Those annotations are accessed using reflection, thus Guava requires the
1038+
packages to be open.
1039+
Since the event bus is an integral part of JabRef and is used across many
1040+
packages, the whole module was declared as open, instead of opening each package
1041+
on its own.
1042+
1043+
```{#lst:guava .java caption="Excerpt of JabRef's `BibDatabase`"}
1044+
package org.jabref.model.database;
1045+
// [...]
1046+
public class BibDatabase {
1047+
// [...]
1048+
@Subscribe
1049+
private void relayEntryChangeEvent(FieldChangedEvent event) {
1050+
eventBus.post(event);
1051+
}
1052+
// [...]
1053+
}
1054+
```
1055+
10311056
## Upgrading Libraries
10321057
10331058
In the second iteration the focus lay on updating the libraries removed in
@@ -1098,10 +1123,11 @@ libraries.
10981123
| 2018-04-28 | Bug report created |
10991124
| 2018-05-18 | Code contribution provided |
11001125
| 2018-05-29 | Proposed fix accepted by library maintainer |
1101-
| 2018-xx-xx | Version including fix published |
11021126
11031127
: Timeline of the bug report for latex2unicode {#tbl:l2u-split}
11041128
1129+
The maintainer of latex2unicode accepted the code contribution, but no version
1130+
including the fixes were released as of writing.
11051131
The maintainer of the dependencies fastparse and sourcecode remained
11061132
unresponsive to the proposed fixes both provided on 2018-05-18 as of writing.
11071133
Possible solutions to work around the problem include providing a manually
@@ -1131,7 +1157,7 @@ The problem was reported to the library maintainers of ApplicationInsights^[[htt
11311157
| ------------- | ------------------------------------------------------------ |
11321158
| 2018-05-05 | Bug Report Created |
11331159
| 2018-06-08 | Bug fixed by maintainers of the library |
1134-
| 2018-xx-xx | Version including fix published |
1160+
| 2018-07-31 | Version including fix published |
11351161
11361162
: Timeline of the bug report of missed package relocation in Google Guava {#tbl:ai-split}
11371163
@@ -1202,14 +1228,23 @@ BackgroundTask.wrap(this::verifyDuplicates)
12021228
.executeWith(Globals.TASK_EXECUTOR);
12031229
```
12041230

1205-
**To do: explain this more**
1206-
12071231
[@lst:background_task] shows how background tasks are used in JabRef. The
12081232
method `verifyDuplicates` is executed on a thread of the `Globals.TASK_EXECUTOR`
12091233
executor service. When the verification of duplicates succeeds the method
12101234
`handleDuplicates` is called on the JavaFX +GUI thread, failures are not handled
12111235
in this case.
12121236

1237+
![Interaction of the Callbacks between Threads](images/future_based.svg){#fig:callbacks}
1238+
1239+
[@fig:callbacks] shows the interaction of the +GUI thread and the background
1240+
thread.
1241+
While the time-consuming action -- in this case `verifyDuplicates()` -- is
1242+
called on the background thread, the +GUI thread stays responsive and can handle
1243+
user interactions.
1244+
Once the action is finished, either the success case -- here
1245+
`handleDuplicates()` -- or an error case is executed on the +GUI thread to give
1246+
the user feedback.
1247+
12131248
# Modularizing JabRef {#sec:modularization}
12141249

12151250
**To do: only runnable with restrictions**
@@ -1274,7 +1309,8 @@ Second, the dependency on the Preferences module could be removed. Depending on
12741309
the type of the dependency this may be a viable solution, for example if
12751310
alternatives for the used functionalities are available. In this case however,
12761311
removing the dependency would have lead to code duplication, which is often
1277-
unfavorable for enabling good software maintainability.
1312+
unfavorable for enabling good software maintainability, because the duplicated
1313+
code would then need to be maintained in both instances.
12781314

12791315
Third, the components Logic and Preferences could be joined in one module. This
12801316
would weaken the encapsulation of the components, but especially if there

0 commit comments

Comments
 (0)