-
Notifications
You must be signed in to change notification settings - Fork 9
/
softeng.html
5276 lines (5233 loc) · 652 KB
/
softeng.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Software engineering</title>
<meta name="author" content="Suzanne Embury and the software engineering team. The text of this guidebook is licensed CC-BY-NC-ND and was last updated on 29 June, 2023" />
<meta name="description" content="Second year software engineering course at the University of Manchester" />
<meta name="generator" content="placeholder" />
<meta property="og:title" content="Software engineering" />
<meta property="og:type" content="book" />
<meta property="og:url" content="https://software-eng.netlify.app/" />
<meta property="og:description" content="Second year software engineering course at the University of Manchester" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:title" content="Software engineering" />
<meta name="twitter:site" content="@csmcr" />
<meta name="twitter:description" content="Second year software engineering course at the University of Manchester" />
<!-- JS -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fuse.js/6.4.6/fuse.js" integrity="sha512-zv6Ywkjyktsohkbp9bb45V6tEMoWhzFzXis+LrMehmJZZSys19Yxf1dopHx7WzIKxr5tK2dVcYmaCk2uqdjF4A==" crossorigin="anonymous"></script>
<script src="https://kit.fontawesome.com/6ecbd6c532.js" crossorigin="anonymous"></script>
<script src="libs/jquery-3.6.0/jquery-3.6.0.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<link href="libs/bootstrap-4.6.0/bootstrap.min.css" rel="stylesheet" />
<script src="libs/bootstrap-4.6.0/bootstrap.bundle.min.js"></script>
<script src="libs/bs3compat-0.4.2/transition.js"></script>
<script src="libs/bs3compat-0.4.2/tabs.js"></script>
<script src="libs/bs3compat-0.4.2/bs3compat.js"></script>
<link href="libs/bs4_book-1.0.0/bs4_book.css" rel="stylesheet" />
<script src="libs/bs4_book-1.0.0/bs4_book.js"></script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script defer data-domain="software-eng.netlify.app" src="https://plausible.io/js/script.outbound-links.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/autocomplete.js/0.38.0/autocomplete.jquery.min.js" integrity="sha512-GU9ayf+66Xx2TmpxqJpliWbT5PiGYxpaG8rfnBEk1LL8l1KGkRShhngwdXK1UgqhAzWpZHSiYPc09/NwDQIGyg==" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/mark.min.js" integrity="sha512-5CYOlHXGh6QpOFA/TeTylKLWfB3ftPsde7AnmhuitiTX4K5SqCLBeKro6sPS8ilsz1Q4NRx3v8Ko2IBiszzdww==" crossorigin="anonymous"></script>
<!-- CSS -->
<style type="text/css">
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
</style>
<style type="text/css">
/* Used with Pandoc 2.11+ new --citeproc when CSL is used */
div.csl-bib-body { }
div.csl-entry {
clear: both;
}
.hanging div.csl-entry {
margin-left:2em;
text-indent:-2em;
}
div.csl-left-margin {
min-width:2em;
float:left;
}
div.csl-right-inline {
margin-left:2em;
padding-left:1em;
}
div.csl-indent {
margin-left: 2em;
}
</style>
</head>
<body data-spy="scroll" data-target="#toc">
<div class="container-fluid">
<!--bookdown:title:start-->
<!--bookdown:title:end-->
<!--bookdown:toc:start-->
<div class="row">
<header class="col-sm-12 col-lg-3 sidebar sidebar-book">
<a class="sr-only sr-only-focusable" href="#content">Skip to main content</a>
<div class="d-flex align-items-start justify-content-between">
<h1>
<a href="index.html" title="">Software engineering</a>
</h1>
<button class="btn btn-outline-primary d-lg-none ml-2 mt-1" type="button" data-toggle="collapse" data-target="#main-nav" aria-expanded="true" aria-controls="main-nav"><i class="fas fa-bars"></i><span class="sr-only">Show table of contents</span></button>
</div>
<div id="main-nav" class="collapse-lg">
<form role="search">
<input id="search" class="form-control" type="search" placeholder="Search" aria-label="Search">
</form>
<nav aria-label="Table of contents">
<h2>Table of contents</h2>
<div id="book-toc"></div>
<div class="book-extra">
<p><a id="book-repo" href="#">View book source <i class="fab fa-github"></i></a></li></p>
</div>
</nav>
</div>
</header>
<main class="col-sm-12 col-md-9 col-lg-7" id="content">
<!--bookdown:toc:end-->
<!--bookdown:body:start-->
<div id="welcome" class="section level1 unnumbered">
<h1 class="unnumbered">Welcome</h1>
<p>Welcome to (ref:coursecode): <a href="https://studentnet.cs.manchester.ac.uk/ugt/COMP23311/syllabus/">software engineering at the University of Manchester</a>.</p>
<!-- this is the main branch-->
<div id="better" class="section level2" number="0.1">
<h2><span class="header-section-number">0.1</span> Making better software</h2>
<p>The development of software systems is a challenging process. Customers expect reliable and easy to use software to be developed within a set budget and to a tight deadline. As we come to depend upon software in so many aspects of our lives, its increasing size and complexity, together with more demanding users, means the consequences of failure are increasingly severe. The stakes for today’s software engineers are high!</p>
<div class="figure" style="text-align: center">
<img src="images/course-overview.png" alt="(ref:openingcaption)" width="100%" />
<p class="caption">
(#fig:course-overview-fig)(ref:openingcaption)
</p>
</div>
<p>(ref:openingcaption) Course unit roadmap. This twelve week course will take you from small scale code changes (shown in grey), through to working with features (shown in orange) and on to larger-scale change (shown in yellow). We finish with an open source challenge in chapter @ref(opening). The skills you will develop on this course are fundamental to modern software engineering.</p>
<p>Experience over the last few decades has taught us that software development failures are rarely caused by small scale coding problems. Instead, failures result from the difficulties of writing software that customers actually need, of keeping up with constantly changing requirements, of coping with the scale of large developments, of getting many different people with very different skill sets to work together, and of working with large bodies of existing code that no one on your team may fully understand. Being a good coder is an important part of being a good software engineer, but there are many other skills - including soft skills - that are needed too.</p>
<p>In this course unit, you will get the chance to expand and broaden the programming skills you gained in your first year course units by applying them in a more realistic context than is possible in a small scale lab, see figure @ref(fig:course-overview-fig). Instead of coding from scratch, you will be working in a team to make changes to a large open source software system, consisting of thousands of classes and tens of thousands of files - and all without breaking the existing functionality.</p>
<p>You will fix bugs in the codebase and add new features, as well as performing larger scale refactorings to maintain or improve on non-functionality properties of the system. You will perform all this using an industry strength tool set. We will complement the hands-on experience-based learning with an understanding of the core concepts underlying current notions of software engineering best practice. Volunteer mentors from industry (see chapter @ref(ourmentor)) will help you to put your learning into context, and to understand the key importance of being not just a good coder, but a good software engineer.</p>
<p>This course unit detail provides the framework for delivery in 20/21 and may be subject to change due to any additional Covid-19 impact. Please see Blackboard / course unit related emails for any further updates.</p>
</div>
<div id="bilo" class="section level2" number="0.2">
<h2><span class="header-section-number">0.2</span> Aims</h2>
<p>This unit aims to help students appreciate the reality of team-based software development in an industrial environment, with customer needs, budget constraints and delivery schedules to be met. Through hands-on experience with an industry-strength development toolkit applied to a large open source software system, students will gain an appreciation of the challenges of green and brownfield software development, along with an understanding of the core software engineering concepts that underpin current best practice. Students will have the core skill set needed by a practicing software engineer, and will be ready to become productive and valuable members of any modern software team.</p>
<div id="learning-outcomes" class="section level3" number="0.2.1">
<h3><span class="header-section-number">0.2.1</span> Learning outcomes</h3>
<p>On successful completion of this unit, a student will be able to:</p>
<ul>
<li>make use of industry standard tools for version management, issue tracking, automated build, unit testing, code quality management, code review and continuous integration.</li>
<li>write unit tests to reveal a bug or describe a new feature to be added to a system, using a test-first coding approach.</li>
<li>explain the value of code reviews, and to write constructive and helpful reviews of code written by others.</li>
<li>make use of basic Git workflows to coordinate parallel development on a code base and to maintain the quality of code scheduled for release.</li>
<li>explain the role of software patterns (design and architectural) in creating large code bases that will be maintainable over the long term.</li>
<li>explain why code that is easy to test is easy to maintain, and make use of test code smells in identifying and correcting design flaws (design for testability)</li>
<li>apply basic software refactorings to maintain or improve code quality</li>
<li>explain the challenges inherent in cost estimation for software development, and create defensible estimates with the help of work breakdown structures</li>
</ul>
<!--codebase, documentbase, languagebase, wordbase-->
</div>
</div>
<div id="recread" class="section level2" number="0.3">
<h2><span class="header-section-number">0.3</span> Recommended reading</h2>
<p>The following books are recommended course texts, they are all available from the University of Manchester library if you clickthrough to the references:</p>
<ol style="list-style-type: decimal">
<li><a href="https://git-scm.com/book/en/v2">Pro Git</a> <span class="citation">(<a href="#ref-progit">Chacon and Straub 2014</a>)</span></li>
<li>The pragmatic programmer : from journeyman to master <span class="citation">(<a href="#ref-pragmatic">Hunt and Thomas 2004</a>)</span></li>
<li>Effective unit testing : a guide for Java developers <span class="citation">(<a href="#ref-unittesting">Koskela 2013</a>)</span></li>
<li>Clean code : a handbook of agile software craftsmanship <span class="citation">(<a href="#ref-cleancode">Martin and Feathers 2009</a>)</span></li>
<li>The clean coder : a code of conduct for professional programmers <span class="citation">(<a href="#ref-cleancoder">Martin 2011</a>)</span></li>
<li>Beginning software engineering <span class="citation">(<a href="#ref-beginning">Stephens 2015</a>)</span></li>
</ol>
<p>These and any other references cited are listed in chapter @ref(reading).</p>
<div id="prereq" class="section level3" number="0.3.1">
<h3><span class="header-section-number">0.3.1</span> Requirements</h3>
<p>The compulsory pre-requisites for this course are the first year programming units:</p>
<ol style="list-style-type: decimal">
<li><a href="https://studentnet.cs.manchester.ac.uk/ugt/COMP16321/syllabus/">COMP16321: Programming 1</a></li>
<li><a href="https://studentnet.cs.manchester.ac.uk/ugt/COMP16412/syllabus/">COMP16412: Programming 2</a></li>
</ol>
</div>
<div id="courseo" class="section level3" number="0.3.2">
<h3><span class="header-section-number">0.3.2</span> Overview of course</h3>
<p>The following is an outline of the topics covered in COMP23111.</p>
<ul>
<li>Team software development</li>
<li>Software project planning and issue tracking</li>
<li>Greenfield vs brownfield software development</li>
<li>Git best practices and common Git workflows</li>
<li>Automated build tools and release management</li>
<li>Automated unit, integration and acceptance testing</li>
<li>Test code quality and test coverage tools</li>
<li>Continuous integration and testing tools</li>
<li>Best practices and tool support for code review, including source code quality tools</li>
<li>Design patterns and common architectural patterns</li>
<li>Design for testability</li>
<li>Refactoring for code quality</li>
<li>Safely migrating software functionality</li>
<li>Basic risk management techniques</li>
<li>Working with open source software systems</li>
</ul>
</div>
</div>
<div id="usingit" class="section level2" number="0.4">
<h2><span class="header-section-number">0.4</span> Using the lab manual</h2>
<p>We expect that the web-based version of this manual will be the one you’ll use most at <a href="https://software-eng.netlify.app/">software-eng.netlify.app</a>. You can search, browse and link to anything in the manual. It was last updated on 29 June, 2023.</p>
<!--However, if you'd prefer, the manual is also available as a single pdf file [softeng.pdf](https://software-eng.netlify.app/softeng.pdf) and an epub as well [softeng.epub](https://software-eng.netlify.app/softeng.epub). Having said that, the content is optimised for viewing in a web browser, so while the pdf and epub are OK, the web version is the best.-->
</div>
<div id="contributing" class="section level2" number="0.5">
<h2><span class="header-section-number">0.5</span> Contributing to this manual</h2>
<p>If you’d like to contribute this laboratory manual, we welcome constructive feedback. Once you’re familiar with git and markdown you can <a href="https://github.com/join">github.com/join</a> and:</p>
<ul>
<li>Raise new issues at <a href="https://github.com/UoMCS/softeng/issues/new">github.com/UoMCS/softeng/issues/new</a></li>
<li>Click on the <code>Edit this page</code> link, which appears on the bottom right hand side of every page published at <a href="https://software-eng.netlify.app">software-eng.netlify.app</a> when viewed with a reasonably large screen (not a phone)</li>
<li>Contribute at <a href="https://github.com/UoMCS/softeng/contribute">github.com/UoMCS/softeng/contribute</a> and help with existing issues at <a href="https://github.com/UoMCS/softeng/issues">github.com/UoMCS/softeng/issues</a></li>
<li>Fork the repository, make changes and submit a pull request <a href="https://github.com/UoMCS/softeng/pulls">github.com/UoMCS/softeng/pulls</a>. If you need to brush-up on your pulling skills see <a href="http://makeapullrequest.com/">makeapullrequest.com</a></li>
<li>From the command line, clone the repository and submit pull requests from your own setup:</li>
</ul>
<div class="sourceCode" id="cb1"><pre class="sourceCode md"><code class="sourceCode markdown"><span id="cb1-1"><a href="#cb1-1" tabindex="-1"></a>git clone https://github.com/UoMCS/softeng.git</span></code></pre></div>
<p>Most of the guidebook is generated from <a href="https://en.wikipedia.org/wiki/Markdown">RMarkdown</a>, that’s <a href="https://github.com/UoMCS/softeng/search?l=RMarkdown">all the <code>*.Rmd</code> files</a>. So markdown files are the only ones you should need to edit because everything else is generated from them including the <code>*.html</code> <!--`*.tex`, `*.pdf` and `*.epub`--> files.</p>
</div>
<div id="teambury" class="section level2" number="0.6">
<h2><span class="header-section-number">0.6</span> Acknowledgements</h2>
<p>This course has been designed, built and written by <a href="http://www.cs.man.ac.uk/~embury/">Suzanne Embury</a> at the University of Manchester with support from a team of academics, industry club members, support staff, graduate teaching assistants (GTAs) and summer students including (in alphabetical order):</p>
<p>Muideen Ajagbe, Mohammed Alhamadi, Aitor Apaolaza, Mercedes Argüello Casteleiro, Gerard Capes, Martina Catizone, Sarah Clinch, Peter Crowther, Anas Elhag Sukru Eraslan, Gareth Henshall, Duncan Hull, Caroline Jay, Nikolaos Konstantinou, Kamilla Kopec-Harding, Kaspar Matas, Chris Page, Dario Panada, Steve Pettifer, Liam Pringle, Julio Cesar Cortes Rios, Sara Padilla Romero, Viktor Schlegel, Stefan Strat, Sandra Sampaio, Jake Saunders, Federico Tavella, Mokanarangan Thayaparan, David Toluhi, Karl Tye, Jonas Verbickas and Markel Vigo.</p>
<p>Academic staff on the course for 2022/23 include:</p>
<ul>
<li><a href="https://personalpages.manchester.ac.uk/staff/thomas.carroll/">Thomas Carroll</a></li>
<li><a href="http://www.cs.man.ac.uk/~embury/">Suzanne Embury</a></li>
<li><a href="https://personalpages.manchester.ac.uk/staff/duncan.hull/">Duncan Hull</a></li>
<li><a href="https://www.research.manchester.ac.uk/portal/liping.zhao.html">Liping Zhao</a></li>
</ul>
<p>We’d also like to thank all the 2,000+ students who have done the course since its first iteration in 2016 and given us feedback on how to improve.</p>
<!--2016, two cohorts of 250 = 500 plus 250 cohorts in 2017, 2018, 2019 and 2020-->
<p>Thanks also to our <a href="https://www.cs.manchester.ac.uk/connect/business-engagement/industrial-mentoring/">industrial mentors</a>, the Institute of Coding (IoC) <a href="https://instituteofcoding.org/">instituteofcoding.org</a> and the <a href="https://www.officeforstudents.org.uk/">Office for Students</a> (OFS) for their ongoing support.</p>
</div>
<div id="license" class="section level2" number="0.7">
<h2><span class="header-section-number">0.7</span> Licensing</h2>
<p>The <em>text</em> of this lab manual is published under the <a href="https://creativecommons.org/licenses/by-nc-nd/3.0/">Creative Commons Attribution-NonCommercial-NoDerivs 3.0 License</a> (CC-BY-NC-ND) license see figure @ref(fig:cc-by-nc-nd-fig)</p>
<div class="figure" style="text-align: center">
<img src="images/by-nc-nd.png" alt="(ref:captionccbyncnd)" width="100%" />
<p class="caption">
(#fig:cc-by-nc-nd-fig)(ref:captionccbyncnd)
</p>
</div>
<p>(ref:captionccbyncnd) The <em>text</em> of this guidebook is published under a <a href="https://creativecommons.org/licenses/by-nc-nd/3.0/">Creative Commons Attribution-NonCommercial-NoDerivs 3.0 License</a> (CC-BY-NC-ND) license which means you can copy and redistribute the material provided that you provide full attribution, do not use the material for commercial purposes and you do not make any derivative works.</p>
<p>This license means you can copy and redistribute the written material provided that:</p>
<ul>
<li>You provide full attribution by linking directly to the original source</li>
<li>You do not use the material for commercial purposes</li>
<li>You do not make any derivative works</li>
</ul>
<p>See the <a href="https://creativecommons.org/licenses/by-nc-nd/3.0/">full license</a> (CC-BY-NC-ND) for details.</p>
<div id="privacy" class="section level3" number="0.7.1">
<h3><span class="header-section-number">0.7.1</span> Your privacy</h3>
<p>This site is hosted on <a href="https://www.netlify.com/">netlify.com</a>, see the <a href="https://www.netlify.com/privacy/">netlify privacy policy</a>. This site also uses <a href="https://plausible.io/">Plausible Analytics</a> to understand our audience better which is compliant with the General Data Protection Regulation (GDPR).</p>
<p>So now that we’ve dispensed with the formalities, you can start using this laboratory manual.</p>
<!--boilerplate text and constants that gets re-used throughout-->
<p>(ref:ideversion) <code>2020-03</code></p>
<p>(ref:commit-were-using) <code>5450a33</code></p>
<p>(ref:commit-message) <code>Organize imports</code></p>
<p>(ref:repoURI) <a href="https://gitlab.cs.man.ac.uk/COMP23311_2022/sliding_puzzle-your-username.git">https://gitlab.cs.man.ac.uk/COMP23311_2022/sliding_puzzle_<your-username>.git</a></p>
<p>(ref:repo2URI) <a href="https://gitlab.cs.man.ac.uk/COMP23311_2022/sliding_puzzle2-your-username.git">https://gitlab.cs.man.ac.uk/COMP23311_2022/sliding_puzzle2_<your-username>.git</a></p>
<p>(ref:coursecode) COMP23311</p>
<!-- todo update hanbook urls e.g. UGHandbook21:Academic_Malpractice to UGHandbook22:Academic_Malpractice etc-->
<!--
23311-TeamCwk1-S-Fixing Bugs 120 40
23311-TeamCwk2-S-Adding Features 120 40
23311-IndCwk1-S-Basic Git 10 10
23311-IndCwk2-S-Conflicts in Git 10 10
-->
<p>(ref:infobox) ℹ️ <strong>Note</strong> ℹ️</p>
<p>(ref:cautionbox) ⚠️ <strong>Caution</strong> ⚠️</p>
<p>(ref:commentbox) <strong><code>#Comment</code></strong></p>
<p>(ref:anotherref) here</p>
<!-- Configuration for the exercise -->
<p>(ref:totalmark) 10</p>
<p>(ref:percentage) 7</p>
<p>(ref:deadline) 6.00pm, Friday 7th October 2022</p>
<p>(ref:deadline2) 6.00pm, Friday 21st October 2022</p>
<p>(ref:feedbackdateindicwk2) 6.00pm, Friday 14th October 2022</p>
<p>(ref:numsteps) 9</p>
<p>(ref:piazzaforum) <a href="https://piazza.com/class/l7j4na2gfwn2q8">piazza.com/class/l7j4na2gfwn2q8</a></p>
<p>(ref:livehelpqueue) <a href="https://gitlab.cs.man.ac.uk/comp23311_2022/COMP23311-Live-Help-Queue/">gitlab.cs.man.ac.uk/comp23311_2022/COMP23311-Live-Help-Queue</a></p>
<p>(ref:mentors) Airbus, Airnode, Alphabet (Google), AND Digital, Apadmi, Apple, ARM, Auto Trader UK, Barclays, the BBC, Bet365, Beyond Trust, Biorelate, BJSS, Blaize, Bloomberg, Booking.com, Brightec, CERN, CDL Software, Codat, CodeThink, Code Computer Love, Cognizant, Couchbase, Cubic Motion (now Epic Games), DAI, DataCentred, Digital Bridge Ltd, Disney Streaming, EGN Digital, Farm Digital, Giant Digital, Goldman Sachs, IBM, Interact Software, Ivanti, Koder.ly, Matillion, MediaTek, Meta (Facebook), Microsoft, Moonpig, Morgan Stanley, Nandos, NCC Group, On The Beach, Peak.ai, Rental Cars, Sainsburys, Sage Group plc, Shout Platform Limited, Siemens (Mentor Graphics), SKY, Slalom, Spotify, SteamaCo, The Startup Factory, THG, ThoughtWorks, Tranzfar, UK Parliament, UL, Unipart Digital and Zuhlke.</p>
<!--chapter:end:index.Rmd-->
</div>
</div>
</div>
<div id="expectations" class="section level1 unnumbered">
<h1 class="unnumbered">Expectations</h1>
<p>While you are studying on this software engineering course, you are part of a team and a wider community:</p>
<ul>
<li>Your immediate team members</li>
<li>The community of all second year students</li>
</ul>
<p>Your learning community is supported by a group of graduate teaching assistants (GTAs), mentors and academic staff.</p>
<div id="agile" class="section level2" number="0.8">
<h2><span class="header-section-number">0.8</span> Expectation engineering</h2>
<p>It’s important that you know what we expect of you and what you’ll get in return. That’s what this page describes.</p>
<div class="figure" style="text-align: center">
<img src="images/compiling.png" alt="(ref:captionxkcdcompiling)" width="75%" />
<p class="caption">
(#fig:xkcd-compiling-fig)(ref:captionxkcdcompiling)
</p>
</div>
<p>(ref:captionxkcdcompiling) There are legitimate reasons for slacking off, such as compiling (and building) your code. Falling out with your team members, not returning their messages or just being busy doing other things are not legitimate reasons for letting your team down. <a href="https://xkcd.com/303/">Compiling (xkcd.com/303)</a> by <a href="https://en.wikipedia.org/wiki/Randall_Munroe">Randall Munroe</a> is licensed under <a href="https://creativecommons.org/licenses/by-nc/2.5/">CC BY-NC 2.5</a></p>
<div id="rtfm" class="section level3" number="0.8.1">
<h3><span class="header-section-number">0.8.1</span> Our expectations of you</h3>
<p>We need you to read ALL of the messages we send you via GitLab, Jenkins, Microsoft Teams, the Piazza forum, emails and in this guidebook. Before you ask for help, make sure you have Read The Friendly Manual(s). <a href="https://en.wikipedia.org/wiki/RTFM">RTFM</a>.</p>
<div id="helpme" class="section level4" number="0.8.1.1">
<h4><span class="header-section-number">0.8.1.1</span> Getting help</h4>
<p>Regardless of if you are attending live (in person) or remotely (online, login to Teams) the mechanism for getting help is the same, please don’t send academic staff personal email or private messages on teams. Instead:</p>
<p>For live sessions (timetabled), team study and workshops you need to use the issue tracker:</p>
<ul>
<li>(ref:livehelpqueue)</li>
</ul>
<p><em>Outside</em> of live sessions use the piazza discussion board:</p>
<ul>
<li>(ref:piazzaforum)</li>
</ul>
<p>Please note:</p>
<ul>
<li>During Team study sessions: we can discuss and help with coursework</li>
<li>During Workshops: we will support workshop content only, <strong>NO COURSEWORK</strong> questions</li>
</ul>
<p>Use the issue tracker in gitlab, rather than email, to manage communication in your team about your repository.</p>
<p>You can use whatever combination of OS and IDE you like but we can <strong>only provide support</strong> for students using Eclipse (ref:ideversion) on an Ubuntu Linux machine in the Kilburn building. We do not have the resources to test and support the myriad combinations of OS and IDE. Sorry!</p>
</div>
<div id="workshops" class="section level4" number="0.8.1.2">
<h4><span class="header-section-number">0.8.1.2</span> Workshops vs. Team study</h4>
<p>There are two main sessions:</p>
<ol style="list-style-type: decimal">
<li>Team study sessions</li>
<li>Workshops</li>
</ol>
<p>Team study sessions are for you to get together as a team to work alongside each other. You can also get help from GTAs and staff on coursework. <strong>Every team member</strong> should be attending <strong>every team study session</strong>, you may also need to arrange to meet outside of the scheduled sessions so that you can collaborate together.</p>
<p>Each workshop has a specific theme that we need you to focus on. This means <strong>we won’t discuss coursework with you during the workshops</strong>, otherwise we risk not getting through workshop material.</p>
</div>
<div id="online" class="section level4" number="0.8.1.3">
<h4><span class="header-section-number">0.8.1.3</span> Physical vs online sessions</h4>
<p>For the live (physical) sessions you’ll need to be in the appropriate lab in the Kilburn building. For online sessions (e.g. some marking and mentoring) it is especially important that you turn up on time by being at a computer with access to:</p>
<ul>
<li>A working pair of headphones</li>
<li>A working microphone that you can mute if you’re somewhere noisy</li>
<li>A webcam (ideally) but see section @ref(cameras)</li>
</ul>
<p>Please note, this may mean the best place to work is <em>not</em> necessarily the Kilburn building. Go and find a quiet spot, use your laptop (if you have one) or use your phone (there are <a href="https://www.microsoft.com/en-gb/microsoft-teams/download-app">good mobile clients for Teams</a>) or work from home. It will really help if <em>at least</em> one of your team is at a desktop computer.</p>
<p>We have deliberately scheduled online activities so they aren’t immediately after physical activities (like a lecture) so that you have time to get setup BEFORE the meeting starts.</p>
</div>
</div>
<div id="urteam" class="section level3" number="0.8.2">
<h3><span class="header-section-number">0.8.2</span> What your team expects of you</h3>
<p>For this course to run smoothly your team will expect that you:</p>
<ul>
<li>Turn up to all the bi-weekly team study sessions, <strong>especially the marking sessions</strong></li>
<li>Participate in the all workshops</li>
<li>Contribute to your team by:
<ul>
<li>Respecting your team members, no bullying. Assume good faith by default. It’s your responsibility to make your team work. Team work makes the dream work.</li>
<li>Getting along with your team members. You may not like all of them (that’s life) but your team members are crucial to your teams success. While you can get away with being a “lone wolf” coder on other course units, (see figure @ref(fig:wolf-fig)), you are now expected to behave like a sociable engineer as part of a professional team</li>
<li>Encouraging people who might be slacking off to make contributions, see figure @ref(fig:xkcd-compiling-fig)</li>
<li>Communicating with your team if you have difficulty contributing</li>
<li>Reporting issues where necessary, either to a GTA or academic member of staff</li>
</ul></li>
</ul>
<div class="figure" style="text-align: center">
<img src="images/lonewolf.jpeg" alt="(ref:captionlonewolf)" width="99%" />
<p class="caption">
(#fig:wolf-fig)(ref:captionlonewolf)
</p>
</div>
<p>(ref:captionlonewolf) Normally a social pack animal, wolves sometimes act alone. While being a <a href="https://en.wikipedia.org/wiki/Lone_wolf_(trait)">lone wolf</a> on other course units may be a reasonable strategy for studying, it won’t work well for this one. Don’t be a lone wolf because sociable teams usually make better software than loners. CC-BY-SA Image of Winter wolf by ForestWander.com on Wikimedia Commons <a href="https://w.wiki/45Vj">w.wiki/45Vj</a></p>
<p>What do you get in return for our expectations and those of your team?</p>
</div>
<div id="gtas" class="section level3" number="0.8.3">
<h3><span class="header-section-number">0.8.3</span> What to expect of GTAs</h3>
<p>This course is supported by a team of Graduate Teaching Assistants (GTAs), they are here to help you. They have lots of other people to help too, so please treat them with respect. If you’re waiting for support from a GTA, make sure you’ve Read The Friendly Manual, see section @ref(rtfm).</p>
<p>Our GTAs have Read Their Friendly Manual to (the GTA wiki) so they will know how to help you, or can quickly find out how to. They won’t give you the answer, but will be able to help you find your own way.</p>
<div class="rmdcaution">
<p>(ref:cautionbox)
The GTAs have scheduled marking sessions that we expect them to stick to. The second year timetable is incredibly crowded, and the team study sessions are the <strong>ONLY TIMES IN THE WEEK</strong> when we can guarantee that everyone in your team is available.</p>
</div>
</div>
<div id="gomentors" class="section level3" number="0.8.4">
<h3><span class="header-section-number">0.8.4</span> What to expect from mentors</h3>
<p>You have been assigned a mentor who will meet with you online for two one hour meetings, see chapter @ref(mentoring). These meetings are a bit like code review meetings, they have access to your private code repository and can see what your team is up to.</p>
<p>Our mentors are all professional software engineers, who can give you advice on how to manage the process of making better software. so please treat them with the respect they deserve. They have volunteered to help by sharing their engineering wisdom with you and taken time out of their busy schedules to do so.</p>
</div>
<div id="academics" class="section level3" number="0.8.5">
<h3><span class="header-section-number">0.8.5</span> What you can expect from academic staff</h3>
<p>The academic staff on this course include Suzanne Embury, Anas Elhag, Duncan Hull, Thomas Carroll and Sandra Sampaio. We’re here to help but please remember, there are 400+ students on this course so we can’t reply to every single personal email immediately.</p>
<div class="rmdcaution">
<p>(ref:cautionbox)</p>
<p>Please <strong>don’t email staff or GTAs</strong> directly unless you have good reason too (e.g. personal issues).</p>
<p>Instead, please post issues on the forum at (ref:piazzaforum) where <em>everyone</em> can see the response or in the help queue (ref:livehelpqueue) within the workshop / team study sessions.</p>
</div>
<p>Like you, we’re often very busy and have other teaching (and research) commitments besides this course. We’re here to ensure that the course runs smoothly and we aim to give feedback on coursework to you within the two week window.</p>
</div>
<div id="assessment" class="section level3" number="0.8.6">
<h3><span class="header-section-number">0.8.6</span> How your work gets assessed</h3>
<p>The course is:</p>
<ul>
<li>30% Written exam (in January)</li>
<li>70% Practical skills assessment (coursework)</li>
</ul>
<p>The coursework is broken down as follows</p>
<ol style="list-style-type: decimal">
<li>10%: Individual coursework 1, see chapter @ref(gitting)</li>
<li>10%: Individual coursework 2, see chapter @ref(conflicting)</li>
<li>40%: Team coursework 1, see chapter @ref(dealing)</li>
<li>40%: Team coursework 2, see chapter @ref(working)</li>
</ol>
</div>
</div>
<div id="cameras" class="section level2" number="0.9">
<h2><span class="header-section-number">0.9</span> Your camera</h2>
<p>We would normally expect participants in small meetings (not large ones like lectures) to turn their cameras on but we understand that there are good reasons why people may not be willing/able to and won’t explicitly ask you to.</p>
<div id="on" class="section level3" number="0.9.1">
<h3><span class="header-section-number">0.9.1</span> Camera on?</h3>
<p>There has always been a question around whether to turn cameras on during online meetings but it is even more obvious with online meetings becoming the norm rather than the exception. There is a direct benefit in using cameras in small, personal meetings where many of us make use of visual cues to aid the flow of conversation – at the very least it’s easier to identify who is talking. Additionally, it can help people get along – people might feel more ‘listened to’ if they can see somebody listening and your team will find it easier to remember names etc if they have a face to match the names to.</p>
</div>
<div id="off" class="section level3" number="0.9.2">
<h3><span class="header-section-number">0.9.2</span> Camera off?</h3>
<p>There are lots of legitimate reasons why you might turn your camera off. Most obviously, if you don’t have access to a camera. But you may also be in an environment which you prefer others not to see, you may have anxiety around the issue, or your connection might be too slow. There are many other perfectly reasonable reasons for you not to put your camera on and you should not feel pressured to do this. If you simply say “Sorry, I can’t turn my camera on today” then nobody will ask any further and they should never explicitly ask you to turn it on.</p>
</div>
<div id="being" class="section level3" number="0.9.3">
<h3><span class="header-section-number">0.9.3</span> Being appropriate</h3>
<p>You should already be treating online meetings like physical ones e.g. turning up on time, being prepared, listening, engaging etc. Similarly, if people can see you then you should ensure you are wearing appropriate clothes (wearing clothes is the absolute minimum here!) and in an appropriate place (the bathroom is probably not appropriate) as you would for a physical meeting.</p>
</div>
<div id="respecting" class="section level3" number="0.9.4">
<h3><span class="header-section-number">0.9.4</span> Respecting others</h3>
<p>If other people have decided to turn their cameras on then we ask that you show them respect by not recording anything without their explicit permission. We won’t touch on the legality of this as we believe that basic respect for each other should be enough to prevent any issues. You will take part in larger meetings where recording may be standard and in such cases this should be made explicit.</p>
<p>(Thanks to Giles Reger and Sarah Clinch for the text above)</p>
<!--chapter:end:001-expectations.Rmd-->
</div>
</div>
</div>
<div id="timetabling" class="section level1 unnumbered">
<h1 class="unnumbered">Weekly timetable</h1>
<p>The weekly schedule for autumn 2022 is shown in table @ref(tab:schedtable), based on <a href="https://timetables.manchester.ac.uk/">timetables.manchester.ac.uk</a>, see also <a href="https://www.manchester.ac.uk/discover/key-dates/">manchester.ac.uk/discover/key-dates</a> key dates.</p>
<ul>
<li>Other than the introductory lecture in week 1, there are no lectures. Instead we have workshops which are more like labs and may contain mini-lectures</li>
<li>Workshops are on Wednesdays at 9am and Thursdays at 2pm / 3pm depending on your lab group
<!--* [bit.ly/Tuesday-3pm-workshop](http://bit.ly/Tuesday-3pm-workshop)
* [bit.ly/Tuesday-4pm-workshop](http://bit.ly/Tuesday-4pm-workshop)
* [bit.ly/friday-1pm-workshop](http://bit.ly/friday-1pm-workshop)--></li>
<li>Team study sessions are on Tuesdays and Thursdays at 10am.</li>
</ul>
<p>For online activities, everything is on Microsoft Teams.</p>
<!--Because of constraints on the number of private channels in Teams, the year is arbitrarily split into two spaces:
1. [bit.ly/software-engineering-A](https://bit.ly/software-engineering-A)
1. [bit.ly/software-engineering-b](https://bit.ly/software-engineering-b)-->
<p>Microsoft Teams is, as the name suggests, where you’ll meet your team, details will appear here once teams have been assigned.</p>
<div id="campus" class="section level2" number="0.10">
<h2><span class="header-section-number">0.10</span> Which lab should I go to</h2>
<p>You need to meet with your team in the team study sessions, these are assigned in week 1.
<!--
* **Teams 1-30**: 1.8 & 1.10
* **Teams 31-44**: LF31
* **Teams 44-56**: Tootill--></p>
<p>The weekly schedule is shown in @ref(tab:schedtable).</p>
<table>
<caption>(#tab:schedtable)The weekly schedule for this twelve week course, please note we are using the week numbering from the <a href="https://timetables.manchester.ac.uk/">timetables.manchester.ac.uk</a> where week zero is welcome week, and week one is the first teaching week</caption>
<colgroup>
<col width="14%" />
<col width="47%" />
<col width="38%" />
</colgroup>
<thead>
<tr class="header">
<th align="left">Week no.</th>
<th align="left">Subject</th>
<th align="left">Deadlines</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td align="left"><strong>1</strong>: 26th Sept</td>
<td align="left">Automated build and test, see (ref:weekone)</td>
<td align="left"></td>
</tr>
<tr class="even">
<td align="left"><strong>2</strong>: 3rd Oct</td>
<td align="left">Reading large codebases, see (ref:weektwo)</td>
<td align="left">IndCwk1, Fri 7th Oct, 6pm</td>
</tr>
<tr class="odd">
<td align="left"><strong>3</strong>: 10th Oct</td>
<td align="left">Debugging, see (ref:weekthree)</td>
<td align="left"></td>
</tr>
<tr class="even">
<td align="left"><strong>4</strong>: 17th Oct</td>
<td align="left">Cost estimation, see (ref:weekfour)</td>
<td align="left">Mentoring week 1, IndCwk2, Fri 21st Oct, 6pm</td>
</tr>
<tr class="odd">
<td align="left"><strong>5</strong>: 24th Oct</td>
<td align="left">Test first development, see (ref:weekfive)</td>
<td align="left">TeamCwk1, 28th Oct, 6pm</td>
</tr>
<tr class="even">
<td align="left"><strong>6</strong>: 31st Oct</td>
<td align="left">Reading week see (ref:weeksix)</td>
<td align="left"></td>
</tr>
<tr class="odd">
<td align="left"><strong>7</strong>: 7th Nov</td>
<td align="left">Git workflows, see (ref:weekseven)</td>
<td align="left"></td>
</tr>
<tr class="even">
<td align="left"><strong>8</strong>: 14th Nov</td>
<td align="left">Software refactoring, see (ref:weekeight)</td>
<td align="left">Mentoring week 2</td>
</tr>
<tr class="odd">
<td align="left"><strong>9</strong>: 21st Nov</td>
<td align="left">Design for testability, see (ref:weeknine)</td>
<td align="left"></td>
</tr>
<tr class="even">
<td align="left"><strong>10</strong>: 28th Nov</td>
<td align="left">Design patterns, see (ref:weekten)</td>
<td align="left">TeamCwk2, 5th Dec, 6pm</td>
</tr>
<tr class="odd">
<td align="left"><strong>11</strong>: 5th Dec</td>
<td align="left">Risk management and practice exam, see (ref:weekeleven)</td>
<td align="left"></td>
</tr>
<tr class="even">
<td align="left"><strong>12</strong>: 12th Dec</td>
<td align="left">Open source challenge, see (ref:weektwelve)</td>
<td align="left"></td>
</tr>
</tbody>
</table>
</div>
<div id="week1" class="section level2" number="0.11">
<h2><span class="header-section-number">0.11</span> Automating</h2>
<p>Events in the week starting 26th September:</p>
<ol style="list-style-type: decimal">
<li><strong>Team Study Tuesday</strong>: Work on individual coursework 1 described in chapter @ref(gitting)</li>
<li><strong>One off lecture</strong> to introduce the course unit at 3pm on Friday 30th September, Lecture Theatre A, Engineering Building A <a href="https://timetables.manchester.ac.uk/">timetables.manchester.ac.uk</a></li>
<li><strong>Workshop</strong>: Automated build and test with Duncan Hull</li>
<li><strong>Team Study Thursday</strong> Work on individual coursework 1 described in chapter @ref(gitting)
<!--1. **Coursework deadlines**: Individual individual coursework 1 can be pre-marked (automatically) if you submit by **6pm Tuesday 28th September** and finally marked when submitted by **6pm on Friday 1st October**--></li>
</ol>
</div>
<div id="week2" class="section level2" number="0.12">
<h2><span class="header-section-number">0.12</span> Reading</h2>
<p>Events in the week starting 3rd October:</p>
<ol style="list-style-type: decimal">
<li><strong>Team Study Tuesday</strong>: Individual coursework 2 starts, see chapter @ref(conflicting). Meet your team on Teams</li>
<li><strong>Workshop</strong>: Reading large code bases with Thomas Carroll</li>
<li><strong>Team Study Thursday</strong> Working on coursework</li>
<li><strong>Coursework deadlines</strong>: Individual coursework 1</li>
</ol>
</div>
<div id="week3" class="section level2" number="0.13">
<h2><span class="header-section-number">0.13</span> Debugging</h2>
<p>Events in the week starting 10th October:</p>
<ol style="list-style-type: decimal">
<li><strong>Team Study Tuesday</strong>: Working on team coursework</li>
<li><strong>Workshop</strong>: Debugging codebases with Thomas Caroll</li>
<li><strong>Team Study Thursday</strong> Working on team coursework</li>
<li><strong>Coursework deadlines</strong>: see blackboard</li>
</ol>
</div>
<div id="week4" class="section level2" number="0.14">
<h2><span class="header-section-number">0.14</span> Estimating</h2>
<p>Events in the week starting 17th October:</p>
<ol style="list-style-type: decimal">
<li><strong>Team Study Tuesday</strong>: Working on team coursework</li>
<li><strong>Workshop</strong>: Cost estimation with Duncan Hull</li>
<li><strong>Team Study Thursday</strong> Meet your team mentor on Teams</li>
</ol>
</div>
<div id="week5" class="section level2" number="0.15">
<h2><span class="header-section-number">0.15</span> Testing</h2>
<p>Events in the week starting 24th October:</p>
<ol style="list-style-type: decimal">
<li><strong>Team Study Tuesday</strong>: Working on team coursework</li>
<li><strong>Workshop</strong>: Test first development with Thomas Carroll</li>
<li><strong>Team Study Thursday</strong> Working on team coursework</li>
<li><strong>Coursework deadlines</strong>: TeamCwk1 due</li>
</ol>
</div>
<div id="week6" class="section level2" number="0.16">
<h2><span class="header-section-number">0.16</span> Pausing</h2>
<p>Events in the week starting 1st November (reading week). Take a break if you’re ahead, or catchup if you’ve fallen behind.</p>
<ol style="list-style-type: decimal">
<li>There are no activities in reading week</li>
</ol>
</div>
<div id="week7" class="section level2" number="0.17">
<h2><span class="header-section-number">0.17</span> Workflowing</h2>
<p>Events in the week starting 7th November:</p>
<ol style="list-style-type: decimal">
<li><strong>Team Study Tuesday</strong>: Team study</li>
<li><strong>Workshop</strong>: Git workflows with Suzanne Embury</li>
<li><strong>Team Study Thursday</strong> Team study</li>
</ol>
</div>
<div id="week8" class="section level2" number="0.18">
<h2><span class="header-section-number">0.18</span> Refactoring</h2>
<p>Events in the week starting 14th November:</p>
<ol style="list-style-type: decimal">
<li><strong>Team Study Tuesday</strong>: Team study</li>
<li><strong>Workshop</strong>: Refactoring with Thomas Carroll</li>
<li><strong>Team Study Thursday</strong> Second mentoring session</li>
</ol>
</div>
<div id="week9" class="section level2" number="0.19">
<h2><span class="header-section-number">0.19</span> Testing</h2>
<p>Events in the week starting 21st November:</p>
<ol style="list-style-type: decimal">
<li><strong>Team Study Tuesday</strong>: Working on team coursework</li>
<li><strong>Workshop</strong>: Design for testability Thomas Carroll</li>
<li><strong>Team Study Thursday</strong> Working on team coursework</li>
</ol>
</div>
<div id="week10" class="section level2" number="0.20">
<h2><span class="header-section-number">0.20</span> Patterning</h2>
<p>Events in the week starting 28th November:</p>
<ol style="list-style-type: decimal">
<li><strong>Team Study Tuesday</strong>: Working on team coursework</li>
<li><strong>Workshop</strong>: Design patterns with Liping Zhao</li>
<li><strong>Team Study Thursday</strong> Working on team coursework</li>
<li><strong>Coursework deadlines</strong>: TeamCwk2 due end of the week</li>
</ol>
</div>
<div id="week11" class="section level2" number="0.21">
<h2><span class="header-section-number">0.21</span> Managing</h2>
<p>Events in the week starting 5th December:</p>
<ol style="list-style-type: decimal">
<li><strong>Team Study Tuesday</strong>: Marking sessions</li>
<li><strong>Workshop</strong>: Risk management and practice exam with Liping Zhao</li>
<li><strong>Team Study Thursday</strong> Marking sessions</li>
</ol>
</div>
<div id="week12" class="section level2" number="0.22">
<h2><span class="header-section-number">0.22</span> Challenging</h2>
<p>Events in the week starting 12th December:</p>
<ol style="list-style-type: decimal">
<li><strong>Team Study Tuesday</strong>: Marking sessions</li>
<li><strong>Workshop</strong>: Open source challenge with Liping Zhao</li>
<li><strong>Team Study Thursday</strong></li>
<li><strong>Coursework deadlines</strong>:</li>
</ol>
</div>
<div id="tooling" class="section level2" number="0.23">
<h2><span class="header-section-number">0.23</span> Tools</h2>
<p>We’ll be using the following tools:</p>
<div id="msfteams" class="section level3" number="0.23.1">
<h3><span class="header-section-number">0.23.1</span> Microsoft Teams</h3>
<ul>
<li>Team study sessions take place on Microsoft Teams, login using your <code>@student.manchester.ac.uk</code> email address at <a href="https://teams.microsoft.com/">teams.microsoft.com</a> or <a href="https://www.microsoft.com/en-gb/microsoft-teams/download-app">download a native teams client</a> everthing else is in the guidebook at <a href="https://software-eng.netlify.app/">software-eng.netlify.app/</a></li>
<li>Teams is also the place to go for livestream if you’re following the workshops online</li>
</ul>
</div>
<div id="blackboard" class="section level3" number="0.23.2">
<h3><span class="header-section-number">0.23.2</span> Blackboard</h3>
<ul>
<li>Other course materials (slides and videos) can be found on at <a href="https://online.manchester.ac.uk/">online.manchester.ac.uk</a></li>
</ul>
</div>
<div id="gitlab" class="section level3" number="0.23.3">
<h3><span class="header-section-number">0.23.3</span> GitLab</h3>
<ul>
<li>GitLab issue tracker <a href="https://gitlab.cs.man.ac.uk/">gitlab.cs.man.ac.uk</a></li>
</ul>
<!--hacky way to get chapter references in tables-->
<p>(ref:weekone) see section @ref(week1)</p>
<p>(ref:weektwo) see section @ref(week2)</p>
<p>(ref:weekthree) see section @ref(week3)</p>
<p>(ref:weekfour) see section @ref(week4)</p>
<p>(ref:weekfive) see section @ref(week5)</p>
<p>(ref:weeksix) see section @ref(week6)</p>
<p>(ref:weekseven) see section @ref(week7)</p>
<p>(ref:weekeight) see section @ref(week8)</p>
<p>(ref:weeknine) see section @ref(week9)</p>
<p>(ref:weekten) see section @ref(week10)</p>
<p>(ref:weekeleven) see section @ref(week11)</p>
<p>(ref:weektwelve) see section @ref(week12)</p>
<!--chapter:end:002-timetabling.Rmd-->
</div>
</div>
</div>
<div id="part-weekly-workshops" class="section level1 unnumbered">
<h1 class="unnumbered">(PART) Weekly Workshops</h1>
</div>
<div id="building" class="section level1" number="1">
<h1><span class="header-section-number">1</span> Building and testing</h1>
<div id="Introduction" class="section level2" number="1.1">
<h2><span class="header-section-number">1.1</span> Introduction</h2>
<p>In this workshop, we will be building and testing a system called Marauroa. We will look at some essential processes for working on an existing team-developed software system. We’ll be assuming that, after this workshop, you are capable of carrying out the following tasks for yourself, without needing much guidance:</p>
<ul>
<li>Acquire the right version of the source code on which to work.</li>
<li>Create an executable version of the source code using an automated build tool.</li>
<li>Test the system, prior to making changes.</li>
<li>Use a test suite to find functional regression in the system.<br />
</li>
<li>Run a piece of software consisting of multiple distributed subsystems.</li>
</ul>
<p>In this, and some later workshops, we’ll be working with the code of the <em>Marauroa games engine</em> for constructing online multi-player games.</p>
<p>Marauroa is an open-source <em>framework</em> and engine for developing games. It provides a simple way of creating games on a portable and robust server architecture. Marauroa manages client-server communication and provides an object-orientated view of the world for game developers. It further handles database access in a transparent way to store player accounts, character progress and the state of the world.</p>
<p>You should already have begun to practice some of these skills, through the GitLab Access Check activity.
In this workshop, we will build on that activity to carry out these basic skills on a large open-source software system. During the workshop, you will:</p>
<ol style="list-style-type: decimal">
<li>Use an IDE to clone a local copy of the Marauroa repository.</li>
<li>Build executable versions of the client and server components, using the Ant build tool.</li>
<li>Run the test suite provided for Marauroa</li>
<li>Use a code coverage tool to assess the strength of the test suite.</li>
<li>See how the test suite can help us pinpoint errors in the code.</li>
</ol>
<p>You may work at your own pace, but you should try to complete step 4 by the end of the workshop if you can. You will need to finish the exercise in your own time if you don’t manage it in the workshop, as you’ll need to use these techniques for the team coursework. <strong>If you are not up-to-speed with them, then you could slow your team down.</strong></p>
</div>
<div id="acquiring" class="section level2" number="1.2">
<h2><span class="header-section-number">1.2</span> Acquiring Marauroa</h2>
<p>First, you’ll need to acquire a local copy of the Marauroa Project.</p>
<div id="runide" class="section level3" number="1.2.1">
<h3><span class="header-section-number">1.2.1</span> Run the IDE</h3>
<p>The Department provides a range of Integrated Development Environments (IDEs) for use by students. You are welcome to use any of these IDEs to carry out the work for this workshop. However, we are only able to provide technical support for Eclipse, specifically (ref:ideversion). If you do want to use one of the other IDEs, we will do our best to help should you get stuck, but we can’t guarantee to be able to fix all problems. At the bare minimum, you should feel confident that you can do all the tasks listed in the introduction in your chosen IDE before you finalise the decision.</p>
<p>The instructions that follow assume you are using (ref:ideversion) the Department of Computer Science Linux image or the Linux Mint VM provided by the Department.</p>
<p>You can start Eclipse from the Applications menu (under Programming) or the command line, by issuing the command:</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode md"><code class="sourceCode markdown"><span id="cb2-1"><a href="#cb2-1" tabindex="-1"></a>/opt/eclipse-2020-03/eclipse &</span></code></pre></div>
</div>
<div id="selectw" class="section level3" number="1.2.2">
<h3><span class="header-section-number">1.2.2</span> Select the Workspace</h3>
<p>Eclipse calls a folder containing one or more Eclipse projects a <code>workspace</code>. At start-up, Eclipse will ask you which workspace you want to use for the session. You can either accept the default location or use the File Browser to locate or create a different one. A sensible standard location is something like:</p>
<pre><code>~/EclipseWorkspace</code></pre>
<p>If you choose to create a new workspace, Eclipse will show the Welcome View when it loads. Uncheck the box at the bottom right of the window (labelled <code>Always show Welcome on start up</code>) and close it down, as we do not need this view for this workshop. (You can get it back whenever you want by selecting the <code>Welcome</code> option from the <code>Help</code> menu.)</p>
</div>
<div id="organisew" class="section level3" number="1.2.3">
<h3><span class="header-section-number">1.2.3</span> Organise Workspace</h3>
<p>You’ll need to organise your main Eclipse workspace window and you should now see a window that looks something like figure @ref(fig:firstview-fig).</p>
<div class="figure" style="text-align: center">
<img src="images/1.3.2firstView.png" alt="Your main eclipse window should look something like this" width="100%" />
<p class="caption">
(#fig:firstview-fig)Your main eclipse window should look something like this
</p>
</div>
<p>If you used the same workspace you created for the individual coursework exercises, you’ll see the project for that in the Package Explorer view. If you used a new workspace, it will be empty like the one shown above.</p>
<p>This is the standard layout for working on Java projects. The central empty space is where we will use the various Eclipse editor tools and views to work on individual files. It is empty at the moment, as we are not working on any specific file. Around it are a number of other views. We’ll talk about the main ones and what they tell us later.</p>
<p>I find this screen rather cluttered, and would immediately delete all the views I don’t need regularly, to free up space for the ones I do, and move the views I do use to more convenient locations. You might want to do the same. You can experiment with moving the views around by clicking and dragging on their tabs. Delete any views you don’t think you’ll need, but <strong>make sure you keep the Package Explorer view, the Outline view and the Problems view open</strong>, as we’ll be making use of those very soon.</p>
<p>Note that you can always get any views you delete back again, using the <code>Window</code> > <code>Show View</code> menu option.</p>
</div>
<div id="newproj" class="section level3" number="1.2.4">
<h3><span class="header-section-number">1.2.4</span> Create a New Project by Cloning</h3>
<p>Next, we’re going to pull down (git clone) the public Marauroa source code into a local repository where we can work on it. You’ve already had experience working with Git from the command line. In this course unit, we ask you to use your IDE for (at least) your basic interactions with Git and GitLab. This will help you to understand the strengths and weaknesses of both approaches if you are not already familiar with them.</p>
<p>The first step is to ask Eclipse to import the Marauroa project for us, from a public Git repository.</p>
<p>Select the <code>File</code> > <code>Import</code> menu option. Then choose <code>Git</code> > <code>ImportFromGit</code> shown in figure @ref(fig:eclipseImportProjectFromGit-fig)</p>
<div class="figure" style="text-align: center">
<img src="images/1.4.eclipseImportProjectFromGit.png" alt="Your main eclipse window should look something like this" width="100%" />
<p class="caption">
(#fig:eclipseImportProjectFromGit-fig)Your main eclipse window should look something like this
</p>
</div>
<p>You can either double-click on <code>Projects from Git</code>, or single-click on it and press <code>Next</code>.</p>
<p>A dialogue box appears showing the two ways in which you can import a project from Git. We’re going to <strong>clone a project from a URI</strong>, so select that option shown in figure @ref(fig:eclipseCloneFromURI-fig)</p>
<div class="figure" style="text-align: center">
<img src="images/1.4.eclipseCloneFromURI.png" alt="Your main eclipse window should look something like this" width="100%" />
<p class="caption">
(#fig:eclipseCloneFromURI-fig)Your main eclipse window should look something like this
</p>
</div>
<p>Next, we need to tell Eclipse which URI to clone from. The team behind Marauroa have set up their own Git server, which we’ll connect to anonymously. Enter the following into the URI field:</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode md"><code class="sourceCode markdown"><span id="cb4-1"><a href="#cb4-1" tabindex="-1"></a>git://git.code.sf.net/p/arianne/marauroa</span></code></pre></div>
<p>Eclipse <strong>Should fill in the rest of the fields automatically</strong>. If it doesn’t, it’s likely that something went wrong when copying the link from this PDF: try typing it instead. Check that your dialogue looks like figure @ref(fig:enterMarauroaURI-fig) before proceeding.</p>
<div class="figure" style="text-align: center">
<img src="images/1.4enterMarauroaURI.png" alt="Your Import Projects from Git dialogue box should look like this" width="100%" />
<p class="caption">
(#fig:enterMarauroaURI-fig)Your Import Projects from Git dialogue box should look like this
</p>
</div>
<p>If everything looks okay then select <code>Next</code>.</p>
<div class="rmdnote">
<p><strong>Does your Clone Attempt Fail With An Error?</strong></p>
<p>If so, the Arianne project Git server may be temporarily down. If you can’t clone using the URI given above, you can try using this GitHub repository URI instead:</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode md"><code class="sourceCode markdown"><span id="cb5-1"><a href="#cb5-1" tabindex="-1"></a>https://github.com/arianne/marauroa.git</span></code></pre></div>
</div>
<p>Eclipse will now communicate with the remote Git repository specified in the URI. It will ask us which branches we want to work with locally, that is, which branches we want to create local remote tracking branches for. Note that this is not the same as asking us which commits we want to include in our clone. A standard Git clone will always include all the commits in the cloned repository, regardless of which branches we select here. And it is not asking us which remote branches we want to have in the repository. Again, a standard Git clone will include all the remote branches by default. The question Eclipse is asking here applies only to the question of which tracking branches should be created in the clone.</p>
<p>We’re not going to be making any serious changes to the Marauroa code base in this workshop, so we will just ask for a remote tracking branch to be created for the <code>master</code> branch of the repository, see figure @ref(fig:selectMarauroaBranches-fig). If you need to remind yourself how branching works, you might like to visit (or revisit) <a href="https://learngitbranching.js.org/">learngitbranching.js.org</a>.</p>
<div class="figure" style="text-align: center">
<img src="images/1.4selectMarauroaBranches.png" alt="Take a look at the list of branches contained in the project, by scrolling up and down the list. You'll see that the Marauroa project uses separate branches to describe specific releases, as well as other development branches. Another common approach is to have a single release branch and to use tags to distinguish specific releases on that branch." width="100%" />
<p class="caption">
(#fig:selectMarauroaBranches-fig)Take a look at the list of branches contained in the project, by scrolling up and down the list. You’ll see that the Marauroa project uses separate branches to describe specific releases, as well as other development branches. Another common approach is to have a single release branch and to use tags to distinguish specific releases on that branch.
</p>
</div>
<p>Make sure that the <code>master</code> branch is selected, and press <code>Next</code>.</p>
<div class="rmdcaution">
<p>(ref:cautionbox)
<strong>Master or Main?</strong></p>
<p>Historically, the default name for initial branch in a git repository was <code>master</code>. The initial branch was called “master repository” with other copies serving as “slave repositories”.</p>
<p>Note that as of 2021, the use of <code>master</code> has now been deprecated. We’re using it in this course unit, but by default, new projects using git will call the initial branch <code>main</code> not <code>master</code> to avoid problematic <a href="https://en.wikipedia.org/wiki/Master/slave_(technology)">master/slave terminology</a>.</p>
<p>See <a href="https://about.gitlab.com/blog/2021/03/10/new-git-default-branch-name/">about.gitlab.com/blog/2021/03/10/new-git-default-branch-name/</a> for more details on the switch.</p>
</div>
<p>As in the GitLab Access Check activity, we need to tell Eclipse where we want the cloned repository to be stored before it can issue the Git command to create it see figure @ref(fig:configureLocalStorageMarauroa-fig)</p>
<div class="figure" style="text-align: center">
<img src="images/1.4configureLocalStorageMarauroa.png" alt="Cloning from git dialog box" width="100%" />
<p class="caption">
(#fig:configureLocalStorageMarauroa-fig)Cloning from git dialog box
</p>
</div>
<p>You can use the default location suggested, or you can use the Browse button to use the file selector to create a new directory in a different location. Here, I’ve followed the standard convention of putting the repository inside my personal <code>git</code> folder.</p>
<p>When you have selected your preferred location, select <code>Next</code>.</p>
<p>Eclipse now issues the commands to clone the project.</p>
<p>The next step is to import the Marauroa project from your local Git repository into Eclipse, so you can start to work on it.</p>
<div class="rmdnote">
<p><strong>What is a project in this context?</strong></p>
<p>One of the confusing things about IDEs when we first start to use them is the notion of a <code>project</code>. When we code from the command line, we tend to organise our work in directories. Sometimes these directories relate to specific tasks we are carrying out (like coding up the solution to a lab exercise) and sometimes they relate to the structure of the code we are creating (like different directories for source code and object code, or libraries or documentation).</p>
<p>We use directories for all these purposes when we code in an IDE as well, but in order to be able to support us well, the IDE needs to know the <em>root</em> directory of a piece of software that we are building. That way, it can perform useful tasks for us, like automatically setting the <code>classpath</code> for us, and automatically compiling code and reporting on errors while we type. This root directory is typically referred to as a <em>project</em>. IDEs use the concept of a project as a means of recording metadata about the project. For example, Eclipse will remember that a specific project is a Java project, and will then know to apply the set of tools appropriate to Java projects, and not (for example) tools relating to Ruby or Python.</p>
</div>
<p>As in the GitLab Access Check activity, we have to tell Eclipse which wizard to use to import the project for us. Since the Marauroa team uses Eclipse, we can use the wizard that looks for existing Eclipse projects in the repository, see figure @ref(fig:wizardImport-fig) If we were loading a project built in another IDE, we would need to use one of the other wizards.</p>
<div class="figure" style="text-align: center">
<img src="images/1.4wizardImport.png" alt="Cloning from git dialog box" width="100%" />
<p class="caption">
(#fig:wizardImport-fig)Cloning from git dialog box
</p>
</div>
<p>Click on <code>Next</code> when the correct wizard has been chosen.</p>
<p>Eclipse will now scan the local Git repository looking for anything that it recognises as an Eclipse project. It looks through all the folders, searching for the metadata files that Eclipse creates and stores in the root directory of a project. In this case, it finds just one (called <code>newmarauroa</code>) see figure @ref(fig:eclipseSelectProjectsToImport-fig)</p>
<div class="figure" style="text-align: center">
<img src="images/1.4eclipseSelectProjectsToImport.png" alt="Import projects from a git repository and the newmarauroa project" width="100%" />
<p class="caption">
(#fig:eclipseSelectProjectsToImport-fig)Import projects from a git repository and the newmarauroa project
</p>
</div>
<p>Since there is just one project in the repository, we have an easy decision here. Click on the <code>newmarauroa</code> project to select it, and then click on <code>Finish</code> (finally!).</p>
<p>Eclipse can now import the project into your workspace. When that is done, you’ll be taken back to the main Eclipse work screen (strictly speaking, we’re taken back to what Eclipse calls the ‘Java Perspective’). You should see that a project has appeared in the Package Explorer view, and that the Problems view has now been populated with information see figure @ref(fig:finallyImportedProject-fig)</p>
<div class="figure" style="text-align: center">
<img src="images/1.4finallyImportedProject.png" alt="Import projects from a git repository and the newmarauroa project" width="100%" />
<p class="caption">
(#fig:finallyImportedProject-fig)Import projects from a git repository and the newmarauroa project
</p>
</div>
</div>
<div id="checkout-a-specific-commit" class="section level3" number="1.2.5">
<h3><span class="header-section-number">1.2.5</span> Checkout a Specific Commit</h3>
<p>Although we asked for the <code>master</code> branch to be checked out locally when we cloned the repository, we are actually going to be working with a different commit, one that is not pointed to by <code>master</code>. This is partly to make sure everyone in the workshop uses the same commit for the exercise, even if <code>master</code> gets updated between the creation of these notes and the running of the workshops. But it is also to give you confidence in working with non-head commits (that is, commits that are not pointed to by a branch or tag).</p>
<p>For this activity, we are going to work with the commit with the short SHA of (ref:commit-were-using).</p>
<p>The easiest way to check out a commit, branch or tag from within Eclipse is to use the History View. To open it, right-click on the <code>newmarauroa</code> project name in the Package Explorer view. Select <code>Team</code> > <code>Show in History</code> from the menu that appears. The History View shown in figure @ref(fig:historyTab-fig), should now be visible in the bottom panel of your Eclipse window. You may wish to double-click on the view tab to expand it, so that the contents are more easily seen.</p>
<div class="figure" style="text-align: center">
<img src="images/1.4historyTab.png" alt="In this view, you should now see the most recent part of the network of the Marauroa project repository. You can scroll down to see the full commit log. As you can see, the history is significantly more complex than the simple repository we looked at in the GitLab Access Check. Marauroa has been under development since 2003, and its history reflects its age. Note that your view of the repository may be a little different than that shown in the screenshot. We are working with a live repository, and new commits are being made on a regular basis." width="100%" />
<p class="caption">
(#fig:historyTab-fig)In this view, you should now see the most recent part of the network of the Marauroa project repository. You can scroll down to see the full commit log. As you can see, the history is significantly more complex than the simple repository we looked at in the GitLab Access Check. Marauroa has been under development since 2003, and its history reflects its age. Note that your view of the repository may be a little different than that shown in the screenshot. We are working with a live repository, and new commits are being made on a regular basis.
</p>
</div>
<p>Look for the commit with SHA (ref:commit-were-using). It should have the (not terribly helpful) commit message (ref:commit-message). Right-click on it, and select <code>Checkout</code> from the menu that appears.</p>
<p>At this point, Eclipse will warn you that you are in a <code>detached HEAD</code> state shown in figure @ref(fig:detachedHEAD-fig)</p>
<div class="figure" style="text-align: center">
<img src="images/1.4historyTab.png" alt="(ref:captiondetach)" width="100%" />
<p class="caption">
(#fig:detachedHEAD-fig)(ref:captiondetach)
</p>
</div>
<p>(ref:captiondetach) A warning of the detached HEAD state which reads: “You are in the <code>detached HEAD</code> state. This means you don’t have a local branch checked out. You can look around but it’s not recommended to commit changes. The reason is that these commits would not be on any branch and would not be visible after checking out another branch.”</p>
<p>This just means that we have checked out a commit that is not pointed to by any current branch or tag. The <code>HEAD</code> in Git is the currently checked-out commit. Eclipse (and Git) are warning us about this because any changes we make and commit from this point will also not be pointed to by any branch or tag (unless we create one specifically). In fact, they will be unreachable from any branch or tag, and so will be treated by Git as if they had been deleted. They will be scheduled for garbage collection, the next time that takes place. We’re not going to commit any changes for this exercise, so we don’t care whether the <code>HEAD</code> commit is detached or not. We can safely ignore this warning for now.</p>
<div class="rmdnote">
<p><strong>Checkout and Detached Heads</strong></p>
<p>If you’re interested to learn more about checking out a detached head, you could read this article: <a href="https://www.git-tower.com/learn/git/faq/detached-head-when-checkout-commit">What’s a “detached HEAD” in the Git FAQ</a></p>
</div>
<p>Press <code>OK</code> and double-click on the History View tab, to shrink the view back to its original size and location, now that we have finished working with it.</p>
</div>
<div id="explore" class="section level3" number="1.2.6">
<h3><span class="header-section-number">1.2.6</span> Explore your Project</h3>
<p>You now have your own copy of the Marauroa project source to play with and look around a little. Take a few minutes to look around and explore what is inside it before moving on to the next step. Look at the way the contents of the project are organised into folders. Can you guess the contents of each folder from its name?</p>
<p>Explore some of the folders. Can you find some Java class files? What clues did you use to track them down?</p>
<p>Notice the icon that Eclipse has placed next to the project name. Quite a lot of information is packed into this small symbol. The folder symbol indicates that this is a project. The small J just above it indicates that this is a Java project. The small orange drum under the J indicates that this project is under version control. Eclipse also tells us the name of the Git repository the project is stored under, and which branch or commit of the project we current have checked out, in the text following the project name: <code>[marauroa (ref:commit-were-using)]</code> (or similar). Finally, the small yellow road sign with the exclamation mark in the middle tells us that when Eclipse used its internal builder on the Java code in the project, it encountered some compiler warnings.</p>
<p>You might be surprised to see that the Marauroa team have released code that produces compiler warnings. Let’s take a look at what the warnings are, using the Problems view. You’ll notice that this view has already been populated with some information about the project, without us having to ask for it to be generated. IDEs will commonly provide services like this, performing key analyses of the project source and letting you know about problems without you having to explicitly request it. After all, if we have introduced a compilation error, we want to know about it as soon as it happens, and not much later when we finally remember to ask Eclipse to compile the code.</p>
<p>Because the Marauroa team have configured this project as a Java project, Eclipse already knows how to find the Java source files, and it uses its internal Java build tool to compile them. In fact, it will recompile every time we make even a small change to the code, as well as when we import new code. From the Problems view, we can see that this automatic compilation produced no compiler errors (good!) but 158 compiler warnings (eek!).</p>
<p>If you have time, you can take a few minutes to explore the compiler warnings generated, by clicking on the small triangle beside the warning <code>Warnings</code> in the Problem view. Take a look and see if you think these are serious problems or whether the Marauroa creators were making a reasonable decision not to fix them.</p>
<p><strong>STEP 1 of 4 COMPLETED</strong></p>
<p>You’ve now completed the first step, and have a code base to explore. But, that is only the beginning. Please proceed to the next step, where we’ll look at how to <strong>use the automated build scripts</strong> provided by the Marauroa team to build an executable version of the Marauroa engine.</p>
</div>
</div>
<div id="building-the-marauroa-engine" class="section level2" number="1.3">
<h2><span class="header-section-number">1.3</span> Building the Marauroa Engine</h2>
<p>If we are going to make changes to an existing body of code, we have to be able to create an executable version of it. There is no point in making changes to source code if we can’t actually run the new version of the code.</p>
<p>In this step, you’re going to be introduced to the Apache Ant automated build tool, which is the tool chosen by the Marauroa team for use on their project. You’ll learn how to use it to create executable code from the source we’ve just downloaded.</p>
<div class="rmdnote">
<p><strong>Note:</strong> we will not cover a full tutorial on the use of the Ant tool in this workshop — nor indeed in any workshop to follow in the semester. One of the key skills we need when working with large existing software systems is <em>the ability to keep moving forward</em> even when we don’t have much of a clue about what is going on. We have to accept that we will never know everything there is to know about the tools used by the system, or the source code of the system, or any other aspect of the system.</p>
</div>
<p>For our purposes today, you just need to know how to run an Ant script to create an executable project. We’ll take a look at the build script, to get an idea of how it works, but there will be a lot that we ignore or skip over very briefly. Becoming comfortable with this approach is one of the skills you need to develop over the course of this semester. (Many of you will already possess this skill, of course!)</p>
<div id="locate-and-examine-the-build-script" class="section level3" number="1.3.1">
<h3><span class="header-section-number">1.3.1</span> Locate and Examine the Build Script</h3>
<p>Open up the <code>newmarauroa</code> project in the Package Explorer (if you have not already done so), and scroll down until you see a file called <code>build.xml</code>. This is the default name for Ant build scripts. Double-click on it, to get Eclipse to load the file into an Editor view, so that we can see its contents shown in figure @ref(fig:buildfile-fig)</p>
<div class="figure" style="text-align: center">
<img src="images/2.1buildFile.png" alt="An XML build file" width="100%" />
<p class="caption">
(#fig:buildfile-fig)An XML build file
</p>
</div>
<p>If the filename wasn’t already enough of a clue, you’ll see from this that Ant build scripts are XML files. XML tags are used to define the things that the file knows how to build, and the steps involved in building them, as well as key configuration information, such as class paths (shown in the screenshot above).</p>
<p>Notice that the Outline view has also now been populated. This very useful view gives a high-level summary of the contents of a file, by listing its main components as a tree view. In the case of a Java file, the Outline view shows the classes defined by the file, and their members (fields and methods). In the case of XML files, like our build file, the Outline view shows the hierarchy of tags defined by the files.</p>
<p>We can use the Outline view to run Ant builds, by right-clicking on the XML tags that represent descriptions of how to build things. But an even more useful view is the <strong>Ant View</strong>. This is a view that has been created with knowledge of how the Ant build tool works, and added into Eclipse as a plugin. Open it by selecting <code>Window</code> > <code>Show View</code> > <code>Ant</code> from the top-level menus.</p>
<p>Now open <code>build.xml</code> from the view by clicking on the <code>Add Buildfiles</code> icon in the view toolbar. It looks like an ant with a green plus on its left shown in figure @ref(fig:antAddBuildfile-fig)</p>
<div class="figure" style="text-align: center">
<img src="images/2.1antAddBuildfile.png" alt="An XML build file" width="100%" />
<p class="caption">
(#fig:antAddBuildfile-fig)An XML build file
</p>
</div>
<p>This will open a new dialogue that allows you to select a Buildfile. Select <code>build.xml</code> and click <code>OK</code> shown in figure @ref(fig:selectBuildfile-fig)</p>
<div class="figure" style="text-align: center">
<img src="images/2.1selectBuildfile.png" alt="Buildfile Selection" width="100%" />
<p class="caption">
(#fig:selectBuildfile-fig)Buildfile Selection
</p>
</div>
<p>Notice that the Ant view has been populated. Instead of listing all the top-level XML tags, this view knows just to list the <strong>build targets</strong>. These are the things the Ant script knows how to build. The user of the script can request which target she or he wishes to build.</p>
<p>Scan down the targets and see if you can guess from the name what each one builds. Hint: <code>dist</code> here stands for <code>distribution</code>.</p>
<p>Let’s take a look at the definitions of some of the targets. Right-click on the name of any of the targets, and select <code>Open In</code> > <code>Ant Editor</code> from the context menu that appears. You will see that the contents of the <code>build.xml</code> editor window are changed, so that the definition of the target we have clicked on is displayed. For example, in figure @ref(fig:jarallTarget-fig), we’ve clicked look at the <code>jar-all</code> target and take a look.</p>
<!--Redo in Ant View-->
<div class="figure" style="text-align: center">
<img src="images/2.1jarallTarget.png" alt="The jar-all target" width="100%" />
<p class="caption">
(#fig:jarallTarget-fig)The jar-all target
</p>
</div>
<p>We can get a rough idea of what this definition is telling us. First, note the <code>depends</code> attribute in the target tag. This states that before we can build the jar file for the project, we must have built the <code>compile</code> target. This makes sense as we need to have compiled Java code before we can create a Jar file.</p>
<p>These dependencies between targets are one of the key strengths of build tools such as Ant. We can describe individual steps in the build process, and state the other steps that they depend on. At build time, Ant will examine all the targets and their dependencies and find an order of execution that means that no target is built before the targets it depends on.</p>
<p>It’s important to note, again, that you don’t need to understand everything about the Ant build file to be able to make some educated guesses about what it is doing. We don’t need a detailed understanding just now. We are just looking for easy-to-absorb clues as to what the various targets do.</p>
<div class="rmdnote">
<p><strong>A Note on Automated Build</strong></p>
<p>At this point, you might be wondering why we are bothering with this complicated build script when the Eclipse internal Java builder already seems to be doing a good job of compiling all the Java classes for us, without us needing to do anything at all.</p>
<p>The answer is that there is typically more to turning source code for a non-trivial system into deployable software than just compiling the Java code. The Eclipse internal builder creates class files for all the Java files. But when was the last time you downloaded an app or application and what you got was a folder full of class files?</p>
<p>Quite what <em>deployment</em> means differs from application to application. Simple Java applications may simply be wrapped up into a jar file, but even then we often need to supply a shell script for setting the class path and executing the main method of the entry point class. If we are building a Web application then deployment typically means packaging up the components of the application in a <code>*.war</code> file (web archive file) and copying it into a particular directory (the one used by the container manager our web server provides). Or, we might need to prepare a zip archive of files, or to package up the files ready for use by an install tool.</p>
<p>As these examples show, the steps needed to deploy a system are often very simple, but they are also quite fiddly and fussy. One wrong keystroke and we end up with something unusable. Explicitly documenting the deployment steps in an automated build script make the deployment process quick, easy and reliable for anyone on the development team to carry out, even the newest team member. That is very important, as it means that tests can be run on the deployable form of the system (even if it is not, at that point, deployed in the live environment). As we have seen, the closer our test environment can be to the live environment, the more chance there is that we’ll find errors before they reach the customer rather than afterwards.</p>
</div>
</div>
<div id="buildscript" class="section level3" number="1.3.2">
<h3><span class="header-section-number">1.3.2</span> Build the System Using the Build Script</h3>
<p>Now that we have seen something of the build script, we are going to use it to build the whole Marauroa distribution. That is, <strong>we are going to ask Ant to build the “dist” target</strong>.</p>
<p>Right-click on the target we want to build and select <em>RunAs</em> from the menu. You’ll see that the IDE recognises the file we have clicked on as an Ant Build target and offers the option of running it as an Ant build.</p>
<div class="rmdnote">
<p><strong>Note</strong>: you can build a target from both the Outline view and the Ant view in the same way</p>
</div>
<p>Select the first of the two Ant Build options. The second takes you to a wizard, but we don’t need that at this stage.</p>
<p>A Console tab will appear (figure @ref(fig:consoleOut-fig)) in the bottom section of the Eclipse window, showing the output that Ant is sending to the standard output and standard error streams while it works. Double click on the tab of the Console view, and take a look at what Ant is doing.</p>
<div class="figure" style="text-align: center">
<img src="images/2.1consoleOut.png" alt="Console output" width="100%" />
<p class="caption">
(#fig:consoleOut-fig)Console output
</p>
</div>
<p>The console output shows the various targets that Ant creates, as it works through the dependencies specified in the build script. The targets are shown at the left of the window, followed by a colon (init and compile, in the above screenshot).</p>
<p>Beneath the target, the names of the tasks invoked are shown, in square brackets.</p>
<p>The most important part of the output, of course, is shown at the end, when the process finishes:</p>
<div class="figure" style="text-align: center">
<img src="images/2.2endConsoleOut.png" alt="Console output" width="100%" />
<p class="caption">
(#fig:endconsoleOut-fig)Console output
</p>
</div>
<p>We can see here that the build was successful. We have built the executable version of the code, just by right-clicking on a target! Building Marauroa would be a lot more work if we had to carry out all these steps ourselves, manually, every time the code changes, and the chances of getting a step wrong would have been much higher. This shows one of the strengths of automated build tools. The Marauroa team have encapsulated their expertise in building their games engine into this build script file. It now becomes possible for anyone, with or without expertise in Ant, or Marauroa, to build the system in the same way.</p>
<p>In other words, the build tool has made the build process <em>repeatable</em>. A source of potential error in working with the code (and in deploying to the user) has been removed.</p>
<p>Take a moment to look through the full console output from the build command we have just run. Look for the actions the build script is taking that are vital to creating a deployable product, but which are not about compiling individual class files.</p>
</div>
<div id="examining" class="section level3" number="1.3.3">
<h3><span class="header-section-number">1.3.3</span> Examining the Results of the Build</h3>
<p>We’ll finish this step by taking a brief look at what the build process has achieved.</p>
<p>Right-click on the <code>newmarauroa</code> project name and select Refresh from the drop-down menu. Eclipse knows about any file changes you make using Eclipse tools (such as the Java editor or the internal Java builder) and can update the view of the project you see through its GUI automatically for you. But Ant is not part of Eclipse. It is a separate tool that Eclipse is running for us. When an Ant script creates new files and folders, or moves things about, Eclipse doesn’t know anything about it, and so the view of the project it shows to us can get out of date. The Refresh menu option tells Eclipse to go and look at the directory structure and files in the project directory, and to update the GUI to show the effects of any changes.</p>
<p>When you refresh, several new folders should appear: build, build-archive, dist and javadocs.</p>
<p>Take a few moments to look at the contents of these folders, and see if you can form any hypotheses as to their role in the deployment process. If we were going to share the Marauroa engine we have just built with a friend, what would we need to do?</p>
<p><strong>STEP 2 of 4 COMPLETED</strong></p>
<p>You have now completed the build step of the process. Now we need to find out whether the engine we have built does what we expect it to. Next, we will learn how to run the automated test suite that the Marauroa team have created.</p>
</div>
</div>
<div id="testing-the-marauroa-engine" class="section level2" number="1.4">
<h2><span class="header-section-number">1.4</span> Testing the Marauroa Engine</h2>
<p>Having created an executable version of the system, the next step is to check whether it is working correctly. In this part of the activity, we’ll take you through the process of running the automated test suites created by the Marauroa team. You saw one way to run JUnit tests in Eclipse in the GitLab Access Check activity. But there we just had one test class with just a few test methods to worry about. The Marauroa test suite is much larger than this, and we need a different approach.</p>
<p>We’ll take a first look at how these suites are organised and implemented in this step, though this is a topic we’ll be coming back to in future workshops, too.</p>
<div id="finding-out-what-tests-there-are-to-run" class="section level3" number="1.4.1">
<h3><span class="header-section-number">1.4.1</span> Finding Out What Tests There Are to Run</h3>
<p>Before we run the tests, it is helpful first to take a high-level look at the test suites provided by the developers of the system we are working with. One way to do this is to look at the source folders in the project. The source code for any large project, nowadays, is typically split into two halves: the production code (the part that the user will use and the customer will pay for) and the test code (the part that the development team use to work out whether they are delivering the right thing). It’s important not to get these two parts of the code mixed up, and therefore it is common practice to split test code off into its own folders (and sometimes its own packages).</p>
<p>Another source of useful information about the test suites is the Ant build script. Although called a <code>build</code> script, we have seen that these scripts do a lot more than just compiling code. Their task is not just to create an executable version of the system, but to create a verified executable that is ready for the user to take away and use. Therefore, these scripts more normally follow a three-step process:</p>
<ol style="list-style-type: decimal">
<li>build</li>
<li>test</li>
<li>deploy</li>
</ol>
<p>The Marauroa build script is unusual in that the target that produces the distribution doesn’t also run the tests. But it (the build script) does contain instructions for running the test suites.</p>
<p>Take a look at the targets in the build script. We can see that there is one called <code>test</code>. That sounds promising. Let’s take a look at figure @ref(fig:showTestTargetInBuildScript-fig)</p>
<div class="figure" style="text-align: center">
<img src="images/3.1.1showTestTargetInBuildScript.png" alt="(ref:captionshowtestcaption)" width="100%" />
<p class="caption">
(#fig:showTestTargetInBuildScript-fig)(ref:captionshowtestcaption)
</p>
</div>
<p>(ref:captionshowtestcaption) We can see that this target is dependent on another target, called <code>compile-tests</code>. That makes sense as we would expect to have to compile the test (and production) code before we can run the tests.</p>
<p>Let’s take a quick look at that target before we look at the rest of the <code>test</code> target shown in figure @ref(fig:compileTestsTargetJustCode-fig)</p>
<div class="figure" style="text-align: center">
<img src="images/3.1compileTestsTargetJustCode.png" alt="Testing targets" width="100%" />
<p class="caption">
(#fig:compileTestsTargetJustCode-fig)Testing targets
</p>
</div>
<p>The target in figure @ref(fig:compileTestsTargetJustCode-fig) depends on the <code>compile</code> target. In other words, the Marauroa team are saying here that if you want to compile the test code, then you have first to compile the production code that it tests (which makes sense, because the test code will make use of lots of classes and methods from the production code).</p>
<p>In the description of the <code>compile-tests</code> target, we can see two calls to <code>javac</code>, and a couple of file copy commands. The <code>javac</code> commands are compiling code in the folder specified by the <code>$\{src-test\}</code> property and the <code>functional_tests</code> folder.</p>
<p>A string of the form <code>\$\{something\}</code> in an Ant script is a reference to the value of the property called <code>something</code>. They can be defined in the Ant script itself (using the <code>property tag</code>), but the <code>src-test</code> property has its value set in the <code>build.ant.properties</code> file, which the build script imports. If we look in that file, we can see that this property is set to the path to the <code>tests</code> folder.</p>
<p>So, we can see from this small section of the build file (without bothering to look any further) that there are two kinds of tests in the Marauroa system: functional tests and another kind of test. It is a fairly safe bet that this other kind of test are unit tests.</p>
<div class="rmdnote">
<p><strong>Forgotten what unit tests and functional tests are?</strong></p>
<p>This was covered in COMP16412. Unit tests are short snappy tests that (strictly speaking) just test the behaviour of a single code unit. In Java, we normally think of individual classes as the units for unit testing. Functional tests are tests of the major functions that the system offers, and will typically involve the execution of many classes working together.</p>
<p>In practice, it’s quite hard to write true unit tests, and many of the tests in the <code>test</code> folder will in fact be <em>integration tests</em>, i.e., tests that assess the behaviour of a small number of units, working together.</p>
</div>
<p>Now that we understand something of what is happening in the dependent tasks, we can go back to the <code>tests</code> target. Its body contains a couple of tasks that appear to be calling a tool called <code>jacoco</code>.</p>
<p><a href="https://www.eclemma.org/jacoco/">JaCoCo</a> is a test coverage tool. We’ll look at what it does in more detail later in this activity, but for now all you need to know is that it is a tool that runs the tests, and works out what proportion of the production code statements are executed by the tests.</p>
<p>We can also see a call to a <code>junit</code> Ant task embedded in the <code>jacoco</code> task definition. That must be where the tests are actually run. It is run inside a <code>jacoco:coverage</code> task, suggesting that JaCoCo will be collecting the coverage information while JUnit is running the test suite.</p>
<p>The other target is called <code>jacoco:report</code>. The name suggests that it has the job of taking all the coverage logs gathered from running the tests, and producing a coverage report from that information.</p>