The Pro­gram­ming Pro­jec­t

A clear Fordel.

In­troduc­tion

Who are Y­ou?

  • Chris­t­ian, and

  • TA Chris­t­ian (2 hours af­ter 13, most days)

Y­ou on­ly learn from y­our mis­takes.

What are we go­ing to learn?

  • Working in s­mal­l group­s

  • Pri­or­i­tize re­quire­ments

  • Ver­i­fy the code

  • Use ver­sion con­trol

What are we go­ing to do?

Overview

  • From 4th of June to 26th of June,

  • Work in ran­dom group­s of four, to

  • Build a re­al prod­uc­t,

  • with chang­ing re­quire­ments.

In de­tail

  • UT­D need­s a pro­jec­t and in­tern­ship allo­ca­tor.

  • Y­ou al­ready have some code.

Wait, are the re­quire­ments chang­ing?

  • Yes, at every meet­ing y­ou will get more US to do.

  • Y­ou have to fig­ure out what cus­tomer wants.

  • Out of meet­ing y­ou can send e­mail­s, but ex­pec­t some de­lay.

Why ran­dom group­s?

  • Mim­ic Na­ture

  • Help y­ou get a big­ger net­work

Why are we do­ing a Group Con­trac­t?

But, why?

  • A great change to set ex­pec­ta­tion­s.

  • It will be the le­gal doc­u­men­t we will hold y­ou to, if dis­putes hap­pen­s.

But, what?

  • How much do y­ou wan­t to work?

  • What hap­pen­s is some­one is not pulling their weight?

  • Or, if they pul­l too much?

  • In sick­ness and health.

Ex­er­cise: Ask each oth­er

  • What is u­n­ac­cept­able be­hav­ior?

  • If y­ou work 120 hours, what grade would y­ou ex­pec­t?

  • How many hours on top would an bet­ter grade be worth to y­ou?

  • How many sick days can y­ou have?

  • Is us­ing GenAI okay?

We wan­t struc­ture!

Ex­er­cise: Ask each oth­er

What are we not al­lowed to do?

  • Plagi­a­rise.

  • Break Copy­right.

  • Copi­lot and Chat­G­P­T is fine, but y­ou own the code.

How are we grad­ed?

  • Val­ue produced to the cus­tomer,

  • y­our re­port,

  • the amoun­t and qual­i­ty of the code writ­ten and test­ed,

  • y­our team work, and

  • y­our re­flec­tion­s on les­son­s learned.

What if I re­al­ly wan­t to fail?

Blame is not for fail­ure, it is for fail­ing to help or ask for help. ― Jor­gen Vig Knud­stor­p

How To Fail

  • Do not write any code, or

  • Pre­ven­t y­our group mem­ber­s from writ­ing code.

But, I'm afraid to code!

Writ­ing test­s is a great way to get un­stuck and cre­ate val­ue.

What is the Con­tri­bu­tion S­core?

The Con­tri­bu­tion S­core

  • A clever way to cal­cu­late how much of the fi­nal ver­sion y­ou con­tributed to.

  • On­ly look­s at source code and the re­port.

  • Y­ou will get feed­back be­fore each meet­ing.

How to get the most of it.

  • Y­ou can­not push di­rect­ly to the main branch (use pul­l re­quest­s).

  • On­ly com­mit­s where y­ou are the au­thor counts.

  • If y­ou are pair pro­gram­ming, switch be­tween au­thors.

What if we wan­t to know more?

  • Use the web­page :), but

  • let me know if some­thing is mis­s­ing.

What if we wan­t help?

  • Use the TA s­lot­s (af­ter 13, most days),

  • Con­tac­t the TA or Me on e­mail­s or team­s,

  • I might arrange Q/A's dur­ing the course if need­ed.

  • Send anony­mous feed­back! home (§5)

What now?

  • Make sure to fil­l out y­our Group Con­tract­s, home (§2.1).

  • Cre­ate a Git­lab (§4) ac­coun­t.

  • Come talk to me when both is done, and I'l­l cre­ate y­our repos­i­to­ry.

The Tech­ni­cal Part

Now we are ready to get tech­ni­cal.

User Sto­ries

As a stu­den­t I wan­t to have con­stan­t feed­back so that I use the feed­back to im­prove.

The Tech­nolo­gies

HTTP

Figure HTTP is a Pro­to­col

Figure from md­n web­doc­s.

Figure from md­m web­doc­s

@GetMapping("/login")
public String getLogin() {
    return "login"; // Render the login template
}
@PostMapping("/login")
public String postLogin(
        @RequestParam("email") String email,
        @RequestParam("password") String password,
        Model model,
        HttpSession session) {

    // ...

    session.setAttribute("auth", auth);

    return "redirect:/";

}

Trans­ac­tion­s and U­nit-of-­Work

A Joke

The good thing about a key-chain is that y­ou lose al­l y­our keys at once.

Exam­ple

try (var uow = unitOfWork.begin()) {
    auth = authenticator.authenticate(user, password);
    uow.commit();
}

Mi­gra­tions

  • In file X.sql de­scribe how to go from data­base X-1 to X.

  • N­ev­er change a mi­gra­tion file, af­ter it has been de­ployed.

  • Just cre­ate a new one.

De­pen­den­cies and In­ver­sion

Figure Bad de­pen­den­cies

Figure In­versed De­pen­den­cies

Test­ing

Kind­s of Test­s

  • U­nit Test­s (On­ly test the be­hav­ior)

  • End-­to-End Test­s (Test every­thing)

The stages of test

  • Arrange (Set­up the s­tate)

  • Ac­t (Do some­thing)

  • As­sert (Check the s­tate has changed correct­ly)

One exam­ple test

@Test
@DisplayName("with no local is invalid")
void with_no_domain_is_invalid() {
    var t = assertThrows(InvalidEmail.class, 
      () -> Email.of("my@"));
    assertEquals("domain is empty", t.getMessage());
}

Cover­age

Figure Code cover­age re­port, bor­rowed from geeks­forgeek­s.

What is good e­nough?

  • 100% is im­pos­si­ble, but

  • 0% is u­n­ac­cept­able.

Ques­tion­s?

Now is the time for ques­tion­s.