Slide 1

Slide 1 text

Dr. Javier Gonzalez-Sanchez javiergs@calpoly.edu www.javiergs.info o ffi ce: 14 -227 CSC 508/9 Software Engineering (Design & Deployment) Lecture 08. Software Product Line

Slide 2

Slide 2 text

De f inition • A softw a re product line (SPL) is a collection of softw a re systems th a t sh a re common fe a tures a nd a re developed from a single set of core a ssets: • Go a l. The go a l of a n SPL is to cre a te multiple products with less development e ff ort by reusing the development e ff ort put into gener a l components a nd services. 2

Slide 3

Slide 3 text

JetBrains 3

Slide 4

Slide 4 text

Review

Slide 5

Slide 5 text

Code 5 https://github.com/ javiergs/CSC5090

Slide 6

Slide 6 text

Code 6

Slide 7

Slide 7 text

Feedback • Do not cre a te objects from a Bl a ckbo a rd. It is a Singleton for a re a son • Use inherit a nce for PropertyCh a ngeSupport • Do not m a ke a cl a ss observer of itself - it is wired! • Be more selective with your glob a l v a ri a bles ( a tributes). Remember the de f inition of a ttribute • Ask: Wh a t this cl a ss does? C a n you a nswer in a simple st a tement. • Cle a n your code - do not commit (submit) unused methods or commented code or sever a l empty lines. It provides a b a d impression. 7

Slide 8

Slide 8 text

Clean Code Re a d a bility • DRY • KIS • SRP • Comments • Error H a ndling with a Logger 8 Metrics • LOC (eLOC, lLOC) • CC • A • Inst a bility • D

Slide 9

Slide 9 text

Design P a tterns Clean Design 9

Slide 10

Slide 10 text

Tools Maven

Slide 11

Slide 11 text

• The project object model (POM) f ile describes a project a nd its dependencies. • A st a nd a rdized directory form a t. • Repositories where third-p a rty softw a re is stored a nd discovered. 11

Slide 12

Slide 12 text

Maven File and Directories 12

Slide 13

Slide 13 text

Create a project with Maven support 13

Slide 14

Slide 14 text

POM.xml 14

Slide 15

Slide 15 text

Maven Repository 15

Slide 16

Slide 16 text

Adding a New Dependency 16

Slide 17

Slide 17 text

Right-Click POM.xml 17

Slide 18

Slide 18 text

Tools Logger

Slide 19

Slide 19 text

Problem 19

Slide 20

Slide 20 text

Problem 20

Slide 21

Slide 21 text

Bad Idea System.out.println 21 Messages

Slide 22

Slide 22 text

Logging • Recording events, a ctions, or mess a ges th a t occur during the execution of a progr a m. • Proper logging is essenti a l for m a int a ining a nd troubleshooting a pplic a tions e ff ectively throughout their lifecycle. 22

Slide 23

Slide 23 text

Good Idea 23 message 01 message 02 message 03 message 04 message 05

Slide 24

Slide 24 text

SLF4J Logback • St a nds for Simple Logging F a c a de for J a v a • It provides a uni f ied interf a ce for logging oper a tions, a llowing developers to write logging code without binding their a pplic a tion to a speci f ic logging implement a tion. 24

Slide 25

Slide 25 text

SLF4J Logback | Add the dependency 25 https://github.com/CSC3100/Tool-Logging

Slide 26

Slide 26 text

SLF4J Logback | Logging 26 https://github.com/CSC3100/Tool-Logging

Slide 27

Slide 27 text

SLF4J Logback | Logging 27 https://github.com/CSC3100/Tool-Logging

Slide 28

Slide 28 text

Severity Level 28 TRACE DEBUG INFO WARN ERROR Severity

Slide 29

Slide 29 text

We want this 29 message 01 message 02 message 03 message 04 message 05 trace() debug() info () warn () error() Logger 29

Slide 30

Slide 30 text

Maven File and Directories 30

Slide 31

Slide 31 text

Resources Folder • The resources folder in a M a ven project stores non-source-code f iles th a t your a pplic a tion needs, such a s con f igur a tion f iles, property f iles, im a ges, a nd other resources. • These f iles a re included in the f in a l build output a nd a v a il a ble on the cl a ssp a th a t runtime. 31

Slide 32

Slide 32 text

src/main/resources/logback.xml • logb a ck.xml is a con f igur a tion f ile for SLF4J Logb a ck. • It de f ines how logging should be h a ndled, including log levels, a ppenders (where logs a re written), a nd log form a ts. • When your a pplic a tion st a rts, SLF4J Logb a ck a utom a tic a lly looks for this con f igur a tion f ile. 32

Slide 33

Slide 33 text

src/main/resources/logback.xml 33 https://github.com/CSC3100/Tool-Logging

Slide 34

Slide 34 text

SLF4J Logback | Logging 34

Slide 35

Slide 35 text

ConsoleAppender 35 message 01 message 02 message 03 message 04 message 05 trace() debug() info () warn () error() Logger 35 Appender

Slide 36

Slide 36 text

Encoder

Slide 37

Slide 37 text

Logstash Logback Encoder | POM.xml • Let’s use a nother libr a ry to t a ke a dv a nt a ge of extr a encoders • form a t Spring Boot logs in JSON form a t 37 https://github.com/CSC3100/Tool-Logging

Slide 38

Slide 38 text

src/main/resources/logback.xml 38 https://github.com/CSC3100/Tool-Logging

Slide 39

Slide 39 text

SLF4J Logback | Logging 39

Slide 40

Slide 40 text

FileAppender

Slide 41

Slide 41 text

Next 41 trace() debug() info () warn () error() message 01 message 02 message 03 message 04 message 05 Logger Appender Appender

Slide 42

Slide 42 text

src/main/resources/logback.xml 42 https://github.com/CSC3100/Tool-Logging

Slide 43

Slide 43 text

SLF4J Logback | Logging 43

Slide 44

Slide 44 text

Next

Slide 45

Slide 45 text

Questions 46

Slide 46

Slide 46 text

CSC 509 Software Engineering Javier Gonzalez-Sanchez, Ph.D. javiergs@calpoly.edu Fall 2024 Copyright. These slides can only be used as study material for the class CSC509 at Cal Poly. They cannot be distributed or used for another purpose.