\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{frenological} \pdfinfo{ /Title (basic-computer-programming.pdf) /Creator (Cheatography) /Author (frenological) /Subject (Basic Computer Programming 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}{1A5B92} \definecolor{LightBackground}{HTML}{F0F4F8} \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{Basic Computer Programming Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{frenological} via \textcolor{DarkBackground}{\uline{cheatography.com/150441/cs/32610/}}} \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}frenological \\ \uline{cheatography.com/frenological} \\ \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 June, 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*}{2} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{{\bf{COMPUTER PROGRAMMING LANGUAGES}}}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{A Programming Language is software that helps you write instructions for your computer. There are several different programming languages, each with their own pros and cons; it depends on what you want to create and the {\bf{Level of Abstraction}}.% Row Count 5 (+ 5) } \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}{{\bf{HIERARCHY OF PROGRAMMING LANGUAGES}}}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{LANGUAGE LEVEL}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{High-Level Language} \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{} \tn % Row Count 2 (+ 0) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Assembly Language} \tn % Row Count 3 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{} \tn % Row Count 3 (+ 0) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Machine Language} \tn % Row Count 4 (+ 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}{{\bf{COMPUTERS AND COMPUTATIONAL THINKING}}}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{COMPUTATIONAL THINKING}} & {\bf{DEFINING COMPUTERS}} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \{\{fa-sitemap\}\} Decomposition: breaking down a large problem into manageable bits for the computer to execute & \{\{fa-database\}\} Data: we glean meaning from data \tn % Row Count 8 (+ 6) % Row 2 \SetRowColor{LightBackground} \{\{fa-gg\}\} Recognizing Patterns: insight into solutions and giving context for solving new problems; understanding that the symbols may change, but not the pattern & \{\{fa-barcode\}\} Process: what we have the computer do when we engage with it \tn % Row Count 17 (+ 9) % Row 3 \SetRowColor{white} \{\{fa-sort-amount-desc\}\} Abstraction: engaging with information at a lower, more general level where not everything must be understood in order for it to work (see {\emph{Abstraction of Code}}) & \{\{fa-sign-out\}\} Output: what the computer figures out and, sometimes, shows us \tn % Row Count 27 (+ 10) % Row 4 \SetRowColor{LightBackground} \{\{fa-sort-numeric-asc\}\} Designing Algorithms: creating a plan of action or list of instructions that a computer can follow and execute & \{\{fa-archive\}\} Storage: a place dedicated to the output either immediately upon completion, or later after conditions are met \tn % Row Count 34 (+ 7) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.888 cm} x{1.9 cm} x{2.812 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{{\bf{ABSTRACTION OF CODE IMPLEMENTATION}}}} \tn % Row 0 \SetRowColor{LightBackground} \{\{fa-arrow-circle-left\}\}{\bf{LESS ABSTRACT}} & & \{\{ar\}\}{\bf{MORE ABSTRACT}}\{\{fa-arrow-circle-right\}\} \tn % Row Count 4 (+ 4) % Row 1 \SetRowColor{white} {\bf{Programming Language}} & {\bf{Pseudocode Language}} & {\bf{Natural Language}} \tn % Row Count 7 (+ 3) % Row 2 \SetRowColor{LightBackground} actual programming language & practice computing language & human language; discussing how to program \tn % Row Count 10 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.92 cm} x{4.08 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{{\bf{VARIABLES}}}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{\{\{colspan=2\}\}{\bf{DEFINITION}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{2}{x{8.4cm}}{\{\{colspan=2\}\} can be thought of as a name that refers to a value inside of a program} \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{\{\{colspan=2\}\}{\bf{NAMING CONVENTIONS}}} \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} \{\{fa-thumbs-up\}\}CAN: & \{\{fa-thumbs-down\}\}CANNOT: \tn % Row Count 6 (+ 2) % Row 4 \SetRowColor{LightBackground} \{\{fa-circle\}\} start with or contain A-Z & \{\{fa-circle\}\} start with 0-9 \tn % Row Count 9 (+ 3) % Row 5 \SetRowColor{white} \{\{fa-circle\}\} start with or contain a-z & \{\{fa-circle\}\} contain any symbol other than "\_" \tn % Row Count 12 (+ 3) % Row 6 \SetRowColor{LightBackground} \{\{fa-circle\}\} contain 0-9 & \{\{fa-circle\}\} contain a reserved word \tn % Row Count 14 (+ 2) % Row 7 \SetRowColor{white} \{\{fa-circle\}\} contain "\_" & \{\{fa-circle\}\} contain spaces \tn % Row Count 16 (+ 2) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{\{\{colspan=2\}\}{\bf{DECLARING VARIABLES}}} \tn % Row Count 17 (+ 1) % Row 9 \SetRowColor{white} \mymulticolumn{2}{x{8.4cm}}{\{\{colspan=2\}\} declaring a variable lets the program know what process it can perform on the stored input or value} \tn % Row Count 20 (+ 3) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{\{\{colspan=2\}\} {\bf{INITIALIZING VARIABLES}}} \tn % Row Count 21 (+ 1) % Row 11 \SetRowColor{white} \mymulticolumn{2}{x{8.4cm}}{\{\{colspan=2\}\} the process of assigning a value to the variable once it is declared} \tn % Row Count 23 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.356 cm} x{2.66 cm} x{2.584 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{{\bf{THREE LANGUAGE CASES}}}} \tn % Row 0 \SetRowColor{LightBackground} camelCase & snake\_case & PascalCase \tn % Row Count 1 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{1.8 cm} x{1.8 cm} x{1.8 cm} x{1.8 cm} } \SetRowColor{DarkBackground} \mymulticolumn{4}{x{8.4cm}}{\bf\textcolor{white}{{\bf{VARIABLE STRUCTURES}}}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{4}{x{8.4cm}}{\{\{colspan=4\}\}\{\{ac\}\}"65 is assigned to the variable score!"} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \{\{border=1\}\}\{\{ac\}\}int & \{\{border=1\}\}\{\{ac\}\}score & \{\{border=1\}\}\{\{ac\}\}\textless{}-{}- & \{\{border=1\}\}\{\{ac\}\}65 \tn % Row Count 5 (+ 3) % Row 2 \SetRowColor{LightBackground} \{\{ac\}\}\{\{fa-arrow-circle-up\}\} & \{\{ac\}\}\{\{fa-arrow-circle-up\}\} & \{\{ac\}\}\{\{fa-arrow-circle-up\}\} & \{\{ac\}\}\{\{fa-arrow-circle-up\}\} \tn % Row Count 8 (+ 3) % Row 3 \SetRowColor{white} \{\{ac\}\}variable type & \{\{ac\}\}variable name & \{\{ac\}\}assignment operator & \{\{ac\}\}value \tn % Row Count 11 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}----} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4.32 cm} x{3.68 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{{\bf{TWO TYPES OF CODE}}}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{COMPILATION CODE}} & {\bf{INTERPRETATION CODE}} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} {\emph{Compiler}} & {\emph{Interpreter}} \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} {\emph{Compiled}} & {\emph{Interpreted}} \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} changes code to machine readable code all at once & changes code one command at a time \tn % Row Count 7 (+ 3) % Row 4 \SetRowColor{LightBackground} PRO: Faster & PRO: Easier to change and correct \tn % Row Count 9 (+ 2) % Row 5 \SetRowColor{white} CON: Harder to find errors and fix & CON: Slower \tn % Row Count 11 (+ 2) % Row 6 \SetRowColor{LightBackground} EXAMPLE: C++ & EXAMPLE: Python \tn % Row Count 12 (+ 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}{{\bf{PROGRAMMING VOCABULARY}}}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{What is {\bf{SYNTAX}}?} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}How you organize your program and what language you use to create it} \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{What are {\bf{KEY}} or {\bf{RESERVED WORDS}}?} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Special jargon unique to each language that have specific, unalterable purposes} \tn % Row Count 6 (+ 3) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{What is {\bf{DOCUMENTATION}}?} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Text and information that comes with a program but does not affect the running of the program} \tn % Row Count 9 (+ 3) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{What is {\bf{SCOPE}}?} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}How a program is organized and "controlled;" each language manages and controls scope differently; this may include brackets, white space, or indentation; scope can also refer to specific block of code like a loop} \tn % Row Count 15 (+ 6) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{What is {\bf{TESTING}} or {\bf{UNIT TESTING}}?} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}When you make sure your code (program, software) is behaving as intended; using test cases helps determine if each iteration will work and won't work} \tn % Row Count 20 (+ 5) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{What is {\bf{EDGE CASING}}?} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Using the "edges" of the test, like going one above, one below, or a combination} \tn % Row Count 23 (+ 3) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{What is {\bf{DEBUGGING}}?} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}A BUG is an undesireable behavior in a program, so debugging is of identifying and correcting the errors {\emph{See Error Types}}} \tn % Row Count 27 (+ 4) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{What are {\bf{COMMENTS}}?} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Notes within a code or program that do not affect the execution but may be helpful to the programmer} \tn % Row Count 31 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.888 cm} x{2.812 cm} x{1.9 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{8.4cm}}{\bf\textcolor{white}{{\bf{DATA TYPES}}}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{TEXT}} & {\bf{NUMERIC}} & {\bf{BOOLEAN}} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} {\emph{Character}} & {\emph{Integer}} & {\emph{True/False}} \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} a single letter, number, or symbol & integers are always whole numbers & {\emph{Boolean Variable Examples}} \tn % Row Count 7 (+ 3) % Row 3 \SetRowColor{white} set off by '\_' & positive, negative, or zero & boolean check\textless{}-{}-false \tn % Row Count 10 (+ 3) % Row 4 \SetRowColor{LightBackground} Examples:'a', '5', '!' & {\emph{Floating Point Data}} & boolean check \textless{}-{}-true \tn % Row Count 13 (+ 3) % Row 5 \SetRowColor{white} {\emph{String}} & a floating decimal value which contains NO fractions & \tn % Row Count 17 (+ 4) % Row 6 \SetRowColor{LightBackground} a combination of characters (number or letter) strung together & {\emph{Reserved Words for Numeric Data}} & \tn % Row Count 22 (+ 5) % Row 7 \SetRowColor{white} set of by "\_" & short (16 bits) & \tn % Row Count 24 (+ 2) % Row 8 \SetRowColor{LightBackground} Examples: "181240", "Hello!" & int (32 bits) & \tn % Row Count 26 (+ 2) % Row 9 \SetRowColor{white} & long (64 bits) & \tn % Row Count 27 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}---} \SetRowColor{LightBackground} \mymulticolumn{3}{x{8.4cm}}{{\emph{data and data format could change depending on the language being used}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{p{0.8 cm} p{0.8 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{{\bf{ERROR TYPES}}}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{} \tn % Row Count 0 (+ 0) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}