\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{Jianmin Feng (taotao)} \pdfinfo{ /Title (java-program-design-and-analysis.pdf) /Creator (Cheatography) /Author (Jianmin Feng (taotao)) /Subject (Java Program design and analysis 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{Java Program design and analysis Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{Jianmin Feng (taotao)} via \textcolor{DarkBackground}{\uline{cheatography.com/79308/cs/19311/}}} \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}Jianmin Feng (taotao) \\ \uline{cheatography.com/taotao} \\ \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 17th May, 2019.\\ 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*}{2} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Programmer or engineer}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{engineer = analytic mindset, oversee the whole software development cycle} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{programmer = implement and debug} \tn % Row Count 3 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.72 cm} x{5.28 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Water fall model}} \tn % Row 0 \SetRowColor{LightBackground} program \seqsplit{specification} & project description/requirements \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} program design & plan to solve the problems listed, no code at all, language independent \tn % Row Count 5 (+ 3) % Row 2 \SetRowColor{LightBackground} \seqsplit{implementation} & coding in java \tn % Row Count 7 (+ 2) % Row 3 \SetRowColor{white} testing and debug & testing case(end point, in range, out of range, special value/invalid) \tn % Row Count 10 (+ 3) % Row 4 \SetRowColor{LightBackground} & compiler(java checked Exception)/runtime(java unchecked,error)/business logic errors(in corrected results) \tn % Row Count 15 (+ 5) % Row 5 \SetRowColor{white} & robustness:deal bad input ( input correct -\textgreater{}correct answer, invalid input -\textgreater{}no crash/error/exception \tn % Row Count 19 (+ 4) % Row 6 \SetRowColor{LightBackground} maintenance & upgrade, new features,document for new comers \tn % Row Count 21 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{infinite loop is a run time error because it will eventually eat up all memory. \newline divided by zero for int(runtime exception) and float (infinite, when output is known) \newline platform dependency and efficiency not belong to robustness.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{object oriented program design}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{identify classes -{}- noun} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{identify behavior -{}-verb} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{find relation between classes} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{write API for each class ( pubic method header)} \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{implement methods} \tn % Row Count 5 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{identify classes}} \tn % Row 0 \SetRowColor{LightBackground} lower level component & Connect4 board, game rule \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} collection of lower level components & players \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} control class & controller ( setup player and board) \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} GUI & Display \tn % Row Count 7 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{5.28 cm} x{2.72 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{identify behavior}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{all verbs} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} match behavior with class carefully and logically & This could be in test \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{encapsulation, only expose what necessary} \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{2}{x{8.4cm}}{find suitable data structure( fields, properties)} \tn % Row Count 5 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{implementing methods}} \tn % Row 0 \SetRowColor{LightBackground} procedural \seqsplit{abstraction/stepwise} refinment & helper methods (repeated code, smaller method body,easy read) \tn % Row Count 4 (+ 4) % Row 1 \SetRowColor{white} information hiding & instance variable and helper method to be private \tn % Row Count 7 (+ 3) % Row 2 \SetRowColor{LightBackground} stub method & for test, input and return correctly \tn % Row Count 9 (+ 2) % Row 3 \SetRowColor{white} algorithm & step by step procedure to solve problem. understand the algorithm before coding \tn % Row Count 13 (+ 4) % Row 4 \SetRowColor{LightBackground} & logically correctness,CPU time, memory needed,easier to maintain/understand \tn % Row Count 17 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.76 cm} x{4.24 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{determine relationships between classes}} \tn % Row 0 \SetRowColor{LightBackground} inheritance & is-a \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} composition & has-a \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{UML Model} \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} rectangular & \textless{}\textless{}abstract\textgreater{}\textgreater{}\textless{}\textless{}interface\textgreater{}\textgreater{} \tn % Row Count 5 (+ 2) % Row 4 \SetRowColor{LightBackground} up arrow & is a \tn % Row Count 6 (+ 1) % Row 5 \SetRowColor{white} up arrow + dotted line & interface is a \tn % Row Count 8 (+ 2) % Row 6 \SetRowColor{LightBackground} down arrow & has a \tn % Row Count 9 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{use is-a and has-a to test if class design is ok or not.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{1.44 cm} x{6.56 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{implementing classes}} \tn % Row 0 \SetRowColor{LightBackground} bottom up & independent class -{}-\textgreater{}lower lever first -{}-\textgreater{}major components \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} top down & main class -\textgreater{}step wise refinement and add detail classes \tn % Row Count 4 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{design is usually top down, implementation usu bottom up is easier.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{1.6 cm} x{6.4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{program analysis}} \tn % Row 0 \SetRowColor{LightBackground} \seqsplit{assertion} & precondition( what's is true before a method,loop, block run - input), post condition (the status after the run - output) \tn % Row Count 4 (+ 4) % Row 1 \SetRowColor{white} \seqsplit{efficiency} & cpu time, memory \tn % Row Count 6 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{best case; worst case;average case} \tn % Row Count 7 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{column break}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{} \tn % Row Count 0 (+ 0) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.04 cm} x{4.96 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Vocabulary summary}} \tn % Row 0 \SetRowColor{LightBackground} software development & writing a program \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \seqsplit{object-oriented} program & uses interacting object \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} program specification & description of a task \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} program implementation & the code \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} test data & input to test a program \tn % Row Count 9 (+ 1) % Row 5 \SetRowColor{white} program maintenance & keep program working and up to date \tn % Row Count 11 (+ 2) % Row 6 \SetRowColor{LightBackground} top down development & implement main class first, subsidiary classes later \tn % Row Count 14 (+ 3) % Row 7 \SetRowColor{white} bottom up development & implement lowest level classes, independent class first \tn % Row Count 17 (+ 3) % Row 8 \SetRowColor{LightBackground} driver class & used to test other class, contains main() \tn % Row Count 19 (+ 2) % Row 9 \SetRowColor{white} inheritance relationship & is a relationship between classes \tn % Row Count 21 (+ 2) % Row 10 \SetRowColor{LightBackground} composition relationship & has a relationship between classes \tn % Row Count 23 (+ 2) % Row 11 \SetRowColor{white} inheritance hirarchy & inheritance relationship shown in a tree like structure \tn % Row Count 26 (+ 3) % Row 12 \SetRowColor{LightBackground} UML diagram & tree like representation of relations between classes \tn % Row Count 29 (+ 3) % Row 13 \SetRowColor{white} data structure & java construt for storing data \tn % Row Count 31 (+ 2) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{3.04 cm} x{4.96 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Vocabulary summary (cont)}} \tn % Row 14 \SetRowColor{LightBackground} encapsulation & combining data field and method in a class \tn % Row Count 2 (+ 2) % Row 15 \SetRowColor{white} information hiding & use private to restrict access \tn % Row Count 4 (+ 2) % Row 16 \SetRowColor{LightBackground} step wise refinement & breaking methods into smaller methods \tn % Row Count 6 (+ 2) % Row 17 \SetRowColor{white} procedural abstraction & use helper method \tn % Row Count 8 (+ 2) % Row 18 \SetRowColor{LightBackground} algorithm & step by step process to solve a problem \tn % Row Count 10 (+ 2) % Row 19 \SetRowColor{white} stub method & dummy method called by another method being tested \tn % Row Count 13 (+ 3) % Row 20 \SetRowColor{LightBackground} debugging & fixing errors \tn % Row Count 14 (+ 1) % Row 21 \SetRowColor{white} robust program & screens out bad input \tn % Row Count 15 (+ 1) % Row 22 \SetRowColor{LightBackground} compile time error & usu a xyntax error; prevent from compiling \tn % Row Count 17 (+ 2) % Row 23 \SetRowColor{white} syntax error & bad language usage \tn % Row Count 18 (+ 1) % Row 24 \SetRowColor{LightBackground} runtime error & occurs during eecution \tn % Row Count 19 (+ 1) % Row 25 \SetRowColor{white} exception & run time error thrown by java method \tn % Row Count 21 (+ 2) % Row 26 \SetRowColor{LightBackground} logic error & program runs but does the wrong things \tn % Row Count 23 (+ 2) % Row 27 \SetRowColor{white} independent class & donot use other classes of the program in its code \tn % Row Count 26 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}