\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{Ilyes KAANICH (ilyes64)} \pdfinfo{ /Title (python-software-engineering-best-practices.pdf) /Creator (Cheatography) /Author (Ilyes KAANICH (ilyes64)) /Subject (Python Software Engineering Best Practices 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}{A2A2A2} \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{Python Software Engineering Best Practices Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{Ilyes KAANICH (ilyes64)} via \textcolor{DarkBackground}{\uline{cheatography.com/124061/cs/23651/}}} \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}Ilyes KAANICH (ilyes64) \\ \uline{cheatography.com/ilyes64} \\ \uline{\seqsplit{www}.linkedin.com/in/ilyes-kaanich/} \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 11th August, 2020.\\ Updated 11th August, 2020.\\ 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}{Clean and Modular Code}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Production Code} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}software running on production servers to handle live users and data of the intended audience.} \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Production Quality Code} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}code that meets expectations in {\bf{reliability, efficiency}}, etc., for production.} \tn % Row Count 6 (+ 3) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Clean Code} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}readable, simple, and concise.} \tn % Row Count 8 (+ 2) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Modular Code} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}logically broken up into functions and modules.} \tn % Row Count 10 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Module} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}a file. Modules allow code to be reused by encapsulating them into files that can be imported into other files.} \tn % Row Count 14 (+ 4) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Making your code Modular makes it easier to} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}\{\{fa-square-o\}\}Reuse your code \{\{nl\}\} \{\{fa-square-o\}\}Write less code \{\{nl\}\} \{\{fa-square-o\}\}Read your code \{\{nl\}\} \{\{fa-square-o\}\}Collaborate on code} \tn % Row Count 19 (+ 5) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Refactoring Code} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}{\bf{restructuring your code to improve its internal structure, without changing its external functionality.}} This gives you a chance to clean and modularize your program after you've got it working.program after you've got it working.} \tn % Row Count 25 (+ 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}{Writing Clean Code: Meaningful Names}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Be descriptive and imply type} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}E.g. for booleans, you can prefix with `is\_` or `has\_` to make it clear it is a condition. You can also use part of speech to imply types, like verbs for functions and nouns for variables.} \tn % Row Count 5 (+ 5) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Be consistent but clearly differentiate} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}E.g. `age\_list` and `age` is easier to differentiate than `ages` and `age`.} \tn % Row Count 8 (+ 3) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Avoid abbreviations and especially single letters} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}(Exception: counters and common math variables) Choosing when these exceptions can be made can be determined based on the audience for your code. If you work with other data scientists, certain variables may be common knowledge. While if you work with full stack engineers, it might be necessary to provide more descriptive names in these cases as well.} \tn % Row Count 17 (+ 9) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Long names != descriptive names} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}You should be descriptive, but only with relevant information. E.g. good functions names describe what they do well without including details about implementation or highly specific uses.} \tn % Row Count 22 (+ 5) \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Try testing how effective your names are by asking a fellow programmer to guess the purpose of a function or variable based on its name, without looking at your code. Coming up with meaningful names often requires effort to get right.} \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}{Writing Clean Code: Nice Whitespace}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Organize your code with consistent indentation} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}the standard is to use 4 spaces for each indent. You can make this a default in your text editor.} \tn % Row Count 4 (+ 4) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Separate sections with blank lines to keep your code well organized and readable.} \tn % Row Count 6 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Try to limit your lines to around 79 characters, which is the guideline given in the PEP 8 style guide.} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}In many good text editors, there is a setting to display a subtle line that indicates where the 79 character limit is.} \tn % Row Count 12 (+ 6) \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{For more guidelines, check out \{\{popup="https://www.python.org/dev/peps/pep-0008/?\#code-lay-out"\}\}the code layout section of PEP 8 \{\{/popup\}\}} \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}{Writing Modular Code}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{DRY (Don't Repeat Yourself)} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Don't repeat yourself! Modularization allows you to reuse parts of your code. Generalize and consolidate repeated code in functions or loops.} \tn % Row Count 4 (+ 4) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Abstract out logic to improve readability} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Abstracting out code into a function not only makes it less repetitive, but also improves readability with descriptive function names. Although your code can become more readable when you abstract out logic into functions, it is possible to over-engineer this and have way too many modules, so use your judgement.} \tn % Row Count 12 (+ 8) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Minimize the number of entities (functions, classes, modules, etc.)} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}There are tradeoffs to having function calls instead of inline logic. If you have broken up your code into an unnecessary amount of functions and modules, you'll have to jump around everywhere if you want to view the implementation details for something that may be too small to be worth it. Creating more modules doesn't necessarily result in effective modularization.} \tn % Row Count 22 (+ 10) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Functions should do one thing} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Each function you write should be focused on doing one thing. If a function is doing multiple things, it becomes more difficult to generalize and reuse. Generally, if there's an "and" in your function name, consider refactoring.} \tn % Row Count 28 (+ 6) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Arbitrary variable names can be more effective in certain functions} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Arbitrary variable names in general functions can actually make the code more readable.} \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}{Writing Modular Code (cont)}} \tn % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Try to use fewer than three arguments per function} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}Try to use no more than three arguments when possible. This is not a hard rule and there are times it is more appropriate to use many parameters. But in many cases, it's more effective to use fewer arguments. Remember we are modularizing to simplify our code and make it more efficient to work with. If your function has a lot of parameters, you may want to rethink how you are splitting this up.} \tn % Row Count 10 (+ 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}{Efficient Code}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{\{\{fa-square-o\}\} Execute faster \newline % Row Count 1 (+ 1) \{\{fa-square-o\}\}Take up less space in memory/storage% Row Count 3 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{The project you're working on would determine which of these is more important to optimize for your company or product. When we are performing lots of different transformations on large amounts of data, this can make orders of magnitudes of difference in performance. \newline E.g. \{\{popup="https://stackoverflow.com/questions/8929284/what-makes-sets-faster-than-lists/8929445\#8929445"\}\}Sets faster than lists in python \{\{/popup\}\}} \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}{Documentation}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{additional text or illustrated information that comes with or is embedded in the code of software.}}\{\{nl\}\} \newline % Row Count 3 (+ 3) Helpful for clarifying complex parts of code, making your code easier to navigate, and quickly conveying how and why different components of your program are used.\{\{nl\}\} \newline % Row Count 7 (+ 4) Several types of documentation can be added at different levels of your program: \newline % Row Count 9 (+ 2) \{\{fa-square-o\}\}{\bf{In-line Comments}} - line level \newline % Row Count 10 (+ 1) \{\{fa-square-o\}\}{\bf{Docstrings}} - module and function level \newline % Row Count 12 (+ 2) \{\{fa-square-o\}\}{\bf{Project Documentation}} - project level% Row Count 14 (+ 2) } \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}{Use version control}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Version control, also known as revision control or source control, is the management of changes to documents, computer programs, large websites, and other collections of information. Each revision is associated with a timestamp and the person making the change. \newline % Row Count 6 (+ 6) The most famous version control system is {\bf{Git}}% Row Count 7 (+ 1) } \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}{Testing}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Testing your code is essential before deployment. It helps you catch errors and faulty conclusions before they make any major impact.} \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Test driven development} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}a development process where you write tests for tasks before you even write the code to implement those tasks.} \tn % Row Count 7 (+ 4) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Unit Test} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}a type of test that covers a "unit" of code, usually a single function, independently from the rest of the program.} \tn % Row Count 11 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Log Messages}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Logging is the process of recording messages to describe events that have occurred while running your software.} \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Be professional and clear} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}`Bad: Hmmm... this isn't working??? \{\{nl\}\}Bad: idk.... :(\{\{nl\}\}Good: Couldn't parse file.`} \tn % Row Count 6 (+ 3) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Be concise and use normal capitalization} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}`Bad: Start Product Recommendation Process \{\{nl\}\} Bad: We have completed the steps necessary and will now proceed with the recommendation process for the records in our product database.\{\{nl\}\} Good: Generating product recommendations.\{\{nl\}\}`} \tn % Row Count 13 (+ 7) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Choose the appropriate level for logging} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}DEBUG - level you would use for anything that happens in the program.\{\{nl\}\} ERROR - level to record any error that occurs\{\{nl\}\} INFO - level to record all actions that are user-driven or system specific, such as regularly scheduled operations} \tn % Row Count 20 (+ 7) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Provide any useful information} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}`Bad: Failed to read location data\{\{nl\}\} Good: Failed to read location data: store\_id 8324971`} \tn % Row Count 23 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Code Reviews}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Code reviews benefit everyone in a team to promote best programming practices and prepare code for production.} \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Questions to Ask Yourself When Conducting a Code Review}}} \tn % Row Count 5 (+ 2) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Is the code clean and modular?} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}\{\{fa-square-o\}\}Can I understand the code easily? \{\{nl\}\} \{\{fa-square-o\}\}Does it use meaningful names and whitespace?\{\{nl\}\} \{\{fa-square-o\}\} Is there duplicated code?\{\{nl\}\} \{\{fa-square-o\}\} Can you provide another layer of abstraction?\{\{nl\}\} \{\{fa-square-o\}\} Is each function and module necessary?\{\{nl\}\} \{\{fa-square-o\}\} Is each function or module too long?} \tn % Row Count 14 (+ 9) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Is the code efficient?} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}\{\{fa-square-o\}\}Are there loops or other steps we can vectorize? \{\{nl\}\} \{\{fa-square-o\}\}Can we use better data structures to optimize any steps?\{\{nl\}\} \{\{fa-square-o\}\}Can we shorten the number of calculations needed for any steps? \{\{nl\}\} \{\{fa-square-o\}\}Can we use generators or multiprocessing to optimize any steps?} \tn % Row Count 22 (+ 8) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Is documentation effective?} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}\{\{fa-square-o\}\}Are in-line comments concise and meaningful? \{\{nl\}\} \{\{fa-square-o\}\}Is there complex code that's missing documentation? \{\{nl\}\} \{\{fa-square-o\}\}Do function use effective docstrings? \{\{nl\}\} \{\{fa-square-o\}\}Is the necessary project documentation provided?} \tn % Row Count 29 (+ 7) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Is the code well tested?} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}\{\{fa-square-o\}\}Does the code high test coverage? \{\{nl\}\} \{\{fa-square-o\}\}Do tests check for interesting cases? \{\{nl\}\} \{\{fa-square-o\}\}Are the tests readable? \{\{nl\}\} \{\{fa-square-o\}\}Can the tests be made more efficient?} \tn % Row Count 35 (+ 6) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Code Reviews (cont)}} \tn % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Is the logging effective?} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}\{\{fa-square-o\}\}Are log messages clear, concise, and professional? \{\{nl\}\} \{\{fa-square-o\}\}Do they include all relevant and useful information? \{\{nl\}\} \{\{fa-square-o\}\}Do they use the appropriate logging level?} \tn % Row Count 6 (+ 6) \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{\{\{link="https://github.com/lyst/MakingLyst/tree/master/code-reviews"\}\}Code Review\{\{/link\}\} \newline \{\{link="https://www.kevinlondon.com/2015/05/05/code-review-best-practices.html"\}\}Code Review Best Practices \{\{/link\}\}} \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}{Conducting a Code Review}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Use a code linter} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}This can save you lots of time from code review. Using a Python code linter like pylint can automatically check for coding standards and PEP 8 guidelines for you.} \tn % Row Count 5 (+ 5) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Explain issues and make suggestions} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}`\{\{fa-square-o\}\}BAD: Make model evaluation code its own module - too repetitive. \{\{nl\}\}\{\{fa-square-o\}\}BETTER: Make the model evaluation code its own module. This will simplify models.py to be less repetitive and focus primarily on building models. \{\{nl\}\}\{\{fa-square-o\}\}GOOD: How about we consider making the model evaluation code its own module? This would simplify models.py to only include code for building models. Organizing these evaluations methods into separate functions would also allow us to reuse them with different models without repeating code.`} \tn % Row Count 18 (+ 13) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Keep your comments objective} \tn \mymulticolumn{1}{x{8.4cm}}{\hspace*{6 px}\rule{2px}{6px}\hspace*{6 px}`\{\{fa-square-o\}\}BAD: I wouldn't groupby genre twice like you did here... Just compute it once and use that for your aggregations. \{\{nl\}\}\{\{fa-square-o\}\}BAD: You create this groupby dataframe twice here. Just compute it once, save it as groupby\_genre and then use that to get your average prices and views. \{\{nl\}\}\{\{fa-square-o\}\}GOOD: Can we group by genre at the beginning of the function and then save that as a groupby object? We could then reference that object to get the average prices and views without computing groupby twice.`} \tn % Row Count 31 (+ 13) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Conducting a Code Review (cont)}} \tn % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Provide code examples} \tn % Row Count 1 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}