\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{akschool} \pdfinfo{ /Title (cs2340-exam2.pdf) /Creator (Cheatography) /Author (akschool) /Subject (cs2340\_exam2 Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{A3A3A3} \definecolor{LightBackground}{HTML}{F3F3F3} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{cs2340\_exam2 Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{akschool} via \textcolor{DarkBackground}{\uline{cheatography.com/144347/cs/30976/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}akschool \\ \uline{cheatography.com/akschool} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Not Yet Published.\\ Updated 2nd March, 2022.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{3} \begin{tabularx}{5.377cm}{x{0.82386 cm} x{1.87657 cm} x{1.87657 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{Test-Driven Development}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{3}{x{5.377cm}}{Failure vs Fault vs Error} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} & Failure & Observable incorrect behavior, ex. a+b vs a*b \tn % Row Count 4 (+ 3) % Row 2 \SetRowColor{LightBackground} & Fault (bug): & Related to the code. Failure IFF fault \tn % Row Count 7 (+ 3) % Row 3 \SetRowColor{white} & Error & Cause of a fault. Usually human error (conceptual, typo, etc.) \tn % Row Count 11 (+ 4) % Row 4 \SetRowColor{LightBackground} \seqsplit{Verification} & Testing (test cases), Static Verification (all possible inputs), \seqsplit{Inspection/review/walkthrough}, Formal proof & \tn % Row Count 18 (+ 7) % Row 5 \SetRowColor{white} \seqsplit{Granularity:} & Unit Testing -\textgreater{} Integration Testing -\textgreater{} System testing -\textgreater{} Acceptance testing -\textgreater{} Regression testing & \tn % Row Count 25 (+ 7) % Row 6 \SetRowColor{LightBackground} within org & Developers testing -\textgreater{} Alpha testing & outside org: Beta testing -\textgreater{} Product release \tn % Row Count 28 (+ 3) % Row 7 \SetRowColor{white} what is tdd & Write tests -\textgreater{} write functional code -\textgreater{} refactor & "Make it Fail, Make it Work, Make it Better" \tn % Row Count 31 (+ 3) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{0.82386 cm} x{1.87657 cm} x{1.87657 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{Test-Driven Development (cont)}} \tn % Row 8 \SetRowColor{LightBackground} Why TDD & Provides incremental specification, avoid regression errors & \tn % Row Count 4 (+ 4) % Row 9 \SetRowColor{white} \seqsplit{Structure} of tests & Set fixture, invoke, check, cleanup & \tn % Row Count 7 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.46464 cm} x{1.55618 cm} x{1.55618 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{Teamwork Considerations}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{3}{x{5.377cm}}{People are most important asset} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} Critical factors in people management & Consistency, respect, inclusion & \tn % Row Count 5 (+ 4) % Row 2 \SetRowColor{LightBackground} Factors influencing team working & Group composition, Group cohesiveness, Group \seqsplit{communications}, Group organization & \tn % Row Count 12 (+ 7) % Row 3 \SetRowColor{white} & Group composition & \seqsplit{Task-oriented}, \seqsplit{self-oriented}, \seqsplit{interaction-oriented} \tn % Row Count 16 (+ 4) % Row 4 \SetRowColor{LightBackground} Hitchhiker: & Take credit for team's work w/o contributing & \tn % Row Count 20 (+ 4) % Row 5 \SetRowColor{white} Couch potato & Willing to work, but drag their feet & \tn % Row Count 23 (+ 3) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{3}{x{5.377cm}}{Absorbing leads to couch potatoes / hitchhikers} \tn % Row Count 24 (+ 1) % Row 7 \SetRowColor{white} \mymulticolumn{3}{x{5.377cm}}{- Mirroring reflects consequences onto hitchhikers} \tn % Row Count 25 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{0.96117 cm} x{1.78503 cm} x{1.8308 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{Sequence Robustness}} \tn % Row 0 \SetRowColor{LightBackground} GUI \seqsplit{prototype} -\textgreater{} Code & Dynamic & Static \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} & Use Case Model -\textgreater{} Robustness diagram -\textgreater{} Sequence Diagram & Domain Model -\textgreater{} Class Diagram \tn % Row Count 7 (+ 4) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{3}{x{5.377cm}}{Robustness diagrams bridge the "what/how" gap} \tn % Row Count 8 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{3}{x{5.377cm}}{Notation} \tn % Row Count 9 (+ 1) % Row 4 \SetRowColor{LightBackground} & Boundary Class & a user interface or API class to external system \tn % Row Count 12 (+ 3) % Row 5 \SetRowColor{white} & Entity Class & a class from the domain model \tn % Row Count 14 (+ 2) % Row 6 \SetRowColor{LightBackground} & Controller Class & a class representing business logic or logical software function \tn % Row Count 18 (+ 4) % Row 7 \SetRowColor{white} Valid \seqsplit{relationships} & Nouns\textless{}-\textgreater{}Verbs, Verbs\textless{}-\textgreater{}Verbs & Nouns!-\textgreater{}nouns \tn % Row Count 21 (+ 3) % Row 8 \SetRowColor{LightBackground} & valid ex: Actor-\textgreater{}Boundary, Boundary\textless{}-\textgreater{}Controller, entity-\textgreater{}controller & \tn % Row Count 26 (+ 5) % Row 9 \SetRowColor{white} & invalid ex: actor-\textgreater{}controller/entity, boundary-\textgreater{}entity, entity\textless{}-\textgreater{}entity, boundary\textless{}-\textgreater{}boundary & \tn % Row Count 33 (+ 7) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{0.96117 cm} x{1.78503 cm} x{1.8308 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{Sequence Robustness (cont)}} \tn % Row 10 \SetRowColor{LightBackground} \mymulticolumn{3}{x{5.377cm}}{Robustness analysis guidelines:} \tn % Row Count 1 (+ 1) % Row 11 \SetRowColor{white} & Make a boundary object for each screen \& name them well & \tn % Row Count 5 (+ 4) % Row 12 \SetRowColor{LightBackground} & Usually not real controller objects, but rather logical software functions & \tn % Row Count 10 (+ 5) % Row 13 \SetRowColor{white} & Direction of arrows not important & \tn % Row Count 13 (+ 3) % Row 14 \SetRowColor{LightBackground} & \seqsplit{Boundary/entity} classes -\textgreater{} object instances, controllers -\textgreater{} messages & \tn % Row Count 18 (+ 5) % Row 15 \SetRowColor{white} \mymulticolumn{3}{x{5.377cm}}{Sequence Diagrams} \tn % Row Count 19 (+ 1) % Row 16 \SetRowColor{LightBackground} & SD shows how objects within system interact & SSD shows how actors interact w system \tn % Row Count 22 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{p{0.4577 cm} x{1.8308 cm} x{2.2885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{Design Class Diagrams}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{3}{x{5.377cm}}{Domain model shows real-world concepts, DCD shows software entities} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{3}{x{5.377cm}}{Class attributes} \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} & Full format & visibility name : type multiplicity = default \{property-string\} \tn % Row Count 7 (+ 4) % Row 3 \SetRowColor{white} & Visibility marks & + (public), - (private), \# (protected) \tn % Row Count 9 (+ 2) % Row 4 \SetRowColor{LightBackground} & Attributes assumed private if no visibility is given & \tn % Row Count 13 (+ 4) % Row 5 \SetRowColor{white} & Operations assumed public if no visibility is given & \tn % Row Count 17 (+ 4) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{3}{x{5.377cm}}{Attribution text vs association line} \tn % Row Count 18 (+ 1) % Row 7 \SetRowColor{white} & {\bf{{[}IMAGE HERE{]}}} & \tn % Row Count 19 (+ 1) % Row 8 \SetRowColor{LightBackground} & Guideline & Use the attribute text notation for data type objects and the association line notation for others \tn % Row Count 24 (+ 5) % Row 9 \SetRowColor{white} \mymulticolumn{3}{x{5.377cm}}{Two ways to show collection attributes} \tn % Row Count 25 (+ 1) % Row 10 \SetRowColor{LightBackground} & {\bf{{[}IMAGE HERE{]}}} & \tn % Row Count 26 (+ 1) % Row 11 \SetRowColor{white} \mymulticolumn{3}{x{5.377cm}}{Note symbol: can represent UML note or comment, UML constraint, or Method body} \tn % Row Count 28 (+ 2) % Row 12 \SetRowColor{LightBackground} \mymulticolumn{3}{x{5.377cm}}{Operations and Methods:} \tn % Row Count 29 (+ 1) % Row 13 \SetRowColor{white} & Operation syntax, UML1: & visibility name (parameter-list) : return-type = default \{property-string\} \tn % Row Count 33 (+ 4) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{p{0.4577 cm} x{1.8308 cm} x{2.2885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{Design Class Diagrams (cont)}} \tn % Row 14 \SetRowColor{LightBackground} & Operations are usually assumed public if no visibility is shown & \tn % Row Count 4 (+ 4) % Row 15 \SetRowColor{white} & Operations to access attributes are often excluded & \tn % Row Count 8 (+ 4) % Row 16 \SetRowColor{LightBackground} \mymulticolumn{3}{x{5.377cm}}{UML keywords:} \tn % Row Count 9 (+ 1) % Row 17 \SetRowColor{white} & «actor»: & classifier is an actor, ex: in class diagram, above classifier name \tn % Row Count 13 (+ 4) % Row 18 \SetRowColor{LightBackground} & «interface» & classifier is an interface, ex: in class diagram, above classifier name \tn % Row Count 17 (+ 4) % Row 19 \SetRowColor{white} & \{abstract\} & abstract element; can't be instantiated, ex: in class diagrams, after classifier name or operation name \tn % Row Count 23 (+ 6) % Row 20 \SetRowColor{LightBackground} & \{ordered\} & a set of objects have some imposed order, ex: in class diagrams, at an association end \tn % Row Count 28 (+ 5) % Row 21 \SetRowColor{white} \mymulticolumn{3}{x{5.377cm}}{Dependency:} \tn % Row Count 29 (+ 1) % Row 22 \SetRowColor{LightBackground} & {\bf{{[}IMAGE HERE{]}}} & \tn % Row Count 30 (+ 1) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{p{0.4577 cm} x{1.8308 cm} x{2.2885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{Design Class Diagrams (cont)}} \tn % Row 23 \SetRowColor{LightBackground} & dependency labels are optional & ex: \textless{}\textless{}call\textgreater{}\textgreater{} and \textless{}\textless{}create\textgreater{}\textgreater{} \tn % Row Count 2 (+ 2) % Row 24 \SetRowColor{white} \mymulticolumn{3}{x{5.377cm}}{Interfaces, Inheritance, Abstract class, Composition, Aggregation} \tn % Row Count 4 (+ 2) % Row 25 \SetRowColor{LightBackground} & {\bf{{[}IMAGE HERE{]}}} & \tn % Row Count 5 (+ 1) % Row 26 \SetRowColor{white} & Aggregation & "has-part" association relationship, exists w/o parent \tn % Row Count 8 (+ 3) % Row 27 \SetRowColor{LightBackground} & Composition & whole-part association relationship, needs parent to exist \tn % Row Count 11 (+ 3) % Row 28 \SetRowColor{white} \mymulticolumn{3}{x{5.377cm}}{Constraints (3 ways)} \tn % Row Count 12 (+ 1) % Row 29 \SetRowColor{LightBackground} & {\bf{{[}IMAGE HERE{]}}} & \tn % Row Count 13 (+ 1) % Row 30 \SetRowColor{white} \mymulticolumn{3}{x{5.377cm}}{Utility class} \tn % Row Count 14 (+ 1) % Row 31 \SetRowColor{LightBackground} & {\bf{{[}CODE HERE{]}}} & \tn % Row Count 15 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.55618 cm} x{1.51041 cm} x{1.51041 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{Mapping designs to code}} \tn % Row 0 \SetRowColor{LightBackground} \seqsplit{Class-Responsibility-Collaboration} (CRC) & \seqsplit{Brainstorming} tool used in OOD. CRC cards are usually created from index cards. & \tn % Row Count 7 (+ 7) % Row 1 \SetRowColor{white} CRUFT & useless, redundant, or poorly written code & \tn % Row Count 11 (+ 4) % Row 2 \SetRowColor{LightBackground} Don't Repeat Yourself (DRY) & Every piece of knowledge must have a single, unambiguous, \seqsplit{authoritative} \seqsplit{representation} within a system & \tn % Row Count 19 (+ 8) % Row 3 \SetRowColor{white} \mymulticolumn{3}{x{5.377cm}}{Separation of concerns (SOC)} \tn % Row Count 20 (+ 1) % Row 4 \SetRowColor{LightBackground} & Design principle for separating a computer & \tn % Row Count 24 (+ 4) % Row 5 \SetRowColor{white} & Concern is a set of information that affects the code of a computer program & \tn % Row Count 30 (+ 6) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{1.55618 cm} x{1.51041 cm} x{1.51041 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{Mapping designs to code (cont)}} \tn % Row 6 \SetRowColor{LightBackground} \mymulticolumn{3}{x{5.377cm}}{You Aren't Gonna Need It (YAGNI)} \tn % Row Count 1 (+ 1) % Row 7 \SetRowColor{white} & A programmer should not add \seqsplit{functionality} until deemed necessary & \tn % Row Count 6 (+ 5) % Row 8 \SetRowColor{LightBackground} & "do the simplest thing that could possibly work" & \tn % Row Count 10 (+ 4) % Row 9 \SetRowColor{white} & Must be used in combination with several other practices, such as continuous refactoring, unit testing and continuous integration & \tn % Row Count 20 (+ 10) % Row 10 \SetRowColor{LightBackground} Collection Classes: & One-to-many \seqsplit{relationships} are common. & E.g., a Sale must maintain visibility to a group of many \seqsplit{SalesLineItem} instances \tn % Row Count 27 (+ 7) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{p{0.50347 cm} x{2.05965 cm} x{2.01388 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{Object visibility}} \tn % Row 0 \SetRowColor{LightBackground} \seqsplit{Visibility} & the ability of one object to see or have reference to another & \tn % Row Count 4 (+ 4) % Row 1 \SetRowColor{white} \mymulticolumn{3}{x{5.377cm}}{Attribute visibility: B is an attribute of A} \tn % Row Count 5 (+ 1) % Row 2 \SetRowColor{LightBackground} & Relatively permanent visibility & \tn % Row Count 7 (+ 2) % Row 3 \SetRowColor{white} & Common form of visibility in OO systems & \tn % Row Count 10 (+ 3) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{3}{x{5.377cm}}{Parameter visibility: B is a parameter of a method in A} \tn % Row Count 12 (+ 2) % Row 5 \SetRowColor{white} & Relatively temporary visibility & \tn % Row Count 14 (+ 2) % Row 6 \SetRowColor{LightBackground} & Common to transform parameter visibility into attribute visibility & \tn % Row Count 18 (+ 4) % Row 7 \SetRowColor{white} \mymulticolumn{3}{x{5.377cm}}{Local visibility: B is a (non-parameter) local object in a method of A} \tn % Row Count 20 (+ 2) % Row 8 \SetRowColor{LightBackground} & Relatively temporary visibility & \tn % Row Count 22 (+ 2) % Row 9 \SetRowColor{white} & Two methods: & - Create a new local instance and assign it to a local variable. \tn % Row Count 26 (+ 4) % Row 10 \SetRowColor{LightBackground} & & - Assign the returning object from a method invocation to a local variable. \tn % Row Count 31 (+ 5) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{p{0.50347 cm} x{2.05965 cm} x{2.01388 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{Object visibility (cont)}} \tn % Row 11 \SetRowColor{LightBackground} \mymulticolumn{3}{x{5.377cm}}{Global visibility: B is globally visible} \tn % Row Count 1 (+ 1) % Row 12 \SetRowColor{white} & Preferred method to achieve global visibility is to use the Singleton pattern. & \tn % Row Count 6 (+ 5) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{p{0.4177 cm} x{1.16956 cm} x{1.29487 cm} x{1.29487 cm} } \SetRowColor{DarkBackground} \mymulticolumn{4}{x{5.377cm}}{\bf\textcolor{white}{Code smells}} \tn % Row 0 \SetRowColor{LightBackground} code smell & \seqsplit{quick-to-spot} surface indication that something is wrong with your code & & \tn % Row Count 7 (+ 7) % Row 1 \SetRowColor{white} \mymulticolumn{4}{x{5.377cm}}{usually found during examining \& refactoring} \tn % Row Count 8 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{4}{x{5.377cm}}{usually caused by rushed design and a disregard for technical debt} \tn % Row Count 10 (+ 2) % Row 3 \SetRowColor{white} & technical debt & the amount of work you create when you try to save time upfront & \tn % Row Count 16 (+ 6) % Row 4 \SetRowColor{LightBackground} & right way vs fast way & & \tn % Row Count 18 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{4}{x{5.377cm}}{Types} \tn % Row Count 19 (+ 1) % Row 6 \SetRowColor{LightBackground} & Bloaters & long method, large class, long parameter list (\textgreater{}=3,4), data clumps (ex: RGB always together) & \tn % Row Count 27 (+ 8) % Row 7 \SetRowColor{white} & \seqsplit{Object-Orientation} Abusers & Switch statements, Refused Bequest (inherit methods but unused or redefined) & \tn % Row Count 34 (+ 7) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{p{0.4177 cm} x{1.16956 cm} x{1.29487 cm} x{1.29487 cm} } \SetRowColor{DarkBackground} \mymulticolumn{4}{x{5.377cm}}{\bf\textcolor{white}{Code smells (cont)}} \tn % Row 8 \SetRowColor{LightBackground} & Change Preventers & & \tn % Row Count 2 (+ 2) % Row 9 \SetRowColor{white} & & Divergent Change (many changes to single class from copy-paste) & \tn % Row Count 8 (+ 6) % Row 10 \SetRowColor{LightBackground} & & Shotgun surgery (many small changes to many classes from too much coupling, too little cohesion) & \tn % Row Count 16 (+ 8) % Row 11 \SetRowColor{white} & \seqsplit{Dispensables} & Lazy class (doesn't do enough), Data class (only fields + \seqsplit{getters/setters)}, Duplicated code & \tn % Row Count 24 (+ 8) % Row 12 \SetRowColor{LightBackground} & Couplers & & \tn % Row Count 25 (+ 1) % Row 13 \SetRowColor{white} & & Feature envy & A method that seems more interested in a class other than the one it is in \tn % Row Count 32 (+ 7) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{p{0.4177 cm} x{1.16956 cm} x{1.29487 cm} x{1.29487 cm} } \SetRowColor{DarkBackground} \mymulticolumn{4}{x{5.377cm}}{\bf\textcolor{white}{Code smells (cont)}} \tn % Row 14 \SetRowColor{LightBackground} & & \seqsplit{Inappropriate} intimacy & Classes know too much about each other's private parts (tightly coupled) \tn % Row Count 6 (+ 6) % Row 15 \SetRowColor{white} & & Middle man: & class performs one action delegating work to other class \tn % Row Count 11 (+ 5) \hhline{>{\arrayrulecolor{DarkBackground}}----} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.8308 cm} x{2.2885 cm} p{0.4577 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{Responsibility-driven design}} \tn % Row 0 \SetRowColor{LightBackground} responsibility & Obligation to perform a task or know information & \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} \mymulticolumn{3}{x{5.377cm}}{Behavior (doing) vs data (knowing)} \tn % Row Count 4 (+ 1) % Row 2 \SetRowColor{LightBackground} Methods vs \seqsplit{responsibilities} & methods fulfill responsibilities & \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} & Responsibilities are implemented by means of methods that either act alone or collaborate with other methods and objects & \tn % Row Count 12 (+ 6) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{p{0.73232 cm} x{1.92234 cm} x{1.92234 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{GRASP: {[}spell out{]}}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{3}{x{5.377cm}}{Who is responsible for creating a new instance of a class?} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} & Rules: Assign class B to create class A if: & \tn % Row Count 5 (+ 3) % Row 2 \SetRowColor{LightBackground} & & B contains or aggregates A \tn % Row Count 7 (+ 2) % Row 3 \SetRowColor{white} & & B records A \tn % Row Count 8 (+ 1) % Row 4 \SetRowColor{LightBackground} & & B closely uses A \tn % Row Count 9 (+ 1) % Row 5 \SetRowColor{white} & & B has the initializing data for A (B is an Expert with respect to creating A) \tn % Row Count 14 (+ 5) % Row 6 \SetRowColor{LightBackground} & If \textgreater{}1 option, prefer aggregation & \tn % Row Count 16 (+ 2) % Row 7 \SetRowColor{white} \mymulticolumn{3}{x{5.377cm}}{1. Creator -\textgreater{} Low coupling:} \tn % Row Count 17 (+ 1) % Row 8 \SetRowColor{LightBackground} & Guideline 1 & A composite object is an excellent candidate to make its parts \tn % Row Count 21 (+ 4) % Row 9 \SetRowColor{white} & Guideline 2 & Look at the class that has the initializing data \tn % Row Count 24 (+ 3) % Row 10 \SetRowColor{LightBackground} & & E.g., a Payment instance must be initialized with the Sale total. Hence, Sale is a candidate creator of Payment \tn % Row Count 31 (+ 7) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{p{0.73232 cm} x{1.92234 cm} x{1.92234 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{GRASP: {[}spell out{]} (cont)}} \tn % Row 11 \SetRowColor{LightBackground} & Guideline 3 & In case of complex rules consider delegation of creation to a helper class \tn % Row Count 5 (+ 5) % Row 12 \SetRowColor{white} \mymulticolumn{3}{x{5.377cm}}{2. Information Expert -\textgreater{} Low coupling, high cohesion, reduce feature envy} \tn % Row Count 7 (+ 2) % Row 13 \SetRowColor{LightBackground} & Assign a responsibility to the class that has the information necessary to fulfill the responsibility & \tn % Row Count 14 (+ 7) % Row 14 \SetRowColor{white} & Many "partial" information experts may collaborate in a task & \tn % Row Count 18 (+ 4) % Row 15 \SetRowColor{LightBackground} 3. Low \seqsplit{Coupling} & Assign \seqsplit{responsibilities} so that coupling remains as low as possible. & \tn % Row Count 23 (+ 5) % Row 16 \SetRowColor{white} & High to low: & \tn % Row Count 24 (+ 1) % Row 17 \SetRowColor{LightBackground} & & ***Content coupling: one class modifies another (branch into middle of routine, modifies code) \tn % Row Count 31 (+ 7) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{p{0.73232 cm} x{1.92234 cm} x{1.92234 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{GRASP: {[}spell out{]} (cont)}} \tn % Row 18 \SetRowColor{LightBackground} & & **Common coupling: share common (global) data \tn % Row Count 3 (+ 3) % Row 19 \SetRowColor{white} & & **Control coupling: use a method parameter (by passing some kind of flag) to control a different method \tn % Row Count 10 (+ 7) % Row 20 \SetRowColor{LightBackground} & & Stamp/Data coupling: passing complex data or structures between modules(\& use primitives when possible) \tn % Row Count 17 (+ 7) % Row 21 \SetRowColor{white} & & Uncoupled: no relationship \tn % Row Count 19 (+ 2) % Row 22 \SetRowColor{LightBackground} & & *** DO NOT DO THIS!!! \tn % Row Count 21 (+ 2) % Row 23 \SetRowColor{white} & & ** TRY HARD NOT TO DO THIS! \tn % Row Count 23 (+ 2) % Row 24 \SetRowColor{LightBackground} & Common forms of coupling: & \tn % Row Count 25 (+ 2) % Row 25 \SetRowColor{white} & & TypeX has an attribute that refers to TypeY \tn % Row Count 28 (+ 3) % Row 26 \SetRowColor{LightBackground} & & TypeX calls on services of TypeY \tn % Row Count 30 (+ 2) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{p{0.73232 cm} x{1.92234 cm} x{1.92234 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{GRASP: {[}spell out{]} (cont)}} \tn % Row 27 \SetRowColor{LightBackground} & & TypeX has a method that refers to TypeY \tn % Row Count 3 (+ 3) % Row 28 \SetRowColor{white} & & TypeX is a subclass of TypeY \tn % Row Count 5 (+ 2) % Row 29 \SetRowColor{LightBackground} & & TypeY is an interface and TypeX implements it \tn % Row Count 8 (+ 3) % Row 30 \SetRowColor{white} \mymulticolumn{3}{x{5.377cm}}{4. Controller} \tn % Row Count 9 (+ 1) % Row 31 \SetRowColor{LightBackground} & UI objects should not have responsibility for fulfilling system events & \tn % Row Count 14 (+ 5) % Row 32 \SetRowColor{white} & Delegates work to other objects \& coordinate / control the activity & \tn % Row Count 19 (+ 5) % Row 33 \SetRowColor{LightBackground} & Assign responsibility to a class that: & \tn % Row Count 22 (+ 3) % Row 34 \SetRowColor{white} & & Represents the overall System ( Façade Controller ) \tn % Row Count 26 (+ 4) % Row 35 \SetRowColor{LightBackground} & & Represents a Use Case scenario where the event occurs (\textless{}usecase name\textgreater{}Handler, \textless{}ucn\textgreater{}Coordinator, \textless{}ucn\textgreater{}Session) \tn % Row Count 33 (+ 7) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{p{0.73232 cm} x{1.92234 cm} x{1.92234 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{GRASP: {[}spell out{]} (cont)}} \tn % Row 36 \SetRowColor{LightBackground} \mymulticolumn{3}{x{5.377cm}}{5. High Cohesion: Objects should not do many unrelated things} \tn % Row Count 2 (+ 2) % Row 37 \SetRowColor{white} & High to low & \tn % Row Count 3 (+ 1) % Row 38 \SetRowColor{LightBackground} & & \seqsplit{***Coincidental:} unrelated functions \tn % Row Count 6 (+ 3) % Row 39 \SetRowColor{white} & & Logical: multiple logic sections \tn % Row Count 8 (+ 2) % Row 40 \SetRowColor{LightBackground} & & Temporal: related by phases of an operation \tn % Row Count 11 (+ 3) % Row 41 \SetRowColor{white} & & Procedural: required ordering of tasks (addIngredients, mix, bake) \tn % Row Count 16 (+ 5) % Row 42 \SetRowColor{LightBackground} & & \seqsplit{Communicational:} operates on same data set \tn % Row Count 19 (+ 3) % Row 43 \SetRowColor{white} & & Functional: all essential elements for a single function are in same module (takeOff, fly, land) \tn % Row Count 25 (+ 6) % Row 44 \SetRowColor{LightBackground} & & *** DO NOT DO THIS UNLESS UNAVOIDABLE!! \tn % Row Count 28 (+ 3) % Row 45 \SetRowColor{white} \mymulticolumn{3}{x{5.377cm}}{Refactoring:} \tn % Row Count 29 (+ 1) % Row 46 \SetRowColor{LightBackground} & Goal: Keep program readable, understandable, and maintainable & \tn % Row Count 33 (+ 4) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{p{0.73232 cm} x{1.92234 cm} x{1.92234 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{GRASP: {[}spell out{]} (cont)}} \tn % Row 47 \SetRowColor{LightBackground} & Preserve behavior by using tests & Ex: rename, extract method, move method, replace temp w query \tn % Row Count 4 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{p{0.64078 cm} x{2.56312 cm} x{1.3731 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{SOLID: {[}spell out{]}}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{3}{x{5.377cm}}{S: Single Responsibility Principle} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} & Each class should have a single overriding responsibility (High Cohesion) -\textgreater{} many small classes \textgreater{} one big class & \tn % Row Count 7 (+ 6) % Row 2 \SetRowColor{LightBackground} & Each class has one reason why it should change & \tn % Row Count 10 (+ 3) % Row 3 \SetRowColor{white} \mymulticolumn{3}{x{5.377cm}}{O: Open/Closed Principle} \tn % Row Count 11 (+ 1) % Row 4 \SetRowColor{LightBackground} & Objects are open for extension but closed for modification & \tn % Row Count 14 (+ 3) % Row 5 \SetRowColor{white} & Extension via inheritance, polymorphism & \tn % Row Count 16 (+ 2) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{3}{x{5.377cm}}{L: Liskov Substitution Principle} \tn % Row Count 17 (+ 1) % Row 7 \SetRowColor{white} & Subclasses should be substitutable for their base classes & \tn % Row Count 20 (+ 3) % Row 8 \SetRowColor{LightBackground} & class that implements an interface must be able to substitute any reference throughout the code that implements the same interface & \tn % Row Count 26 (+ 6) % Row 9 \SetRowColor{white} \mymulticolumn{3}{x{5.377cm}}{I: Interface Segregation Principle} \tn % Row Count 27 (+ 1) % Row 10 \SetRowColor{LightBackground} & Use several small interfaces vs one larger multipurpose one & \tn % Row Count 30 (+ 3) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{p{0.64078 cm} x{2.56312 cm} x{1.3731 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{SOLID: {[}spell out{]} (cont)}} \tn % Row 11 \SetRowColor{LightBackground} & Don't make clients depend on interfaces they don't use (Athlete -\textgreater{} SwimmingAthlete, JumpingAthlete) & \tn % Row Count 5 (+ 5) % Row 12 \SetRowColor{white} \mymulticolumn{3}{x{5.377cm}}{D: Dependency Inversion Principle} \tn % Row Count 6 (+ 1) % Row 13 \SetRowColor{LightBackground} & High-level modules should not depend on low-level modules. Both should depend on abstractions. & \tn % Row Count 11 (+ 5) % Row 14 \SetRowColor{white} & Abstractions should not depend on details. Details should depend on abstractions (writeJava; writeJavaScript -\textgreater{} develop() calls writeJava, writeJavaScript) & \tn % Row Count 19 (+ 8) % Row 15 \SetRowColor{LightBackground} ISP vs LSP & ISP: parent \textless{}-\textgreater{} client & LSP: parent \textless{}-\textgreater{} child \tn % Row Count 21 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}