Slide 1

Slide 1 text

Dr. Javier Gonzalez-Sanchez [email protected] www.javiergs.info o ffi ce: 14 -227 CSC 307 Introduction to Software Engineering Lecture 11. Dependency Management

Slide 2

Slide 2 text

Previously

Slide 3

Slide 3 text

GoF Patterns 3

Slide 4

Slide 4 text

Application 4

Slide 5

Slide 5 text

Dependencies

Slide 6

Slide 6 text

Library • A collection of resources (cl a sses) • A J a v a Archive, or JAR f ile, cont a ins a ll of the v a rious components th a t m a ke up a self- cont a ined, execut a ble J a v a a pplic a tion or, most commonly, a J a v a libr a ry to which a J a v a Runtime Environment c a n link. 6

Slide 7

Slide 7 text

jar-download.com 7

Slide 8

Slide 8 text

• Build m a n a gement tool • M a ven a utom a tes dependency m a n a gement by a utom a tic a lly downlo a ding required libr a ries a nd their dependencies, ensuring consistent builds with speci f ied versions. • In contr a st, m a nu a lly downlo a ding JARs is l a bor-intensive a nd error-prone. 8

Slide 9

Slide 9 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. 9

Slide 10

Slide 10 text

Create a project with Maven support 10

Slide 11

Slide 11 text

Or Add Framework Support 11 Do one of these

Slide 12

Slide 12 text

Or Add Framework Support 12

Slide 13

Slide 13 text

Maven File and Directories 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

Jsoup Java HTML Parser

Slide 19

Slide 19 text

Jsoup • A J a v a libr a ry th a t simpli f ies working with HTML a nd XML. • O ff ers URL fetching, d a t a p a rsing, extr a ction, a nd m a nipul a tion. • https://jsoup.org/ 19

Slide 20

Slide 20 text

MVN Repository 20

Slide 21

Slide 21 text

Load Maven Changes 21

Slide 22

Slide 22 text

Jsoup Example 22

Slide 23

Slide 23 text

https://github.com/CSC3100/Maven 23 https://github.com/CSC3100/Tool-Maven

Slide 24

Slide 24 text

We need to talk about the Factory Pattern Pattern 24

Slide 25

Slide 25 text

JavaParser A Parser for Java Code

Slide 26

Slide 26 text

JavaParser • A J a v a libr a ry to a n a lyze, tr a nsform, a nd gener a te J a v a code. • https://j a v a p a rser.org/ 26

Slide 27

Slide 27 text

MVN Repository 27

Slide 28

Slide 28 text

Load Maven Changes 28

Slide 29

Slide 29 text

JavaParser Example 29

Slide 30

Slide 30 text

https://github.com/CSC3100/Maven 30 https://github.com/CSC3100/Tool-Maven

Slide 31

Slide 31 text

We need to talk about the Null Object Pattern Pattern 31

Slide 32

Slide 32 text

JFreeChart Display Charts

Slide 33

Slide 33 text

JFreeChart • https://www.jfree.org/jfreech a rt/ • JFreeCh a rt is a libr a ry to displ a y profession a l-qu a lity ch a rts. 33

Slide 34

Slide 34 text

MVN Repository 34

Slide 35

Slide 35 text

Load Maven Changes 35

Slide 36

Slide 36 text

JFreeChart Example 36

Slide 37

Slide 37 text

https://github.com/CSC3100/Maven 37 https://github.com/CSC3100/Tool-Maven

Slide 38

Slide 38 text

Another appearance of the Factory Pattern Pattern 38

Slide 39

Slide 39 text

Weka Machine Learning

Slide 40

Slide 40 text

Weka • Wek a is a collection of m a chine le a rning a nd d a t a a n a lysis • W a ik a to Environment for Knowledge An a lysis (Wek a ) • developed a t the University of W a ik a to, New Ze a l a nd • https://ml.cms.w a ik a to. a c.nz/wek a • 40

Slide 41

Slide 41 text

MVN Repository 41

Slide 42

Slide 42 text

Load Maven Changes 42

Slide 43

Slide 43 text

Step 0: Data 43

Slide 44

Slide 44 text

Step 1: Create Instances 44

Slide 45

Slide 45 text

Step 1: Or Load Instances 45

Slide 46

Slide 46 text

Step 2. Clustering 46

Slide 47

Slide 47 text

https://github.com/CSC3100/Maven 47 https://github.com/CSC3100/Tool-Maven

Slide 48

Slide 48 text

115,475 Towns and Cities in the United States July, 2012 https://www.math.uwaterloo.ca/tsp/data/usa/index.html A dataset 48

Slide 49

Slide 49 text

Questions 49

Slide 50

Slide 50 text

Review this curated list of Java libraries: https://github.com/akullpp/awesome-java Homework 50

Slide 51

Slide 51 text

Select one - none from today’s lecture. Create something Awesome! Homework 51

Slide 52

Slide 52 text

Lab. Decorator Pattern

Slide 53

Slide 53 text

Lab 1. Make NumberGenerator to randomly generate (x, y) 2. Let’s add Decorations to our Shapes

Slide 54

Slide 54 text

Lab Make NumberGenerator to randomly generate x, y, type (1=circle, 2=square), NumberOfDecorations (0,1,2,3)

Slide 55

Slide 55 text

Shape Decorator 55 0 1 2 3 0

Slide 56

Slide 56 text

Shape Decorator 56 0 1 2 3 0

Slide 57

Slide 57 text

CSC 307 Introduction to Software Engineering Javier Gonzalez-Sanchez, Ph.D. [email protected] Summer 2024 Copyright. These slides can only be used as study material for the class CSC307 at Cal Poly. They cannot be distributed or used for another purpose.