diff --git a/1 - Introduction/1.1 - Who Is This Resource For.tex b/1 - Introduction/1.1 - Who Is This Resource For.tex index 4bbcc2e..6bb0d7a 100644 --- a/1 - Introduction/1.1 - Who Is This Resource For.tex +++ b/1 - Introduction/1.1 - Who Is This Resource For.tex @@ -1,12 +1,12 @@ This resource is intended for everyone. -\newline -\\ +\par + This resource is meant to be useful to programmers of all levels, those who have never programmed before, those who are just getting started and even those who have been programming for years. Since this resource will always be growing and changing as the industry changes the information should always be in some way applicable for all developers. -\newline -\\ +\par + Those who are familiar with programming are most likely going to be able to skip the chapter "Getting Started" and in some cases might not read the resource in sequential order, but rather skip around picking and choosing which sections are applicable to them. diff --git a/1 - Introduction/1.2 - Code Examples.tex b/1 - Introduction/1.2 - Code Examples.tex index 1c51344..f1a94c2 100644 --- a/1 - Introduction/1.2 - Code Examples.tex +++ b/1 - Introduction/1.2 - Code Examples.tex @@ -1,7 +1,7 @@ All code examples in this resource use a sudo language that is not meant to be run or compiled directly. I have chosen to use this approach so that the concepts can be extracted and implemented in any language on any platform. -\newline -\\ +\par + I will cover how to use the sudo language and how to translate it to a useable programming language in the chapter "Getting Started" and section "Sudo Language". diff --git a/1 - Introduction/Introduction.tex b/1 - Introduction/Introduction.tex index 622dd4c..45a7ec6 100644 --- a/1 - Introduction/Introduction.tex +++ b/1 - Introduction/Introduction.tex @@ -1,16 +1,14 @@ Programming In General is meant to be used as a resource to learn the concepts of computer programming that can be applied to any language or platform. -\newline -\\ +\par + This resource is and always will be provided for free. -\newline -\\ +\par + This resource is currently a work in progress so please bear with me if any particular sections or chapters are in complete or if sections contain less than correct information. -If you have any comments, questions, suggestions or corrections please feel free to contact me by e-mail at: -\newline -brett@blangdon.com -\newline +If you have any comments, questions, suggestions or corrections please feel free to contact me by e-mail at: \emph{brett@blangdon.com} \\ +\par Thank you and enjoy. -\pagebreak + diff --git a/2 - Getting Started/1.1 - Choosing A Programming Language.tex b/2 - Getting Started/1.1 - Choosing A Programming Language.tex index 650cd62..6626ed0 100644 --- a/2 - Getting Started/1.1 - Choosing A Programming Language.tex +++ b/2 - Getting Started/1.1 - Choosing A Programming Language.tex @@ -2,7 +2,6 @@ It is wonderful that you have decided to undertake the hobby of computer program C/C++, VB, Ruby, Scala, Groovy, Javascript, or one of the thousands of others languages available to programmers. There are many factors to consider when choosing a programming language especially when getting into programming for the first time: paradigm, syntax, platform and even just the coolness factor. -\newline \subsection{Paradigm} A languages paradigm refers to how the language is constructed. For example the three mainly disucessed paradigms are Functional, Object Oriented diff --git a/2 - Getting Started/1.2 - Sudo Language.tex b/2 - Getting Started/1.2 - Sudo Language.tex index 2cec9aa..d23d632 100644 --- a/2 - Getting Started/1.2 - Sudo Language.tex +++ b/2 - Getting Started/1.2 - Sudo Language.tex @@ -1,13 +1,13 @@ For the code examples presented in this resource I am going to be using a sudo language. The concept behind a sudo language is to be able to present programming concepts in a language agnostic form so that the concepts can be translated to your language of choice. -\newline -\\ +\par + So it is great that you have chosen lanauge X to use throughout this resource, but how is the sudo lanauge going to help you out? Well, lets walk through a few examples and I will show you how the examples get translated to a few various languages. \subsection{Example 1} -\begin{lstlisting} +\begin{lstlisting}[caption={Example 1 - Sudo Code}] name = "Brett" if name == "Brett" print "Name Is Brett" @@ -20,8 +20,7 @@ variable name is equal to the value "Brett", if so then we want to print "Name I print "Name Is Not Brett". As far as programming goes this is a fairly simple process but lets try and translate this example to a few different languages to see how it is done. -{\bf PHP:} -\begin{lstlisting} +\begin{lstlisting}[language=php,caption={Example 1 - PHP}] getName() === 'Brett' ){ } \end{lstlisting} -{\bf Java:} -\begin{lstlisting} +\begin{lstlisting}[language=java,caption={Eample 2 - Java}] class Person{ private String name; @@ -168,8 +161,7 @@ class Person{ } \end{lstlisting} -{\bf Node.JS:} -\begin{lstlisting} +\begin{lstlisting}[language=javascript,caption={Example 2 - Node.JS}] var Person = function(){} Person.prototype.getName = function(){ return this.name; @@ -188,8 +180,7 @@ if( p.getName() == "Brett" ){ } \end{lstlisting} -{\bf Python:} -\begin{lstlisting} +\begin{lstlisting}[language=python,caption={Example 2 - Python}] class Person: def getname( self ): return self.name @@ -210,7 +201,6 @@ laid out by the sudo language can still be extrapolated and translated to each i language supports the concepts. As you may notice that I left out the implementation of C in this example. It is because C does not support the use of classes and objects, yes there are ways of completing this example in C using structs but that is something that you should learn on your own. -\newline -\\ +\par So now you have seen a few examples, hopefully enough to give you an idea of how the examples in this resource will be presented. diff --git a/2 - Getting Started/1.3 - How To Read This Resource.tex b/2 - Getting Started/1.3 - How To Read This Resource.tex index 07bb3c5..56c120c 100644 --- a/2 - Getting Started/1.3 - How To Read This Resource.tex +++ b/2 - Getting Started/1.3 - How To Read This Resource.tex @@ -1,12 +1,10 @@ This resource is going to be laid out a little weird, more so for those who have already had some programming background. -\newline -\\ +\par For those who are new to programming I strongly suggest reading through Chapters 3 and 4 thoroughly before continuing with the rest of the resource. Those two chapters contain all of the core concepts needed in order to understand some of the higher level concepts presented with Data Structures and Algorithms. -\newline -\\ +\par Once you have completed chapters 3 and 4 please feel free to jump around a little between sections presented in chapters 5 and 6 as some data structures or algorithms might interest you more than others. diff --git a/2 - Getting Started/Getting Started.tex b/2 - Getting Started/Getting Started.tex index 3ed1136..e1c2df5 100644 --- a/2 - Getting Started/Getting Started.tex +++ b/2 - Getting Started/Getting Started.tex @@ -1,3 +1,2 @@ This chapter will cover how to get started with programming, how to choose which language or platform to start with and how to go about using this resource. -\pagebreak diff --git a/3 - Functional Programming/1.1 - Variables.tex b/3 - Functional Programming/1.1 - Variables.tex index 662c09c..c5a24e6 100644 --- a/3 - Functional Programming/1.1 - Variables.tex +++ b/3 - Functional Programming/1.1 - Variables.tex @@ -1,53 +1,30 @@ -For starters we are going to cover some basic usage of variables. Variables are used to store values to be read and manipulated. -For example we can create a variable named "name" and store the value of the string "Brett" in it. -\begin{lstlisting} -name = "Brett" -\end{lstlisting} - -Fairly simple to start with. -\newline -\\ - -So here we are storing a string into a variable but what about other types of data? Each programming language supports different data types -but for the most part they all support numbers, usaully various types, strings as well as booleans (true or false).So, we can store these -different data types in variables as well. +Variables are used to represent values by name and allow you to access the original value or manipulate the original value. +For example we would store the integer value 10 into a variable named "a" which would then allow us to refer to "10" by +using the name "a". \begin{lstlisting} -name = "Brett" -number = 10 -boolean = false +a = 10 +print a \end{lstlisting} -Great, we can store values into a variable to use, but what do you mean use them? Well we can either use the variable names to access -the values that we stored in them or we can manipulate the values stored in variables. +In the above example the output would be "10" because the value 10 is stored in the variable "a" and then we access the original value +10 when we print a. -\begin{lstlisting} -name = "Brett" -print name -\end{lstlisting} +\subsection{Data Types} -Here we are storing the string "Brett" into the variable "name" and then printing the value stored in name. Here we are showing that -we can access the original string value "Brett" from the variable "name". +Programming languages support different types of data types or different types of values that they can represent in variables. +Some programming languages use multiple different types of values but most of them support the basic types: string, integer +and boolean (true or false). \begin{lstlisting} -a = 10 -b = 5 -c = a + b -print c +string = "Brett" +integer = 10 +boolean = false \end{lstlisting} -Ok, so here we are taking the number, or integer, value 10 and storing it into the variable "a", and the integer value 5 and storing it into -the variable "b". Then we are using the mathematical opperator for addition (+) to store the addition of the values stored by -"a" and "b" into the variable "c". Lastly, we are printing the value of "c" which if all works as we would like would print "15". -\newline -This is another example of showing how we can access the values stored within variables and act upon them. In this case we are accessing -the values 10, stored in "a", and 5, stored in "b", and performing mathematical opperations on them. +Please keep in mind that each programming language supports different data types and you should research those types to better +understand variables in that language. -\begin{lstlisting} -a = 10 -a = a + 5 -print a -\end{lstlisting} +\subsection{Operations} -In this example we are storing the integer value 10 into the variable "a" and then we are manipulating the value of a in such a way that we -are adding the integer value 5 to it. Lastly, we are printing the final value of "a", which will be "15". +\subsection{Conclusion} diff --git a/3 - Functional Programming/1.3 - Control Statements.tex b/3 - Functional Programming/1.3 - Control Statements.tex new file mode 100644 index 0000000..e69de29 diff --git a/3 - Functional Programming/1.4 - Loops.tex b/3 - Functional Programming/1.4 - Loops.tex new file mode 100644 index 0000000..e69de29 diff --git a/3 - Functional Programming/1.5 - Functions.tex b/3 - Functional Programming/1.5 - Functions.tex new file mode 100644 index 0000000..e69de29 diff --git a/3 - Functional Programming/Functional Programming.tex b/3 - Functional Programming/Functional Programming.tex index b4ebb4a..60c395a 100644 --- a/3 - Functional Programming/Functional Programming.tex +++ b/3 - Functional Programming/Functional Programming.tex @@ -3,13 +3,15 @@ to different people, but in regard to this resource we are going to refer to fun without the use of classes and objects. Yes, some people are cringing a little in their seats as that is not the best definition of functional programming but to try and keep things simple and organized that is what we are going to refer to it as. -\newline -\\ +\par + I am going to use this chapter to introduce topics other than just functions. Topics including control statements, loops and some input output (io). -\newline -\\ -{\bf Functional Programming:} +\par + +\vfill + +{\it Functional Programming:} \\ Functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data. -\newline +\\ Wikipedia (2012) diff --git a/Programming In General.tex b/Programming In General.tex index 94375e1..4bc6fda 100644 --- a/Programming In General.tex +++ b/Programming In General.tex @@ -1,20 +1,101 @@ \documentclass[10pt,a4paper,titlepage]{book} +\usepackage[width=7in, height=9.5in,papersize={8.5in,11in}]{geometry} \usepackage[utf8]{inputenc} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{moreverb} \usepackage{listings} +\usepackage{layout} +\usepackage{fancyhdr} +\usepackage{color} + + \author{Brett Langdon} \title{Programming In General} -\lstset{language=php,numbers=left,stepnumber=1} + +\pagestyle{fancy} +\voffset=0.25in + + +\newcommand{\HRule}{\rule{\linewidth}{0.5mm}} + + + +\definecolor{lstkeyword}{rgb}{.2,.2,.7} +\definecolor{lstcomment}{rgb}{.7,.7,.7} +\definecolor{lstidentifier}{rgb}{0,0,0} +\definecolor{lststring}{rgb}{.4,.4,.4} + + +\lstset{ + numbers=left, + stepnumber=1, + numberstyle=\footnotesize, + frame=single, + showspaces=false, + showstringspaces=false, + basicstyle=\ttfamily, + linewidth=6.5in, + xleftmargin=0.5in, + keywordstyle=\bfseries\color{lstkeyword}, + commentstyle=\itshape\color{lstcomment}, + identifierstyle=\color{lstidentifier}, + stringstyle=\color{lststring}, + morekeywords={class,public,private,protected,$this,return,this,self,if,else,function,print}, + morestring=[b]', + morestring=[b]", + morecomment=[s]{/*}{*/}, + comment=[l]{//} +} + + +\lstdefinelanguage{javascript}{ + keywords={typeof, new, true, false, catch, function, return, null, catch, switch, var, if, in, while, do, else, case, break}, + ndkeywords={class, export, boolean, throw, implements, import, this}, + sensitive=false, + comment=[l]{//}, + morecomment=[s]{/*}{*/}, + morestring=[b]', + morestring=[b]" +} + +\lstdefinelanguage{php}{ + keywords={$this,class,public,private,protected,return,new,null,catch,try,switch,if,else,while,do,case,break,continue,true,false,function,boolean,throw,implements,inhrits,echo,print} + sensitive=false, + comment=[l]{//}, + morecomment=[s]{/*}{*/}, + morestring=[b]', + morestring=[b]" +} + \begin{document} -\maketitle + +\begin{titlepage} +\begin{center} + +\vspace*{3 in} + +\HRule \\[0.4cm] +{\huge \bfseries Programming In General} +\HRule \\[0.4cm] + +\emph{Author:}\\ +Brett \textsc{Langdon} + +\vfill + +{\large \today} + +\end{center} +\end{titlepage} + \tableofcontents \chapter{Introduction} \input{"./1 - Introduction/Introduction"} - +\vfill +\pagebreak \section{Who Is This Resource For} \input{"./1 - Introduction/1.1 - Who Is This Resource For"} @@ -23,7 +104,8 @@ \chapter{Getting Started} \input{"./2 - Getting Started/Getting Started"} - +\vfill +\pagebreak \section{Choosing A Programming Language} \input{"./2 - Getting Started/1.1 - Choosing A Programming Language"} @@ -35,16 +117,29 @@ \chapter{Functional Programming} \input{"./3 - Functional Programming/Functional Programming"} - +\vfill +\pagebreak \section{Variables} \input{"./3 - Functional Programming/1.1 - Variables"} +\section{Control Statements} +\input{"./3 - Functional Programming/1.3 - Control Statements"} + +\section{Loops} +\input{"./3 - Functional Programming/1.4 - Loops"} + +\section{Functions} +\input{"./3 - Functional Programming/1.5 - Functions"} + \chapter{Object Oriented Programming} \input{"./4 - Object Oriented Programming/Object Oriented Programming"} - +\vfill +\pagebreak \chapter{Data Structures} \input{"./5 - Data Structures/Data Structures"} - +\vfill +\pagebreak \chapter{Algorithms} \input{"./6 - Algorithms/Algorithms"} -\end{document} +\vfill +\pagebreak\end{document} diff --git a/build b/build index 77cb630..b474c12 100755 --- a/build +++ b/build @@ -17,6 +17,7 @@ for d in filter(lambda d: not re.search('.git',d),dirs): book.write('\r\n\chapter{' + chapter + '}\r\n') if os.path.exists(d + '/' + chapter + '.tex'): book.write('\input{"' + d + '/' + chapter + '"}\r\n') + book.write('\\vfill\r\n\pagebreak') files = os.listdir(d) for f in filter(lambda f: re.search('^\d+.\d+\s-\s',f), files): section = re.sub('\d+.\d+\s-\s|.tex', '', f) diff --git a/header.tex b/header.tex index fb6a97d..cdaeaac 100644 --- a/header.tex +++ b/header.tex @@ -1,13 +1,93 @@ \documentclass[10pt,a4paper,titlepage]{book} +\usepackage[width=7in, height=9.5in,papersize={8.5in,11in}]{geometry} \usepackage[utf8]{inputenc} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{moreverb} \usepackage{listings} +\usepackage{layout} +\usepackage{fancyhdr} +\usepackage{color} + + \author{Brett Langdon} \title{Programming In General} -\lstset{language=php,numbers=left,stepnumber=1} + +\pagestyle{fancy} +\voffset=0.25in + + +\newcommand{\HRule}{\rule{\linewidth}{0.5mm}} + + + +\definecolor{lstkeyword}{rgb}{.2,.2,.7} +\definecolor{lstcomment}{rgb}{.7,.7,.7} +\definecolor{lstidentifier}{rgb}{0,0,0} +\definecolor{lststring}{rgb}{.4,.4,.4} + + +\lstset{ + numbers=left, + stepnumber=1, + numberstyle=\footnotesize, + frame=single, + showspaces=false, + showstringspaces=false, + basicstyle=\ttfamily, + linewidth=6.5in, + xleftmargin=0.5in, + keywordstyle=\bfseries\color{lstkeyword}, + commentstyle=\itshape\color{lstcomment}, + identifierstyle=\color{lstidentifier}, + stringstyle=\color{lststring}, + morekeywords={class,public,private,protected,$this,return,this,self,if,else,function,print}, + morestring=[b]', + morestring=[b]", + morecomment=[s]{/*}{*/}, + comment=[l]{//} +} + + +\lstdefinelanguage{javascript}{ + keywords={typeof, new, true, false, catch, function, return, null, catch, switch, var, if, in, while, do, else, case, break}, + ndkeywords={class, export, boolean, throw, implements, import, this}, + sensitive=false, + comment=[l]{//}, + morecomment=[s]{/*}{*/}, + morestring=[b]', + morestring=[b]" +} + +\lstdefinelanguage{php}{ + keywords={$this,class,public,private,protected,return,new,null,catch,try,switch,if,else,while,do,case,break,continue,true,false,function,boolean,throw,implements,inhrits,echo,print} + sensitive=false, + comment=[l]{//}, + morecomment=[s]{/*}{*/}, + morestring=[b]', + morestring=[b]" +} + \begin{document} -\maketitle + +\begin{titlepage} +\begin{center} + +\vspace*{3 in} + +\HRule \\[0.4cm] +{\huge \bfseries Programming In General} +\HRule \\[0.4cm] + +\emph{Author:}\\ +Brett \textsc{Langdon} + +\vfill + +{\large \today} + +\end{center} +\end{titlepage} + \tableofcontents