Skip to content

Commit 9af2d8d

Browse files
committed
Upload L4 and T5
1 parent bbafca6 commit 9af2d8d

39 files changed

+1895
-6
lines changed

L4.GitMasterclass.tex

Lines changed: 296 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,296 @@
1+
\documentclass{beamer}
2+
\mode<presentation>
3+
{
4+
\usepackage{theme/theme}
5+
\setbeamercovered{transparent}
6+
}
7+
8+
\usepackage{amsmath,amssymb,amsfonts}
9+
\usepackage{times}
10+
\usepackage{graphicx}
11+
\usepackage{fancyvrb}
12+
\usepackage{array}
13+
\usepackage{colortbl}
14+
\usepackage{tabularx}
15+
\usepackage{fontspec}
16+
\usepackage{minted}
17+
\usepackage{libs/tikz-uml}
18+
19+
% Uncomment me when you need to insert code
20+
\usepackage{color}
21+
\usepackage{listings}
22+
% End Code
23+
24+
% End Header
25+
26+
% Titlepage
27+
\newcommand{\maintitle}{L4. Git Masterclass}
28+
\title{\maintitle}
29+
\author{Enterprise Software Architectures}
30+
\institute
31+
{
32+
Bachelor's Degree in Computer Engineering
33+
}
34+
\date{Academic year 2025/26}
35+
% End Titlepage
36+
37+
\AtBeginSection[]{
38+
\begin{frame}
39+
\centering
40+
\begin{beamercolorbox}[sep=8pt,center]{title}
41+
\usebeamerfont{title}\insertsectionhead
42+
\end{beamercolorbox}
43+
\end{frame}
44+
}
45+
46+
% Slides
47+
\begin{document}
48+
49+
\begin{frame}
50+
\titlepage
51+
\end{frame}
52+
53+
\begin{frame}
54+
\frametitle{\maintitle}
55+
\tableofcontents[subsectionstyle=show]
56+
\end{frame}
57+
58+
59+
\section{Block A - Fundamental Concepts}
60+
61+
\begin{frame}
62+
\frametitle{Repository}
63+
64+
\begin{itemize}
65+
\item Data structure that stores all the metadata and content of a Git project.
66+
\item \textbf{Stored locally} on your computer (\texttt{.git} directory).
67+
\item Can be synchronized with remote repositories (e.g., GitHub).
68+
\begin{itemize}
69+
\item More on that later!
70+
\end{itemize}
71+
\end{itemize}
72+
73+
\begin{block}{Create a repository}
74+
\texttt{git init}
75+
\end{block}
76+
\end{frame}
77+
78+
\begin{frame}
79+
\frametitle{Commit}
80+
81+
A repository is a \textit{directed acyclic graph (DAG)} of commits.
82+
83+
Each commit represents a \textbf{snapshot} of the working directory at a specific point in time.
84+
\begin{itemize}
85+
\item Contains metadata (author, date, message), a reference to the parent commit(s) and a diff of the changes.
86+
\item Commits are \textbf{immutable}; once created, they cannot be changed.
87+
\end{itemize}
88+
89+
\begin{block}{Checkout a commit (modify the working directory)}
90+
\texttt{git checkout <commit\_hash>}
91+
\end{block}
92+
\end{frame}
93+
94+
\begin{frame}
95+
\frametitle{Creating commits}
96+
97+
\begin{columns}
98+
\column{0.7\textwidth}
99+
Commits can be appended at any point in the graph.
100+
\begin{enumerate}
101+
\item Checkout the commit you want to use as parent.
102+
\item Make changes to the working directory and stage them (\texttt{git add}).
103+
\item Create a new commit with the staged changes (\texttt{git commit}).
104+
\end{enumerate}
105+
106+
\column{0.3\textwidth}
107+
\centering
108+
\includegraphics[width=0.8\textwidth]{images/L4/graph-1.pdf}
109+
\end{columns}
110+
111+
\end{frame}
112+
113+
\begin{frame}
114+
\frametitle{Branches and Tags}
115+
116+
\begin{columns}
117+
\column{0.7\textwidth}
118+
Both are pointers to commits.
119+
\begin{itemize}
120+
\item \textbf{Branch}: A movable pointer that represents a line of development (e.g., \texttt{main}, \texttt{feature-x}).
121+
\item \textbf{Tag}: A fixed pointer that represents a specific commit (e.g., a release version).
122+
\end{itemize}
123+
124+
\begin{block}{Create a branch pointing to current commit}
125+
\texttt{git branch my-feature}
126+
\end{block}
127+
128+
\column{0.3\textwidth}
129+
\centering
130+
\includegraphics[width=0.75\textwidth]{images/L4/graph-2.pdf}
131+
\end{columns}
132+
133+
\end{frame}
134+
135+
\begin{frame}
136+
\frametitle{Merge commits}
137+
\begin{columns}
138+
\column{0.7\textwidth}
139+
It's the only type of commit that has \textbf{more than one parent}.
140+
They are commonly used to merge two branches together.
141+
\begin{enumerate}
142+
\item Checkout one of the two parent commits.
143+
\item Merge another commit into the current one (\texttt{git merge <other\_branch>}).
144+
\end{enumerate}
145+
\begin{alertblock}{Warning}
146+
There can be \textbf{merge conflicts} if the same lines of code were modified in both branches.
147+
\end{alertblock}
148+
\column{0.3\textwidth}
149+
\centering
150+
\includegraphics[width=0.75\textwidth]{images/L4/graph-3.pdf}
151+
\end{columns}
152+
\end{frame}
153+
154+
\begin{frame}
155+
\frametitle{Solving merge conflicts}
156+
157+
\includegraphics[width=1\textwidth]{images/L4/merge.png}
158+
159+
The traditional conflict markers work well for terminal-based tools, but they \textbf{lack the original file state}, which is crucial for understanding the context of the conflict.
160+
161+
\end{frame}
162+
163+
\begin{frame}
164+
\frametitle{Solving merge conflicts}
165+
166+
\includegraphics[width=1\textwidth]{images/L4/merge-3way.png}
167+
\begin{columns}[totalwidth=\textwidth]
168+
\column{0.33\textwidth}
169+
\centering
170+
Incoming changes
171+
\column{0.33\textwidth}
172+
\centering
173+
Base version
174+
\column{0.33\textwidth}
175+
\centering
176+
Current changes
177+
\end{columns}
178+
179+
{\color{white} . }
180+
181+
Most modern IDEs support 3-way merge editors.
182+
\begin{itemize}
183+
\item \href{https://code.visualstudio.com/docs/sourcecontrol/merge-conflicts\#_open-the-merge-editor}{VSCode documentation}
184+
\item \href{https://www.jetbrains.com/help/idea/resolve-conflicts.html}{IntelliJ documentation}
185+
\end{itemize}
186+
187+
\end{frame}
188+
189+
\section{Block B - Working with remotes}
190+
191+
\begin{frame}
192+
\frametitle{Remote repositories}
193+
\begin{itemize}
194+
\item A remote repository is a version of your project that is hosted on the internet or a network.
195+
\item It's a full copy of your local repository, including all commits, branches and tags.
196+
\item You can think of a remote as an \textbf{additional set of branches} in the commit graph.
197+
\end{itemize}
198+
199+
\begin{block}{Add a remote repository named "\texttt{origin}"}
200+
\texttt{git remote add origin <remote\_url>}
201+
\end{block}
202+
\end{frame}
203+
204+
\begin{frame}
205+
\frametitle{Remote repositories}
206+
\begin{columns}
207+
\column{0.6\textwidth}
208+
\begin{itemize}
209+
\item \textbf{Download} remote commits and branches: \texttt{git fetch}
210+
\item \textbf{Update} local branch to match its remote counterpart: \texttt{git pull}
211+
\item Upload local commits and branches: \texttt{git push}
212+
\end{itemize}
213+
Fetching manually is usually not needed, as \texttt{git pull} does it for you.
214+
\column{0.4\textwidth}
215+
\centering
216+
\includegraphics[width=1\textwidth]{images/L4/graph-4.pdf}
217+
\end{columns}
218+
\end{frame}
219+
220+
\begin{frame}
221+
\frametitle{Multiple remotes}
222+
\begin{itemize}
223+
\item A repository can have multiple remotes, each with a different name and URL.
224+
\item This is useful for \textbf{forks}, where you have a remote for your own copy of the repository and another remote for the original ("upstream") repository.
225+
\end{itemize}
226+
227+
Many Git clients automatically set up the \texttt{origin} and \texttt{upstream} remotes when you clone a forked repository.
228+
\end{frame}
229+
230+
\section{Block C - Practical example}
231+
232+
\begin{frame}
233+
\frametitle{Contributing to an upstream repository}
234+
235+
\begin{columns}
236+
\column{0.6\textwidth}
237+
\begin{itemize}
238+
\only<1> {
239+
\item In your fork, create a new branch for your changes (\texttt{some-feature}), based on the latest commit of the \texttt{main} branch in the upstream repository.
240+
\item Push your commits to your fork (\texttt{origin/some-feature}).
241+
}
242+
\only<2> {
243+
\item The \texttt{main} branch in the upstream repository is constantly advancing due to the work of other contributors.
244+
\item Even if you are quick, your PR may sit waiting for review.
245+
}
246+
\only<3> {
247+
\item \textbf{Option 1:} If you are lucky, nobody has modified the same lines of code as you, so there are no merge conflicts.
248+
\item When your PR is merged, the commit graph will look like this:
249+
\item You can delete your \texttt{some-feature} branch, the commits are now part of the \texttt{main} branch in the upstream repository.
250+
}
251+
\only<4> {
252+
\item \textbf{Option 2:} If there are merge conflicts, you must merge \texttt{upstream/main} into your \texttt{some-feature} branch and manually resolve the conflicts.
253+
\item Push the changes to your fork and try again to merge the PR.
254+
\item You \textbf{do not} need to close and re-open the PR.
255+
}
256+
\end{itemize}
257+
\column{0.5\textwidth}
258+
\centering
259+
\only<1> {
260+
\includegraphics[width=1\textwidth]{images/L4/example-1.pdf}
261+
}
262+
\only<2> {
263+
\includegraphics[width=1\textwidth]{images/L4/example-2.pdf}
264+
}
265+
\only<3> {
266+
\includegraphics[width=1\textwidth]{images/L4/example-3.pdf}
267+
}
268+
\only<4> {
269+
\includegraphics[width=1\textwidth]{images/L4/example-4.pdf}
270+
}
271+
\end{columns}
272+
273+
\end{frame}
274+
275+
\begin{frame}
276+
\frametitle{Annex: Interesting Git features that you should know}
277+
278+
\begin{itemize}
279+
\item \textbf{Stash}: Store uncommitted changes temporarily.
280+
\item \textbf{Cherry-pick}: "Copy" a specific commit without merging the entire branch.
281+
\begin{itemize}
282+
\item This just creates a new commit with the same changes (diff) as the original one, but with a different parent.
283+
\end{itemize}
284+
\item \textbf{Rebase}: An alternative to merging.
285+
\begin{itemize}
286+
\item It \textit{replays} (cherry-picks) all commits on top of another branch.
287+
\item This has the advantage of creating a \textit{linear commit history}.
288+
\end{itemize}
289+
\item \textbf{Squash}: Combine multiple commits into a single one.
290+
\item \textbf{Bisect}: Find the commit that introduced a bug using binary search.
291+
\item \textbf{Amend}: Modify the most recent commit.
292+
\end{itemize}
293+
294+
\end{frame}
295+
296+
\end{document}

T4.ArchitecturalPatterns.tex

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ \section{Block A - Introduction to Architectural Patterns}
7777
\begin{frame}
7878
\frametitle{Architecture vs. Design (real world)}
7979

80-
Buth are very similar, but at \textit{different scales}. This gives them different properties:
80+
Both are very similar, but at \textit{different scales}. This gives them different properties:
8181
\newline
8282

8383
Architecture...
@@ -147,7 +147,7 @@ \subsection{Layered architecture}
147147
Also known as \textit{tiered}, \textit{N-layer} or \textit{N-tier} architecture.
148148
\newline
149149

150-
\textbf{The Problem:} How can we decompose a complex problem in such a way that promotes \textit{separation of concerns}?
150+
\textbf{The Problem:} How can we decompose a complex problem in a way that promotes \textit{separation of concerns}?
151151
\newline
152152

153153
\textbf{The Solution:} Organize the system into \textit{layers}:
@@ -301,7 +301,7 @@ \subsection{Transaction Script}
301301
\begin{itemize}
302302
\item Transaction boundaries are obvious.
303303
\item It's a good fit for applications with \textbf{simple data} and \textbf{linear workflows} (KISS principle).
304-
\item It's the the most natural option in purely \textbf{procedural languages} like C.
304+
\item It's the most natural option in purely \textbf{procedural languages} like C.
305305
\end{itemize}
306306
\end{frame}
307307

@@ -403,9 +403,9 @@ \subsection{Table Module}
403403
\begin{enumerate}
404404
\item Create a "table module" class for each \textbf{database table}/view, instead of for each domain concept.\footnote{\url{https://martinfowler.com/eaaCatalog/tableModule.html}}
405405
\begin{itemize}
406-
\item Table modules are \textit{singletons} (one instance manages all rows in the table), opposite to Domain Model objects.
406+
\item Table modules are \textit{singletons} (one instance manages all rows in the table), as opposed to Domain Model objects.
407407
\end{itemize}
408-
\item Implement the domain logic as \textbf{class methods} that operate on the data in that table.
408+
\item Implement the domain logic as \textbf{class methods} that operate on the data in the table.
409409
\end{enumerate}
410410
\end{frame}
411411

@@ -444,7 +444,7 @@ \subsection{Table Module}
444444
\item This makes it hard to test the domain logic in isolation.
445445
\item Changes to the database schema can require significant changes to the domain logic.
446446
\end{itemize}
447-
\item It's missing inheritance and other OOP features that promote \textbf{code reuse} and \textbf{extensibility}.
447+
\item It lacks inheritance and other OOP features that promote \textbf{code reuse} and \textbf{extensibility}.
448448
\begin{itemize}
449449
\item For complex domains, this can lead to the same cohesion and maintainability issues as Transaction Script.
450450
\end{itemize}

0 commit comments

Comments
 (0)