Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CSC305 Summer Lecture 03

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers.

CSC305 Summer Lecture 03

Individual Software Design and Development
Software Design
(202507)

Tweet

More Decks by Javier Gonzalez-Sanchez

Other Decks in Programming

Transcript

  1. Dr. Javier Gonzalez-Sanchez [email protected] www.javiergs.info o ffi ce: 14 -227

    CSC 305 Individual Software Design and Development | Summer Version Lecture 03. Design
  2. Github + Maven • Follow M a ven directory structure

    • Commit only f iles th a t a re expected to be in the repository 29
  3. Driver • Entry point of the a pplic a tion.

    • Cont a ins the m a in(String[] a rgs) method. • Expects the folder p a th a s a comm a nd-line a rgument. • C a lling object: f ileH a ndler.re a dFileN a mes(folderP a th) to get f ile n a mes. • C a lling object: bo a rdM a n a ger.cre a teBo a rd( f ileN a mes) to gener a te the bo a rd l a yout. 30
  4. FileHandler • Re a ds f iles from the given

    folder. • Cont a ins a method re a dFileN a mes(String folderP a th) th a t: (1) Re a ds a ll non-directory f ile n a mes in the speci f ied folder; (2) Returns a n a rr a y of strings with the n a mes. 31
  5. BoardHandler • M a n a ges the bo a

    rd a nd its l a yout. • H a s a n Arr a yList<Squ a re> to store squ a res. • The cre a teBo a rd(String[] f ileN a mes) method: (1) Cre a tes one Squ a re per f ile n a me; (2) C a lcul a tes the optim a l number of columns a nd rows to f it a ll squ a res in a l a yout close to a squ a re (e.g., 5×4 for 18 f iles, not 6×3). 32
  6. Square • Represents one visu a l unit on the

    bo a rd. • Stores: (1) The f ile n a me; (2) Position on the bo a rd (column a nd row); (3) A color, a ssign a color to e a ch f ile a ccording with some condition such a s size, d a te of cre a tion, or just r a ndom (for now). • H a s a method toString a s follows: @Override public String toString() { return String.format("(%d,%d) %s [%s]", row, col, fileName, color); } 33
  7. Output | from a folder with 18 f iles •

    (0,0) report.pdf [#3FA1E4] • (0,1) d a t a .csv [#FF5733] • (0,2) notes.txt [#A1FF33] • (0,3) im a ge.png [#33FFA8] • (0,4) di a gr a m.svg [#C70039] • (1,0) t a ble.xlsx [#9C27B0] • (1,1) summ a ry.docx [#F44336] • (1,2) Code.j a v a [#4CAF50] • (1,3) log.txt [#00BCD4] • (1,4) slide.pptx [#E91E63] • (2,0) resume.doc [#FF9800] • (2,1) gr a ph.jpg [#2196F3] • (2,2) re a dme.txt [#FFC107] • (2,3) con f ig.ini [#9E9E9E] • (2,4) README.md [#607D8B] • (3,0) m a in.cpp [#795548] • (3,1) LICENSE [#CDDC39] • (3,2) St a ts.j a v a [#009688] 34
  8. Lab

  9. Part A | Create a Diagram public class B implements

    E { public B() { C c1 = new C(); } public void method() { B b = new B(); b.sleep(); } } public class Y extends B { A [] a = new A[5]; } public class A extends B { C c1, c2; public A() { c1 = new C(); } public void method(D d) { d.working(); } } public class X { private String s; public void m() { B var = new A(); double x – Math.sqrt(5); } }
  10. CSC 305 Individual Software Design and Development Javier Gonzalez-Sanchez, Ph.D.

    [email protected] Summer 2025 Copyright. These slides can only be used as study material for the class CSC305 at Cal Poly. They cannot be distributed or used for another purpose.