\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{\_allisonwalker} \pdfinfo{ /Title (3500-final.pdf) /Creator (Cheatography) /Author (\_allisonwalker) /Subject (3500 Final 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}{7B739E} \definecolor{LightBackground}{HTML}{F6F6F8} \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{3500 Final Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{\_allisonwalker} via \textcolor{DarkBackground}{\uline{cheatography.com/181463/cs/38497/}}} \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}\_allisonwalker \\ \uline{cheatography.com/allisonwalker} \\ \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 3rd May, 2023.\\ 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}{Purpose of CS 3500}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{CS 3500 is primarily about learning to:}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Solve complex problems with software \{\{nl\}\}Afterall, software rules the world\{\{nl\}\} And that, that software should \{\{nl\}\}Contains fewer defects\{\{nl\}\} Be more maintainable} \tn % Row Count 5 (+ 5) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Components software systems will need}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Databases\{\{nl\}\} Networking (e.g., client/server architecture)\{\{nl\}\} Multi-threading \{\{nl\}\}GUI \{\{nl\}\}Logging} \tn % Row Count 9 (+ 4) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{IDE}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}IDE support - Visual Studio\{\{nl\}\} Debug tools \{\{nl\}\}Optimization tools\{\{nl\}\} Database interface tools \{\{nl\}\}Multi-Architecture Deployment (e.g., MAUI)\{\{nl\}\} Intellisense\{\{nl\}\} Copilot?, GPT?\{\{nl\}\} XML documentation} \tn % Row Count 15 (+ 6) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Pair Programming}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}What is it? \{\{nl\}\}Why should it be effective?\{\{nl\}\} What can prevent it from being effective?} \tn % Row Count 18 (+ 3) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Dealing with Imperfections}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Ask questions\{\{nl\}\} Iterate, (Iterate, Iterate, Iterate) \{\{nl\}\}See assignment recommendations on "tutorial steps" \{\{nl\}\}Make assumptions, \{\{nl\}\} Document the assumptions \{\{nl\}\}Try not to make the assumptions too broad (or assume it is "hard") \{\{nl\}\}Think Abstraction!\{\{nl\}\} Ask about the assumptions!} \tn % Row Count 26 (+ 8) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{How to you use your time effectively?}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Read all documentation \{\{nl\}\}Assignment Specifications \{\{nl\}\}Microsoft Developer Documentation\{\{nl\}\} etc.\{\{nl\}\} Understand protocols and APIs \{\{nl\}\}Networking object \{\{nl\}\}Agario "Commands" \{\{nl\}\}Develop toy programs to help you understand} \tn % Row Count 33 (+ 7) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Networking}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Networking}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Sockets and Ports \{\{nl\}\}Event based\{\{nl\}\} Await and asynchronous elements \{\{nl\}\}TCP assurances \{\{nl\}\}Client/Server Architecture \{\{nl\}\}Protocols\{\{nl\}\} Allow libraries/abstractions to "do the work" for you} \tn % Row Count 6 (+ 6) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{ARPA NET}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Dec 1969\{\{nl\}\}4 nodes in utah} \tn % Row Count 8 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Client-Server Architecture}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Client wants to do some "work"/"play"\{\{nl\}\} Server controls functionality\{\{nl\}\} Client usually shows the GUI \{\{nl\}\}Server usually manages the Model/Data} \tn % Row Count 13 (+ 5) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{DNS}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}DOMAIN NAME SYSTEM\{\{nl\}\}DNS 🡪 Domain Name System Provides "IP Address"} \tn % Row Count 16 (+ 3) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{IP Address: Unique Identifier}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}IP Address – a unique identifier for a computer: e.g., \{\{nl\}\}100.200.50.1 \{\{nl\}\}Roughly 4 levels of subdomains* (examples below just of intuition) \{\{nl\}\}255.255.255.255\{\{nl\}\} \seqsplit{category.identifier.subnet}.machine\{\{nl\}\} Category → high level grouping like .com, or .edu \{\{nl\}\}Identifier -\textgreater{} division within the category (like utah or usu/google or amazon) \{\{nl\}\}Subnet -\textgreater{} cs or ece or me\{\{nl\}\} Machine -\textgreater{} my machine or your machine …} \tn % Row Count 27 (+ 11) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{PORTS}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}"MAIL BOXES" ASSOCIATED WITH SPECIFIC PROGRAMS\{\{nl\}\}} \tn % Row Count 30 (+ 3) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Networking (cont)}} \tn % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Client ⬄ Server Communications}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Needs: \{\{nl\}\}The address of the server machine \{\{nl\}\}Initial port to talk to\{\{nl\}\} A unique port for future communication \{\{nl\}\}The Protocol(s)!} \tn % Row Count 5 (+ 5) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Initial Port vs. Continuing Port}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}For Query/Response programs (e.g., a web server):\{\{nl\}\} the server will use a specific low port that is "known" so anyone can make an initial connection \{\{nl\}\}i.e., 80 \{\{nl\}\}Ongoing connections will be moved to a different (high) port number \{\{nl\}\}So that new clients can talk to server at the same time} \tn % Row Count 13 (+ 8) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Ports - 1}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}"Mailbox Numbers" for the computer \{\{nl\}\}Unique to for each program \{\{nl\}\}If you try to "open" a port that is already in use you will get an error Note: this could happen if you try to run/debug two versions of the same program at the same time \{\{nl\}\}Numbers Range: 0 - 64k} \tn % Row Count 20 (+ 7) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Ports -2}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Who decides number?\{\{nl\}\} Some programs have official ports \{\{nl\}\}Other programs have "taken" over ports\{\{nl\}\} Some ports screened/blocked by firewalls! \{\{nl\}\}Especially low ports under 1000} \tn % Row Count 26 (+ 6) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{SOCKETS}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}OPENING CONNECTIONS BETWEEN CLIENTS AND SERVER} \tn % Row Count 28 (+ 2) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Socket 🡪 Unique Channel between Sender and Receiver}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Client asks the Server for connection. \{\{nl\}\} A Socket is defined!} \tn % Row Count 32 (+ 4) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Networking (cont)}} \tn % Row 12 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Socket}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}An identifier representing a particular point to point communication connection between two pieces of software \{\{nl\}\}My IP ADDRESS \{\{nl\}\}Their IP ADDRESS\{\{nl\}\} My Port Number \{\{nl\}\}Their Port Number \{\{nl\}\} Combined into a single unique communication channel} \tn % Row Count 7 (+ 7) % Row 13 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Protocols}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Agreed order and format of data for communication} \tn % Row Count 10 (+ 3) % Row 14 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{IP – Internet Protocol}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Responsible for sending packets of information from host to host \{\{nl\}\} Hand-wave Hand-wave Hand-wave (or Abstraction/Separation of concerns) \{\{nl\}\}The internet and C\#'s usage of it just works!} \tn % Row Count 16 (+ 6) % Row 15 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{TCP – Transmission Control Protocol}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Runs on top of IP (Internet Protocol) \{\{nl\}\}One to One Reliable Communication\{\{nl\}\} Data will arrive\{\{nl\}\} Verified Ordering \{\{nl\}\}Verified Uncorrupted \{\{nl\}\} Does not verify when data arrives or how much arrives at a given time!\{\{nl\}\} C\# libraries do all the work for you} \tn % Row Count 23 (+ 7) % Row 16 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{UDP – User Datagram Protocol}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Alternative to TCP \{\{nl\}\}No Handshaking – no persistent connection \{\{nl\}\}No guarantee of \{\{nl\}\}Delivery Ordering \{\{nl\}\}Duplication Protection \{\{nl\}\}Why would we use this?\{\{nl\}\} Faster -less overhead} \tn % Row Count 29 (+ 6) % Row 17 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Basic Network Communication Facts:}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Happen at the BYTE level!!!! \{\{nl\}\}Your program must\{\{nl\}\} Translate useful data into bytes and \{\{nl\}\} Translate bytes into useful data (e.g., strings, objects, etc) \{\{nl\}\}TCP does not guarantee \{\{nl\}\}When Information Goes Out \{\{nl\}\}When Information Arrives\{\{nl\}\} How much information is sent at any one time… \{\{nl\}\} TCP does guarantee \{\{nl\}\}order and validity} \tn % Row Count 38 (+ 9) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Networking (cont)}} \tn % Row 18 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Stacking Protocols}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Web browsing looks something like this\{\{nl\}\} HTTP \{\{nl\}\} TCP \{\{nl\}\} IP} \tn % Row Count 3 (+ 3) % Row 19 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{WHAT THE SERVER'S CONNECTION THREAD DOES}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}A SERVER DOES TWO THINGS:\{\{nl\}\} "NETWORK STUFF" (E.G., HANDLE MULTIPLE CLIENT REQUESTS AND CONNECTIONS)\{\{nl\}\} "APPLICATION STUFF" (E.G., MANAGES A GAME)} \tn % Row Count 8 (+ 5) % Row 20 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{TCP handling in C\#}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}A TCPListener object is at the heart of the server. \{\{nl\}\}Listens on a specific port for incoming connection requests. \{\{nl\}\}TcpListener\{\{nl\}\} BeginAcceptSocket – Wait for request to arrive \{\{nl\}\}EndAcceptSocket - Obtains the Socket.} \tn % Row Count 15 (+ 7) % Row 21 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Server Main Thread Connection Listening Code (Do you see the "Loop"?)}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}What I call an Event Loop\{\{nl\}\}Server Process\{\{nl\}\}Thread 1 : // Purpose 🡪 Await Connection \{\{nl\}\}Start up code: \{\{nl\}\}Build TCP listener \{\{nl\}\}Wait for Connection( event\_handler )\{\{nl\}\} Function event\_handler() \{\{nl\}\} Build new socket identifying client \{\{nl\}\} Build new Thread to handle client \{\{nl\}\}Wait for Connection( event\_handler )} \tn % Row Count 25 (+ 10) % Row 22 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Key Issues}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}How do you convert from an "object type" to an "actual" Type? \{\{nl\}\}Why is IAsyncResult.AsyncState not typed…. \{\{nl\}\}What is meant by an Event (Receive Event) loop?} \tn % Row Count 30 (+ 5) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Networking (cont)}} \tn % Row 23 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Async}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Async - tells the system that the code may "pause" and "return" later \{\{nl\}\}Allows other threads to execute} \tn % Row Count 4 (+ 4) % Row 24 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Await}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Await - tells the system to "wait" here (pause thread) until an "event" happens} \tn % Row Count 7 (+ 3) % Row 25 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Some Key Async Ideas}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Async methods should do "something" that may take a long time \{\{nl\}\}E.g., DB lookup, network connection, big computation} \tn % Row Count 11 (+ 4) % Row 26 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Some Key Await Ideas}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}await keyword tells program to \{\{nl\}\} "yield" cpu to other tasks while the long running operation completes \{\{nl\}\}Then resume at the given line when task is done \{\{nl\}\}WARNING: may be on a different thread} \tn % Row Count 17 (+ 6) % Row 27 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Server Issues - Multithreading}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Two Threads: \{\{nl\}\}Client Accepting \{\{nl\}\} Message Sending \{\{nl\}\}All Shared Data (e.g., Client array) must be protected \{\{nl\}\}E.g., Removing items from the list \{\{nl\}\} Lock (this.client\_array)\{\{nl\}\} \{ \{\{nl\}\} this.client\_array.Remove(x)\{\{nl\}\} \}} \tn % Row Count 24 (+ 7) % Row 28 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Some Key Networking Issues - Data Arrival}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}You never know how much data will arrive at any given time \{\{nl\}\}Some or all may "Show up" - What does arrive will be in order\{\{nl\}\} Therefore: all data concatenated/stored \{\{nl\}\}Search "all data" for messages \{\{nl\}\}Protocol of "what is a message?" \{\{nl\}\}Newline/Period/etc.} \tn % Row Count 32 (+ 8) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Networking (cont)}} \tn % Row 29 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Key Parts to Networking Object}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Callbacks \{\{nl\}\}This is how the network code communicates state to the "user" program \{\{nl\}\}TcpClient/TcpListener objects\{\{nl\}\} The main object you will be using \{\{nl\}\}See SimpleChat{[}Client/Server{]}TcpClient code \{\{nl\}\}ID\{\{nl\}\} A unique identifier for the connection Settable (default → socket)} \tn % Row Count 8 (+ 8) % Row 30 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Cancellation Tokens}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Long Running (possibly infinite) processes sometimes need to be interrupted. \{\{nl\}\}This functionality is built into the system via: \{\{nl\}\}Cancellation \{\{nl\}\}Exception} \tn % Row Count 13 (+ 5) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Good Software Practices}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Maintainable/Testable Software}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Simple (as possible) \{\{nl\}\}Organized/Architected (e.g., MVC) \{\{nl\}\}SOLID (e.g., Separation of Concerns/Single Responsibility)\{\{nl\}\} DRY \{\{nl\}\}Documented/Commented/Describable\{\{nl\}\} READMEs \{\{nl\}\}Pictures/Figures/UML \{\{nl\}\}Testable} \tn % Row Count 6 (+ 6) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Teamwork}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Working with another developer \{\{nl\}\}Versioning, e.g., git usage \{\{nl\}\}Iterating \{\{nl\}\}Asking questions \& Discussing} \tn % Row Count 10 (+ 4) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Debugging}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Write down four (or more) Debug tools/windows you use (should use) regularly: \{\{nl\}\} Watch Window \{\{nl\}\}Immediate Window \{\{nl\}\}Threads Window\{\{nl\}\} Stack Window \{\{nl\}\}Break Points/Continue/Stepping\{\{nl\}\} Output Window (e.g., for Logger)} \tn % Row Count 17 (+ 7) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Optimizing and Profiling}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Rule 1: Don't optimize until necessary \{\{nl\}\}Rule 2: Optimize algorithm\{\{nl\}\} Rule 3: Optimize the code that is being run the most \{\{nl\}\}Use Profiling to define this code.} \tn % Row Count 22 (+ 5) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Readability}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Readability (understandability) is everything. \{\{nl\}\} Why?\{\{nl\}\} Maintainability \{\{nl\}\}Defect Management\{\{nl\}\} Ease of Testing} \tn % Row Count 26 (+ 4) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Maintainability/Readability}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Proper Naming \{\{nl\}\}variables/methods/classes/namespaces/etc. \{\{nl\}\}Less is better/Smaller is better \{\{nl\}\}Divide and conquer \{\{nl\}\}Don't repeat code! \{\{nl\}\}Delete code instead of add new code \{\{nl\}\}Separate functionality\{\{nl\}\} Code does one thing well (a SOLID principle)} \tn % Row Count 33 (+ 7) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Good Software Practices (cont)}} \tn % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Draw Pictures, Figures, Diagrams}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}What is the purpose?\{\{nl\}\} Document your strategies with \seqsplit{figures/pictures/diagrams}. \{\{nl\}\}UML is a good start} \tn % Row Count 4 (+ 4) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{High Level Commenting}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Document \{\{nl\}\}Describe high level interactions of functions/classes/etc in "header" comments \{\{nl\}\}Describe tricky coding details using inline comments} \tn % Row Count 9 (+ 5) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Versioning}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Why Version?\{\{nl\}\} Find changes \{\{nl\}\} 🡪 find errors, backup code, understand dev history… \{\{nl\}\}When do you version?\{\{nl\}\} Every day and/or after every important change \{\{nl\}\}How do you version \{\{nl\}\}Commit with \_useful\_ messages, then push \{\{nl\}\}Other? \{\{nl\}\}Tags, GitHub, etc.} \tn % Row Count 17 (+ 8) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{MVC}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Model View Controller? \{\{nl\}\}Why separate out these "parts"? \{\{nl\}\}The smaller the code, the "closer" you are to it, the less likely there will be defects} \tn % Row Count 22 (+ 5) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Testing}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Unit Tests should be coded for all projects, but especially the "Model" parts. \{\{nl\}\}Test First \{\{nl\}\}Transparent and Opaque Testing (Open/Close Box)} \tn % Row Count 27 (+ 5) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Common Coding Styles}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Consistent Styles\{\{nl\}\} \seqsplit{I\_Dont\_Care\_If\_You\_Use\_underscores\_But\_DoNotMixWithCamelCase} \{\{nl\}\}Also, keep consistent with capitalization\{\{nl\}\} What tools do we have to assist us?} \tn % Row Count 32 (+ 5) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Good Software Practices (cont)}} \tn % Row 12 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{"Life-Long" Learner}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}You will need to continually be \seqsplit{reading/studying/practicing/improving} your craft. \{\{nl\}\}Often this will require self-motivation and drive on your part. \{\{nl\}\}New Tools/Libraries can often solve old problems. \{\{nl\}\}Warning: don't automatically upgrade every time a new version comes out} \tn % Row Count 8 (+ 8) % Row 13 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Project (Code) Life Cycle - Industry}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Requirement Gathering\{\{nl\}\} Design/Architecting \{\{nl\}\}Implementation \{\{nl\}\}Verification/Testing \{\{nl\}\}Maintenance \{\{nl\}\} Note: Nonlinear, incremental, "circular"} \tn % Row Count 13 (+ 5) % Row 14 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Self Documenting Code}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}"Self-documenting code is ostensibly written using human-readable names, typically consisting of a phrase in a human language which reflects the symbol's meaning…"} \tn % Row Count 18 (+ 5) % Row 15 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Code Analysis}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Apply computer programs to Analyze and Improve computer programming\{\{nl\}\} Code Analysis Tools\{\{nl\}\} Complexity Analysis - e.g., how many lines of code \{\{nl\}\}Duplicate Code Analysis - e.g., could be refactored into methods \{\{nl\}\}Style Guides - e.g., put spaces around parameters\{\{nl\}\} Code Cleanup - e.g., remove unused using statements} \tn % Row Count 27 (+ 9) % Row 16 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Code Analysis Continued}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Code Analysis is run upon compilation \{\{nl\}\}Shown as warnings/messages in Error List} \tn % Row Count 30 (+ 3) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Good Software Practices (cont)}} \tn % Row 17 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Design Patterns}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Well understood and beneficial ways to effectively solve recurring problems\{\{nl\}\}Two Examples:\{\{nl\}\} Iterator\{\{nl\}\} Null Object} \tn % Row Count 4 (+ 4) % Row 18 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Anti-Patterns}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Common ways of solving problems that have unintended side effects\{\{nl\}\}Examples:\{\{nl\}\} hard coded constants\{\{nl\}\}premature optimization} \tn % Row Count 8 (+ 4) % Row 19 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Compiler Optimization in C\#}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}In C\#, we don't have much control \{\{nl\}\}Optimization is done by the runtime (JIT) \{\{nl\}\}And partly by the CIL compiler\{\{nl\}\} This is fine for most purposes\{\{nl\}\} C\# is not the language of choice for (super) high performance…} \tn % Row Count 14 (+ 6) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Databases}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Databases}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Relational - Tables "linked" by related keys \{\{nl\}\}Note: there are non-relational DBs\{\{nl\}\} Two Database Table Design Goals \{\{nl\}\}No repeated data \{\{nl\}\}No empty data \{\{nl\}\}SQL (basic) syntax \{\{nl\}\}SQL tools (e.g., SSMS)\{\{nl\}\} C\# SQL interface} \tn % Row Count 7 (+ 7) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Why Databases?}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}You could craft your own solution to save and retrieve data…\{\{nl\}\} Or you could take advantage of decades of research\{\{nl\}\} Performance\{\{nl\}\} Availability \{\{nl\}\}Stability \{\{nl\}\}Concurrent access \{\{nl\}\}Backups\{\{nl\}\} Interface \{\{nl\}\}Shared/Remote Service \{\{nl\}\}Don't reinvent the wheel} \tn % Row Count 15 (+ 8) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Databases: Two major components}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Database Management System (DBMS) \{\{nl\}\}All the underlying machinery \{\{nl\}\} (e.g., SQL Server 2019) \{\{nl\}\} Query Language\{\{nl\}\} Interface to the machinery} \tn % Row Count 20 (+ 5) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{DBMS Goals (ACID)}}} \tn % Row Count 21 (+ 1) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Atomicity}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Operations succeed completely, or not at all\{\{nl\}\} E.g., if money is transferred from one account to another, the operation could not fail after the money has been removed from the first account and before it has been added to the second.} \tn % Row Count 28 (+ 7) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Consistency}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Operations leave database in consistent state \{\{nl\}\}E.g., cannot assign a "user" into a Roll (table) if the user does not exist} \tn % Row Count 32 (+ 4) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Databases (cont)}} \tn % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Isolation}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Operations don't interfere with each other\{\{nl\}\} E.g., A Multi-threaded Database and a single threaded one act the same} \tn % Row Count 4 (+ 4) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Durability}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Results will not be lost \{\{nl\}\}E.g., if the "building loses power" any committed data will be accurate upon restart. (Data saved to disk.)} \tn % Row Count 9 (+ 5) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Database Tables - RELATIONAL}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Structure of ed data storage \{\{nl\}\} An "entity" like a person is stored as a Row in a Table} \tn % Row Count 13 (+ 4) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{SQL Relationships}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}SQL takes care of managing and EFFICIENTLY traversing/merging relationships!\{\{nl\}\}SELECT Title \{\{nl\}\}FROM Patrons \{\{nl\}\}JOIN CheckedOut ON Patrons.CardNum = CheckedOut.CardNum \{\{nl\}\} JOIN Inventory ON CheckedOut.Serial = Inventory.Serial \{\{nl\}\}JOIN Titles ON Titles.ISBN = Inventory.ISBN \{\{nl\}\}WHERE Patrons.cardNum = 7} \tn % Row Count 22 (+ 9) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Basic DB Design Goals}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Entries should be atoms (not complex)\{\{nl\}\} Don't store lists/arrays in a cell (use multiple rows) \{\{nl\}\}Build compound information by referencing other tables \{\{nl\}\}Enables powerful reasoning about data and relationships, cleaner design \{\{nl\}\}Enable DBMS to optimize} \tn % Row Count 29 (+ 7) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{SQL-Structured Query Language}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Interface for accessing a relational database\{\{nl\}\} Get data \{\{nl\}\}Set data\{\{nl\}\} Change data} \tn % Row Count 32 (+ 3) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Databases (cont)}} \tn % Row 12 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Special Creation Parameters}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Primary Key\{\{nl\}\} Unique (no other row can have this value)\{\{nl\}\} Identity (via properties)\{\{nl\}\} Increment Auto\{\{nl\}\} Count up giving unique value for each new row} \tn % Row Count 5 (+ 5) % Row 13 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{REST – Representational State Transfer}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}For our purposes this means:\{\{nl\}\} The URL tells the server everything it needs to know in order to take an action. \{\{nl\}\}Often this is specified as an API} \tn % Row Count 10 (+ 5) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{C\#}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{C\# programming}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}C\# is one of many choice (albeit a good one)\{\{nl\}\} it could have been C++, or Ruby, or Python, or Java, or Go, or ….\{\{nl\}\} What are elements of the language that support GSPs?\{\{nl\}\} Long winded essay question possibility:\{\{nl\}\} "Describe multiple reasons we should use C\# on our next project to support making maintainable software?"} \tn % Row Count 9 (+ 9) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Why learn/use C\#}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}C\# is simple, readable and easy to use\{\{nl\}\}C\# is all about developer productivity\{\{nl\}\}C\# is very flexible and allows you to develop a big variety of systems.\{\{nl\}\}Console applications Desktop applications (Windows Forms, WPF) Windows Services Web Services and Web applications (ASP.NET Core, Blazor) Native Mobile Applications (.NET MAUI) AI Applications (ML.NET) Distributed and Cloud Applications (Azure) Games (Unity) IoT applications Reusable libraries\{\{nl\}\}C\# runs on a solid well-engineered .NET runtime\{\{nl\}\}C\# has built-in design patterns and best practices} \tn % Row Count 23 (+ 14) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Some Niceties of the C\# Language}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Functions as Values - Delegates, Event Handlers, etc. \{\{nl\}\}Lambdas, Closures \{\{nl\}\}Events - Design code around events "happening" \{\{nl\}\}Threading\{\{nl\}\} OOL\{\{nl\}\}Library support\{\{nl\}\} Exceptions \{\{nl\}\}Garbage collection \{\{nl\}\}GUI Support \{\{nl\}\}Much much more.} \tn % Row Count 30 (+ 7) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{C\# (cont)}} \tn % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{DLL -Dynamic Link Library}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Your compiled code\{\{nl\}\} Let's take a look at the GUI Chat Client release folder \{\{nl\}\} Logging dll \{\{nl\}\}Communications dll \{\{nl\}\}File Logger Dll\{\{nl\}\} Etc., etc., etc.} \tn % Row Count 5 (+ 5) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{What do we do with DLL}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}At Run Time \{\{nl\}\}The system combines (links) all the DLLs as necessary} \tn % Row Count 8 (+ 3) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Debug vs. Release}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}When Deploying: \{\{nl\}\}Almost always the DLL should be built in \{\{nl\}\} RELEASE mode \{\{nl\}\} More efficient - removes debug symbols \{\{nl\}\}When Developing \{\{nl\}\}Almost always the DLL should be built in \{\{nl\}\} DEBUG mode \{\{nl\}\}Allows debugger to interact with running program \{\{nl\}\}In rare "why does it work on my machine but not when deployed" situations, you can deploy DEBUG code and ATTACH to it!} \tn % Row Count 18 (+ 10) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Logging}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Dependency Injection}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Key Ideas\{\{nl\}\} Code (objects) need other Code (objects) to work (or to be more effective) \{\{nl\}\}Databases, Loggers, UserManagers, etc., \{\{nl\}\}Where do those other objects come from? \{\{nl\}\}Static Globals? Parameters?\{\{nl\}\} Dependency injections help reduce reliance on "Globals"} \tn % Row Count 7 (+ 7) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Summary – Dependency Injection}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Objects that need other objects to help do their job \{\{nl\}\}Want to be able to use different objects without modifying source code: \{\{nl\}\}Define functionality as an interface \{\{nl\}\}Pass object in at construction time (and save in class field)\{\{nl\}\} Important: only works for classes that the "system" builds for you \{\{nl\}\}E.g., you MAUI program MainPage!} \tn % Row Count 16 (+ 9) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Logging Defined}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Logging is the act of recording information about the what is happening during the run time of your program} \tn % Row Count 20 (+ 4) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Where should you put log info?}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Logs can be sent to one \_or more\_ of the following: \{\{nl\}\}Console\{\{nl\}\} Debug Display in Visual Studio \{\{nl\}\}GUI\{\{nl\}\} Files\{\{nl\}\} Databases\{\{nl\}\} Windows Event Log\{\{nl\}\} Etc.} \tn % Row Count 25 (+ 5) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Log Levels}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Some information is more important (to certain people) than other. \{\{nl\}\}Too much information is often not useful. \{\{nl\}\}Log Levels\{\{nl\}\} Refers to how much and how "high a level" (or low) the information is \{\{nl\}\}E.g. Debug vs Critical Error} \tn % Row Count 32 (+ 7) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Logging (cont)}} \tn % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{0 Trace}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}every little detail.. way too much information... turn this off most of the time \{\{nl\}\}Stakeholder: Developer - Something really odd is going on… \{\{nl\}\}Show me all the mouse X,Y values as the mouse traverses the screen} \tn % Row Count 6 (+ 6) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{1 Debug}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}standard detail level... usually too much info to store... use this for development \{\{nl\}\}Stakeholder: Developer - Standard Development Cycle \{\{nl\}\}Show me every collision between two objects in the game} \tn % Row Count 12 (+ 6) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{2 Information}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}high level information... for example "when a client connects"... use this to understand "meta-level" of application \{\{nl\}\}Stakeholder: Developer/Site Administrator \{\{nl\}\}Show me who logged into the system.} \tn % Row Count 18 (+ 6) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{3 Warning}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}something is probably going wrong, but we haven't handled it yet\{\{nl\}\} Stakeholder: Developer/Site Administrator \{\{nl\}\}Show me when an unauthorized user attempts to access data} \tn % Row Count 23 (+ 5) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{4 Error}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}something has gone wrong and we didn't know how to (or didn't want to spend the time) to handle it\{\{nl\}\} Stakeholders: Site Administrators, Project Lead, (Developer) \{\{nl\}\}Bank software cannot transfer to another bank} \tn % Row Count 29 (+ 6) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{5 Critical}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}the application is about to die... can we do it gracefully?\{\{nl\}\} Stakeholders: Site Administrator, Project Lead \{\{nl\}\}Bank software "died" because database is not accessible} \tn % Row Count 34 (+ 5) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Logging (cont)}} \tn % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{6 None}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}turn off messaging.\{\{nl\}\} Reasons to do:\{\{nl\}\} My code is perfect. \{\{nl\}\}Disk space is very expensive.\{\{nl\}\} (Note: neither of these are a reason to do this, nor are they true)} \tn % Row Count 5 (+ 5) % Row 12 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Decisions - Where in Code to place Logging}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Any "big" action\{\{nl\}\} Connection on the net\{\{nl\}\} Any "complicated" action\{\{nl\}\} For debugging complete message building \{\{nl\}\} Any "catastrophic" event \{\{nl\}\}Let developer manager know where to go back to look for problem} \tn % Row Count 11 (+ 6) % Row 13 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Example of levels to log messages at}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Position of mouse\{\{nl\}\} \_logger.LogTrace(\$ "\{MousePosition\}" ); \{\{nl\}\}Partial messages coming over internet\{\{nl\}\} \_logger.LogDebug( \$"Data Receive: \{data\}" ); \{\{nl\}\}Information (or maybe just warning) \{\{nl\}\}New Chat Client Connected\{\{nl\}\} \_logger.LogInformation( \$" \{name\} connected from \{ip\_address\}" );} \tn % Row Count 19 (+ 8) % Row 14 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Setting Up Logger on a C\# program}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}To (correctly) use Loggers and Dependency Injection, you must instrument the following places of your code: \{\{nl\}\}The Main Program \{\{nl\}\}The Class Constructor \{\{nl\}\}Class Methods} \tn % Row Count 24 (+ 5) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Threading}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Threads (applies to \_all\_ languages)}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Important Issues:\{\{nl\}\} Race Conditions\{\{nl\}\} Locking shared data\{\{nl\}\} Deadlock \{\{nl\}\}Two (or more) threads each waiting on the other(s) to release a lock \{\{nl\}\}Easy fix → One lock/Order Locking \{\{nl\}\}Warning: Debugging changes behavior. How? \{\{nl\}\}No assurance of ordering\{\{nl\}\} Asynchronous!} \tn % Row Count 8 (+ 8) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Networking and GUI → Threads}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Network communications come in "Async"\{\{nl\}\} Handled on DIFFERENT threads \{\{nl\}\}GUI work MUST BE DONE on the GUI thread\{\{nl\}\} Solution: \{\{nl\}\}Dispatcher.Dispatch( ( ) =\textgreater{} \{ MessagesAndStatus.Text = \$"Server Shutdown!" + Environment.NewLine; \}} \tn % Row Count 15 (+ 7) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Dispatcher}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Dispatcher\{\{nl\}\} Puts requests for GUI changes into a queue \{\{nl\}\}When the GUI thread "has a chance", take care of requests in queue \{\{nl\}\}Always runs on GUI thread \{\{nl\}\}Warning - More than one thread (GUI + networking(s)): \{\{nl\}\}LOCKING!!! \{\{nl\}\}If your GUI thread deals with an object that a networking thread also uses, you must protect the code using locks!} \tn % Row Count 24 (+ 9) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Race Condition – server code}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}The Clients list is "shared" by all threads, thus becoming a Race Condition\{\{nl\}\} How do we fix this?\{\{nl\}\} Answer: locking! \{\{nl\}\}Warning for Server: Don't "hold on to" client list while doing lots of work (e.g., sending messages to all clients) \{\{nl\}\}Copy client list (while locked) \{\{nl\}\}Then iterate over the copied list!} \tn % Row Count 33 (+ 9) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{MVC}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{MVC -Model View Controller}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Tendency is to write all of our logic together\{\{nl\}\} Assignment 7 Server "logics" \{\{nl\}\}Networking ← Model \{\{nl\}\}GUI ← View/Controller \{\{nl\}\}Connected Clients ← Model} \tn % Row Count 5 (+ 5) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Separation of Concerns}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}GUI Server \{\{nl\}\}Everything to do with storing multiple clients should be "abstracted" (i.e., put into a model class) \{\{nl\}\}Everything to do with Networking should be put into the Networking class\{\{nl\}\} Everything to do with the GUI should stay in the GUI class} \tn % Row Count 12 (+ 7) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Invalidate}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}i.e., PlaySurface.Invalidate();\{\{nl\}\} Can be called anywhere (not just on GUI thread) \{\{nl\}\}Tell GUI Thread: At next opportunity, redraw the affected region\{\{nl\}\} Suggested Options \{\{nl\}\}Always (inside Draw Scene) → BAD :( \{\{nl\}\}"Burns" cycles\{\{nl\}\} On Message Received → Locked with Server → Okay \{\{nl\}\}Timer → X times per second → Good as well \{\{nl\}\}Especially if your client did "interpolation"!} \tn % Row Count 22 (+ 10) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{JSON}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{JSON Serialization - "Recursion"}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Is it recursive?\{\{nl\}\} Yes - all objects inside public Properties are also serialized. \{\{nl\}\}Deep Copy (not shallow copy)\{\{nl\}\} "Cloning" \{\{nl\}\}?? Circular References ??} \tn % Row Count 5 (+ 5) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{JSON Serialization - Default Operation}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}What constructor is used BEFORE data put in:\{\{nl\}\} Default constructor \{\{nl\}\}What is serialized? Public properties \{\{nl\}\} What is not serialized?\{\{nl\}\} Fields, private properties \{\{nl\}\}How do we change that? \{\{nl\}\}Attributes (Metadata Tags)} \tn % Row Count 12 (+ 7) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{JSON De/Serialization - How does it work?}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Reflection \{\{nl\}\}Runtime - inspect code \{\{nl\}\}Deserialization\{\{nl\}\} Calls default* constructor \{\{nl\}\}"Finds" the names of the properties\{\{nl\}\} Reads the JSON looking for matching names \{\{nl\}\}Puts data directly into properties \{\{nl\}\}Serialization\{\{nl\}\} "Finds" names of properties and auto-generates json string} \tn % Row Count 20 (+ 8) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Important JSON Attribute Tags and Options}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}{[}JsonConstructor{]}\{\{nl\}\} Specify the specific constructor to use \{\{nl\}\}Constructor parameters must match names of Json Fields \{\{nl\}\}{[}JsonInclude{]} \{\{nl\}\}Force property to be part of the serialization \{\{nl\}\}{[}JsonIgnore{]} \{\{nl\}\}For property to not be part of the serialization\{\{nl\}\} {[}JsonRequire{]} \{\{nl\}\}If field \_not\_ there then error} \tn % Row Count 28 (+ 8) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Parsing JSON}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Food f = new Food(); \{\{nl\}\}List\textless{}Food\textgreater{} list = new(); \{\{nl\}\}list.Add(f); \{\{nl\}\}message = \seqsplit{JsonSerializer.Serialize(} list );\{\{nl\}\} JsonSerializer.DeSerialize\textless{}List\textless{}Food\textgreater{}\textgreater{}( message ); \{\{nl\}\}DeSerialize(message, new List\textless{}Food\textgreater{}().Type()) \{\{nl\}\}\{CMD\_Food\}{[}\{X:50,Y:50,ID:5..\},...{]}} \tn % Row Count 35 (+ 7) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Web Servers}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Web Server}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Simply a program that listens on a port for a connection (e.g., from a web browser) and sends back web pages \{\{nl\}\}Using HTTP -Hypertext transport protocol} \tn % Row Count 5 (+ 5) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{HTTP sequence}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Point browser to a web server, e.g., \{\{nl\}\} http://www.webpage.com \{\{nl\}\}Browser opens socket to address\{\{nl\}\} Server accepts socket \{\{nl\}\}Browser sends text:\{\{nl\}\} "GET / HTTP/1.1" + stuff\{\{nl\}\} Server replies with text: \{\{nl\}\} "HTTP/1.1 200 OK …" + "\textless{}html\textgreater{}…\textless{}/html\textgreater{}" \{\{nl\}\}Server closes socket – every HTTP request uses a new connection} \tn % Row Count 14 (+ 9) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Protocol}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Just a bunch of strings sent through sockets on the net…\{\{nl\}\} Request, e.g., \{\{nl\}\} GET / HTTP/1.1\{\{nl\}\} Host: www.cs.utah.edu \{\{nl\}\}Response, e.g.,\{\{nl\}\} HTTP/1.1 200 OK\{\{nl\}\} Content-Type: text/html; charset-UTF-8} \tn % Row Count 20 (+ 6) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{HTTP Web Response}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Just a string that follows the protocol, e.g.,\{\{nl\}\} Header \{\{nl\}\}{[}New Line{]}\{\{nl\}\} Body} \tn % Row Count 23 (+ 3) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{HTTP Web Response Example}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}HTTP/1.1 200 OK\textbackslash{}n \{\{nl\}\}Connection: close\textbackslash{}n \{\{nl\}\}Content-Type: text/html; charset=UTF-8\textbackslash{}n\{\{nl\}\} \textbackslash{}n \{\{nl\}\}\textless{}text or html\textgreater{}} \tn % Row Count 27 (+ 4) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Body → HTML (simple example)}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}\textless{}!DOCTYPE html\textgreater{} \{\{nl\}\} \textless{}html\textgreater{} \{\{nl\}\} \textless{}body\textgreater{} \{\{nl\}\} \textless{}h1\textgreater{}My First Heading\textless{}/h1\textgreater{} \{\{nl\}\} \textless{}p\textgreater{}My first paragraph.\textless{}/p\textgreater{} \{\{nl\}\}\textless{}/body\textgreater{}\{\{nl\}\} \textless{}/html\textgreater{}} \tn % Row Count 32 (+ 5) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Web Servers (cont)}} \tn % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{URL -Uniform Resource Locator}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}\seqsplit{scheme://host:port/path?query} \{\{nl\}\}scheme → protocol (e.g. ftp, http, https)\{\{nl\}\} host → server name or address\{\{nl\}\} e.g. www.cs.utah.edu \{\{nl\}\}Port → 80/443 by default \{\{nl\}\}We will continue to use 11000} \tn % Row Count 6 (+ 6) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Web page extras}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}CSS \{\{nl\}\}Cascading Style Sheets\{\{nl\}\} Send type: "text/css" \{\{nl\}\}Makes things look nice} \tn % Row Count 9 (+ 3) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{User Secrets}}} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Secrets - "Infrastructure" information you do not want in the code base, e.g.,\{\{nl\}\} Location of DB \{\{nl\}\}User of DB \{\{nl\}\}Password for DB\{\{nl\}\} Other data that might be changed by a System Admin (not a developer)} \tn % Row Count 15 (+ 6) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}