\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{FreddyAlmeida} \pdfinfo{ /Title (conceptos-de-la-programacion.pdf) /Creator (Cheatography) /Author (FreddyAlmeida) /Subject (Conceptos de la Programación 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}{154EA3} \definecolor{LightBackground}{HTML}{F0F3F9} \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{Conceptos de la Programación Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{FreddyAlmeida} via \textcolor{DarkBackground}{\uline{cheatography.com/147497/cs/32306/}}} \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}FreddyAlmeida \\ \uline{cheatography.com/freddyalmeida} \\ \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 8th 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{tabularx}{17.67cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{17.67cm}}{\bf\textcolor{white}{Inyección de dependencias}} \tn \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{Un {\bf{patrón de diseño}} orientado a objetos en el que {\bf{se suministran objetos a una clase}} en lugar de ser la propia clase la que cree dichos objetos.% Row Count 4 (+ 4) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{17.67cm}}{{\bf{Formas : }} \newline - Constructor \newline - Método Setter \newline - Variable de instancia / Propiedad} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.8718 cm} x{11.3982 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Solid}} \tn % Row 0 \SetRowColor{LightBackground} \seqsplit{Single-responsiblity} & La clase, componente o microservicios deben hacer {\bf{una cosa}} para disminuir futuras modificaciones y/o cambios.\{\{nl\}\} {\bf{Principio de responsabilidad única}} \tn % Row Count 7 (+ 7) % Row 1 \SetRowColor{white} Open-closed & Entidades deben de estar {\bf{ABIERTAS}} para su extensión pero {\bf{CERRADAS}} para su modificación.\{\{nl\}\} {\bf{Principio de abierto/cerrado}} \tn % Row Count 13 (+ 6) % Row 2 \SetRowColor{LightBackground} Liskov Substitution & Una subclase debe poder ser sustituible por su superclase.\{\{nl\}\} {\bf{Principio de sustitución de Liskov}} \tn % Row Count 17 (+ 4) % Row 3 \SetRowColor{white} Interface Segregation & Segregar las clases tanto como sea posible.\{\{nl\}\} {\bf{Principio de segregación de la interfaz}} \tn % Row Count 21 (+ 4) % Row 4 \SetRowColor{LightBackground} Dependency Inversion & Permite inyectar otras clases y añadir funcionalidad transversal \tn % Row Count 24 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.181 cm} x{12.089 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Arquitectura - Capas de Aplicación}} \tn % Row 0 \SetRowColor{LightBackground} \seqsplit{Presentation} (UI) & Handles HTTP requests and responds with HTML OR JSON/XML \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} Service & Business logic \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} Data & Database access \tn % Row Count 4 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{17.67cm}}{Despite having a logically modular architecture, the application is packaged and deployed as a {\bf{monolith}}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{3.1086 cm} x{14.1614 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Monolithic Architecture}} \tn % Row 0 \SetRowColor{LightBackground} \seqsplit{Benefits} & - Simple to develop \{\{nl\}\}- Simple to test (launch the application) \{\{nl\}\}- Simple to deploy (Copy packaged app) \{\{nl\}\}- Simple to scale horizontally (Copy apps) \tn % Row Count 6 (+ 6) % Row 1 \SetRowColor{white} \seqsplit{Drawbacks} & - Limitations in size and complexity \{\{nl\}\}- Application becomes to large and complex to fully understand and make changes fast. \{\{nl\}\}- Size of application can slow down start-up time. \{\{nl\}\}- Each update requieres entire application to be redeployed. \{\{nl\}\}- Changes require extensive manual testing. \{\{nl\}\}- Continuous deployment becomes difficult. \{\{nl\}\}- Adopting new technologies must be applied to entire application thus becomes expensive in both time and cost \tn % Row Count 21 (+ 15) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{17.67cm}}{In the early stages of the project it works well and basically most of the big and successful applications which exist today were started as a monolith.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{3.1086 cm} x{14.1614 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Microservices Architecture}} \tn % Row 0 \SetRowColor{LightBackground} \seqsplit{Benefits} & Manageable services (Faster to develop) \{\{nl\}\}- Can be managed independently \{\{nl\}\}- New technologies are easier to apply \{\{nl\}\}- Deployed Independently \{\{nl\}\}- Scaled Independently \tn % Row Count 6 (+ 6) % Row 1 \SetRowColor{white} \seqsplit{Drawbacks} & Since it uses partitioned database architecture each database must be handled independently \{\{nl\}\}- Testing is more complex (Must deploy the service and all of its dependencies) \{\{nl\}\}- Deploying becomes more complex (Requires planning and coordination) \{\{nl\}\}- Every service must be configured, deployed, scaled and monitored independently \tn % Row Count 17 (+ 11) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{17.67cm}}{The ides is to split the application into a set of smaller interconnected services({\bf{Microservice}}) instead of building a single monolithic application. \newline Each microservice : \newline - Has its own hexagonal architecture (UI, BL,DA) \newline - Has its own database schema thus {\bf{ensures loose coupling}} \newline - Can use the type of database that best suits its needs (Poliglot persistence architecture)} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{17.67cm}}{\bf\textcolor{white}{Que es OOP}} \tn \SetRowColor{white} \mymulticolumn{1}{x{17.67cm}}{Un modelo que organiza el diseño de software en torno a datos u objetos. \newline % Row Count 2 (+ 2) {\bf{Beneficios }}: \newline % Row Count 3 (+ 1) - Reutilización \newline % Row Count 4 (+ 1) - Escalabilidad \newline % Row Count 5 (+ 1) - Eficiencia% Row Count 6 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{6.0445 cm} x{11.2255 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Principios de OOP}} \tn % Row 0 \SetRowColor{LightBackground} Encapsulacion & Toda la información importante está contenida dentro de un objeto y solo se expone la información seleccionada La implementación y el estado de cada objeto se mantienen de forma privada dentro de una clase definida El objeto no tiene acceso a esta clase ni a la autorización para realizar cambios Llamar solo a una lista de métodos o funciones públicos \tn % Row Count 14 (+ 14) % Row 1 \SetRowColor{white} Abstraccion & Los objetos solo revelan mecanismos internos que son relevantes para el uso de otros objetos, ocultando cualquier código de implementación innecesario. La clase derivada puede tener su funcionalidad extendida \tn % Row Count 23 (+ 9) % Row 2 \SetRowColor{LightBackground} Herencia / Inheritance & Las clases pueden reutilizar código de otras clases Se pueden asignar relaciones y subclases entre objetos, lo que permite la reutilización de la lógica común mientras se mantiene una jerarquía única. \tn % Row Count 31 (+ 8) \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{6.0445 cm} x{11.2255 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Principios de OOP (cont)}} \tn % Row 3 \SetRowColor{LightBackground} Polimorpphism & Los objetos están diseñados para compartir comportamientos y tomar más de una forma. Permite el paso de diferentes tipos de objetos a través de la misma interfaz. \tn % Row Count 7 (+ 7) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{17.67cm}{x{5.3537 cm} x{11.9163 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{17.67cm}}{\bf\textcolor{white}{Access Modifiers}} \tn % Row 0 \SetRowColor{LightBackground} public & acceso no está restringido \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} protected & acceso está limitado a la clase contenedora \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} internal & acceso está limitado al ensamblado actual \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} protected internal & El acceso está limitado al ensamblado actual o a los tipos derivados de la clase contenedora. \tn % Row Count 9 (+ 4) % Row 4 \SetRowColor{LightBackground} private & El acceso está limitado al {\bf{tipo contenedor}} \tn % Row Count 11 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \end{document}