| @ -0,0 +1,12 @@ | |||
| This book is intended for everyone. | |||
| \newline | |||
| \\ | |||
| This book 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 | |||
| \\ | |||
| 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 book in sequential order, but rather skip around picking and choosing which sections are | |||
| applicable to them. | |||
| @ -0,0 +1,7 @@ | |||
| All code examples in this book 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 | |||
| \\ | |||
| 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". | |||
| @ -1 +1,16 @@ | |||
| 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 | |||
| \\ | |||
| This resource is and always will be provided for free. | |||
| \newline | |||
| \\ | |||
| 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 | |||
| \\ | |||
| Thank you and enjoy. | |||
| \pagebreak | |||
| @ -0,0 +1,34 @@ | |||
| It is wonderful that you have decided to undertake the hobby of computer programming, but which language should you choose: Python, PHP, Java, C\#, | |||
| 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 | |||
| and Multi Paradigm. Functional refers to languages that are based around completing tasks using Mathematical functionals; C is an example of | |||
| a functional language because it does not support the use of classes or objects. Object Oriented languages on the other hand are constrcuted | |||
| by designing classes and objects to complete your programming tasks; Java is an example of an Object Oriented programming language because | |||
| regardless of the type of program you develop you are forced into using classes and objects. Multi Paradigm languages are usually a mix | |||
| of more than one paradigm. For example Python is a Multi Paradigm language because you can choose whether or not to use classes and objects | |||
| when programming. | |||
| \subsection{Syntax} | |||
| A languages syntax is very important when choosing a language. This is mainly going to be a personal preference. Personally I like C style | |||
| sytanx languages like C,C++,Java,PHP,Javascript,etc. Other people might prefer other languages because their use of other syntax styles. Your | |||
| personal preference will come with time as you move from one language to another and develop your own personal style and preferences. | |||
| \subsection{Platform} | |||
| This is a very important factor when choosing which programming language to use. What platforms do you have available to use? Do you only have | |||
| a Windows computer at your disposal? That might remove some of the options out there as some languages might not support developing on a | |||
| Windows machine. | |||
| \subsection{Coolness} | |||
| What seems cool to you? Right now as I write this a lot of people are trying out Node.JS (even myself) as it is somewhat new and exciting. | |||
| What do you want to learn? Does the idea of developing real time event based web applications seem cool? Then maybe you should check out | |||
| Node.JS. Prefer to develop Windows based desktop applications, why not try out C\# or Vb? Go with what you feel. | |||
| \subsection{Conclusion} | |||
| Advice, if after doing some research you are still unsure which lanauge you want to use, especially for going through this resource try out | |||
| Python. Python is available for every platform, or at least all of the ones I can think of, it is interpreted and lastly it's syntax is | |||
| going to be one of the closest to the sudo langauge that this book uses. | |||
| @ -0,0 +1,132 @@ | |||
| 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 | |||
| \\ | |||
| So it is great that you have chosen lanauge X to use throughout this book, 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} | |||
| name = "Brett" | |||
| if name == "Brett" | |||
| print "Name Is Brett" | |||
| else | |||
| print "Name Is Not Brett" | |||
| \end{lstlisting} | |||
| In this example we have a variable called "name" that we are assigning the value of "Brett". Then we are checking if the | |||
| variable name is equal to the value "Brett", if so then we want to print "Name Is Brett" otherwise if it does not then we want to | |||
| 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. | |||
| PHP: | |||
| \begin{lstlisting} | |||
| <?php | |||
| $name = 'Brett'; | |||
| if( $name === 'Brett' ){ | |||
| echo 'Name Is Brett'; | |||
| } else{ | |||
| echo 'Name Is Not Brett'; | |||
| } | |||
| \end{lstlisting} | |||
| C: | |||
| \begin{lstlisting} | |||
| int main{ | |||
| char* name = "Brett"; | |||
| if( name == "Brett" ){ | |||
| printf("Name Is Brett"); | |||
| } else{ | |||
| printf("Name Is Not Brett"); | |||
| } | |||
| return 0; | |||
| } | |||
| \end{lstlisting} | |||
| Python: | |||
| \begin{lstlisting} | |||
| name = "Brett" | |||
| if name is "Brett": | |||
| print "Name Is Brett" | |||
| else: | |||
| print "Name Is Not Brett" | |||
| \end{lstlisting} | |||
| Node.JS: | |||
| \begin{lstlisting} | |||
| var name = "Brett"; | |||
| if( name == "Brett" ){ | |||
| console.log("Name Is Brett"); | |||
| } else{ | |||
| console.log("Name Is Not Brett"); | |||
| } | |||
| \end{lstlisting} | |||
| Java: | |||
| \begin{lstlisting} | |||
| class Example1{ | |||
| public static void main( String[] args ){ | |||
| String name = "Brett"; | |||
| if( name.equals("Brett") ){ | |||
| System.out.println("Name Is Brett"); | |||
| } else{ | |||
| System.out.println("Name Is Not Brett"); | |||
| } | |||
| } | |||
| } | |||
| \end{lstlisting} | |||
| Notice that all of the actual examples end up looking the same? That is the point of using the sudo language, so that we can | |||
| discuss the core concepts for each example. | |||
| \subsection{Example 2} | |||
| Since we have seen a fairly simple example above, lets take a look at a more complicated example. Do not be afraid if it does not make | |||
| too much sense right now, but try and notice the similarities between the sudo language and the actual code examples. | |||
| \begin{lstlisting} | |||
| class Person | |||
| private name | |||
| function getName() | |||
| return this.name | |||
| function setName( newName ) | |||
| this.name = newName | |||
| p = new Person() | |||
| p.setName("Brett") | |||
| if p.getName() == "Brett" | |||
| print "Name Is Brett" | |||
| else | |||
| print "Name Is Not Brett" | |||
| \end{lstlisting} | |||
| Ok, in this example we are using the concept of classes and objects. We are creating a new class called "Person" with a | |||
| private property "name" and two methods "getName" and "setName". "getName" will return the value of the private property "name" and | |||
| "setName" will take in a single parameter "newName" and set the private property "name"'s value to the value of "newName". Lastly we | |||
| are going to create a variable called "p" and have it be equal to a new instance of a "Person", set that instances name to "Brett" then like | |||
| in the previous example we are going to get if the value of "p"'s private property "name" is equal to "Brett". | |||
| \newline | |||
| \\ | |||
| Like I mentioned before, this example might go over the head of some people as it introduces some more advanced topics, but hopefully it | |||
| helps to understand how you can translate the sudo language. | |||
| PHP: | |||
| \begin{lstlisting} | |||
| <?php | |||
| class Person{ | |||
| private $name; | |||
| public function getName(){ | |||
| return $this->name; | |||
| } | |||
| public function setname( $newName ){ | |||
| $this->name = $newName; | |||
| } | |||
| } | |||
| \end{lstlisting} | |||
| @ -0,0 +1,3 @@ | |||
| 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 | |||