Commit 2bfb4c4c authored by Nathan Bean's avatar Nathan Bean
Browse files

Added object-orientation chapter

parent 57017d49
......@@ -12,6 +12,7 @@ page = [ "HTML", "Iframeable", "Teleprompter"]
section = [ "HTML", "Iframeable", "Teleprompter"]
[params]
textbookURL = "https://cs.ksu.edu/~nhbean/cis400"
editURL = "https://gitlab.cs.ksu.edu/nhbean/cis400-textbook/tree/master/content/"
description = "K-State CIS 400 Textbook"
author = "Nathan Bean"
......
---
title: "Course Introduction"
pre: "1. "
weight: 10
date: 2018-08-24T10:53:26-05:00
---
{{% notice noiframe %}}
This textbook was authored for the **CIS 400 - Object-Oriented Design, Implementation, and Testing** course at Kansas State University. This front matter is specific to that course. If you are not enrolled in the course, please disregard this section.
{{% /notice %}}
## Course Resources
* [Syllabus]({{<ref "0-forward/07-syllabus.md">}})
* [Textbook]({{<param textbookURL>}})
## Welcome Message
Hello students, and welcome to CIS 400 - Object-Oriented Design, Implementation, and Testing. My name is Nathan Bean, and I will be your instructor for this course.
![Nathan Bean]({{<static "images/bean-bridge.jpg">}})
\ No newline at end of file
---
title: "Course Structure"
pre: "2. "
weight: 20
date: 2018-08-24T10:53:26-05:00
---
{{% notice noiframe %}}
This textbook was authored for the **CIS 400 - Object-Oriented Design, Implementation, and Testing** course at Kansas State University. This front matter is specific to that course. If you are not enrolled in the course, please disregard this section.
{{% /notice %}}
This course is taught in the "flipped" style. This means you will be watching videos and working through totorials _before_ you come to class. Your class sessions will be for working on and getting help with your projects.
### The Big Software Solution
Up to this point, you've likely done a lot of what I like to call "Baby Projects" - programming projects that are useful to demonstrate a concept or technique, but really don't do anything beyond that. In contrast, we'll be building a large, multi-project software solution to meet a real-world problem - the software needed to run a fast-food franchise chain, the _Bleakwood Buffet_.
We'll be building this software _iteratively_ over the entire semester! Each week, you'll turn in one milestone as a GitHub release, just like you might do as a professional software developer. Because each milestone builds upon your prior work, it is critical that you keep up. Falling behind will very quickly tank your grade.
### Weekly Modules
The course is organized into weekly modules focused on a specific topic. Each module introduces one or more topics, and 1) covering the vocabulary and concepts with assigned readings, 2) puts those concepts into practice with guided tutorials, and 3) tasks you with applying those techniques you just practiced in a weekly milestone.
The modules, and all of their associated assignments, are available through Canvas. All module work is due at the end of the week (or occasionally mid-week). But be aware that if you procrastinate and don't start until the weekend, it is unlikely that you will finish. Which means you will fall behind. You can very quickly find yourself in a hole you cannot climb out of. So time management is a _critical_ skill you need to be developing.
{{% notice warning %}}
Remember that in the CS Professional Program, a grade of less than C in a professional program course (like CIS 400) results in a "Warning of Unsatisfactory Progress." This warning sticks with you the rest of your time at K-State. If you earn a second, similar grade, you will be dismissed from the CS Professional Program!
{{% /notice %}}
### Class Meetings
Due to the COVID-19 classroom capacity restrictions, not all students in the course can be physically in the classroom at the same time. Accordingly, the students in the course will be divided into three groups: I, II, and III.
* Group I will meet Mondays
* Group II will meet Wednesdays
* Group III will meet on Fridays.
{{% notice warning %}}
Please only come during your assigned day!
{{% /notice %}}
You can verify your group by visiting the Canvas page, clicking the **People** menu option, and then the **Groups** tab.
![Finding your Group on Canvas]({{<static "images/0.0.2.1.png">}})
I will be sending a survey _before_ the start of the semester to determine students' preferred group. Students will be placed in groups based on available space and the order thier request was recieved in.
{{% notice info %}}
The CS Scholars section will be split into groups, as it is small enough to fit into the classroom safely. Scholars still have the choice of attending in-person or remotely.
{{% /notice %}}
Also, if you realize your group meeting time is not working for you, let me know. It may be possible to switch.
Attendance at the class meetings is not manditory. If you are uncomfortable coming to the classroom, you do not need to.
### Joining Remotely
Class meetings will also be broadcast over zoom, should you want to join a session that you are not attending in-person. These meetings can be accessed from the **Zoom** Menu option in Canvas.
![Zoom in Canvas]({{<static "images/0.0.2.2.png">}})
You may join **any** class session via Zoom, either section, any day. Please maintain good netiquitte while in a class Zoom session.
---
title: "Where to Find Help"
pre: "3. "
weight: 30
date: 2018-08-24T10:53:26-05:00
---
{{% notice noiframe %}}
This textbook was authored for the **CIS 400 - Object-Oriented Design, Implementation, and Testing** course at Kansas State University. This front matter is specific to that course. If you are not enrolled in the course, please disregard this section.
{{% /notice %}}
#### Resources
* [K-State IT Help Desk](https://www.k-state.edu/its/helpdesk/) - Email: [helpdesk@ksu.edu](mailto:helpdesk@ksu.edu)
* [K-State Online Canvas Help](http://public.online.k-state.edu/help/)
* [Instructure Canvas Guides](https://community.canvaslms.com/community/answers/guides)
* [K-State Libraries](http://www.lib.k-state.edu/)
* [K-State CS Support](https://support.cs.ksu.edu/)
* [K-State CS Advising](https://www.cs.ksu.edu/undergraduate/advising/)
* [K-State Engineering Student Services](https://www.engg.ksu.edu/studentservices/)
* [K-State Office of Student Life](https://www.k-state.edu/studentlife/)
* [K-State Report It](https://www.k-state.edu/report/)
* [Visual Studio Support](https://visualstudio.microsoft.com/support/)
As you work on the materials in this course, you may run into questions or problems and need assistance. This video reviews the various types of help available to you in this course.
First and foremost, anytime you have a questions or need assistance in the course, please post in the course RocketChat room. It is the best place to go to get help with anything related to this course, from the tutorials and projects to issues with Visual Studio and Canvas. Before you post on RocketChat, take a minute to look around and make sure the question has not already been posted before. It will save everyone quite a bit of time.
There are a few major reasons we’ve chosen to use RocketChat in this program. Our goal is to respond as quickly as possible, and having a single place for all questions allows the instructors and the TAs to work together to answer questions and solve problems quickly. As an added bonus, it reduces the amount of email generated by the class. RocketChat includes lots of features to make your messages easily readable using both markdown and code blocks. Finally, by participating in discussions on RocketChat and helping to answer questions from your fellow students, you can earn extra credit points!
Beyond RocketChat, there are a few resources you should be aware of. First, if you have any issues working with K-State Canvas, K-State IT resources, or any other technology related to the delivery of the course, your first source of help is the K-State IT Helpdesk. They can easily be reached via email at helpdesk@ksu.edu. Beyond them, there are many online resources for using Canvas, all of which are linked in the resources section below the video. As a last resort, you may also want to post in RocketChat, but in most cases we may simply redirect you to the K-State helpdesk for assistance.
For issues with the RocketChat platform, feel free to email one of the instructors directly if you are unable to post directly on RocketChat itself for some reason.
If you have issues with the technical content of the course, specifically related to completing the tutorials and projects, there are several resources available to you. First and foremost, make sure you consult the vast amount of material available in the course modules, including the links to resources. Usually, most answers you need can be found there.
If you are still stuck or unsure of where to go, the next best thing is to post your question on RocketChat, or review existing discussions for a possible answer. You can find the link to the left of this video. As discussed earlier, the instructors, TAs, and fellow students can all help answer your question quickly.
Of course, as another step you can always exercise your information-gathering skills and use online search tools such as Google to answer your question. While you are not allowed to search online for direct solutions to assignments or projects, you are more than welcome to use Google to access programming resources such as the [Microsoft Developer Network](https://developer.microsoft.com/en-us/), [C# language documentation](https://docs.microsoft.com/en-us/dotnet/csharp/tour-of-csharp/), [WPF-tutorial.com](https://www.wpf-tutorial.com/), and other tutorials. I can definitely assure you that programmers working in industry are often using Google and other online resources to solve problems, so there is no reason why you shouldn’t start building that skill now.
Next, we have grading and administrative issues. This could include problems or mistakes in the grade you received on a project, missing course resources, or any concerns you have regarding the course and the conduct of myself and your peers. You’ll be interacting with us on a variety of online platforms and sometimes things happen that are inappropriate or offensive. There are lots of resources at K-State to help you with those situations. First and foremost, please DM me on RocketChat as soon as possible and let me know about your concern, if it is appropriate for me to be involved. If not, or if you’d rather talk with someone other than me about your issue, I encourage you to contact either your academic advisor, the CS department staff, College of Engineering Student Services, or the K-State Office of Student Life. Finally, if you have any concerns that you feel should be reported to K-State, you can do so at [https://www.k-state.edu/report/](https://www.k-state.edu/report/). That site also has links to a large number of resources at K-State that you can use when you need help.
Finally, if you find any errors or omissions in the course content, or have suggestions for additional resources to include in the course, DM the instructors on RocketChat. There are some extra credit points available for helping to improve the course, so be on the lookout for anything that you feel could be changed or improved.
So, in summary, RocketChat should always be your first stop when you have a question or run into a problem. For issues with Canvas or Visual Studio, you are also welcome to refer directly to the resources for those platforms. For questions specifically related to the projects, use RocketChat for sure. For grading questions and errors in the course content or any other issues, please DM the instructors on RocketChat for assistance.
Our goal in this program is to make sure that you have the resources available to you to be successful. Please don’t be afraid to take advantage of them and ask questions whenever you want.
\ No newline at end of file
---
title: "What You'll Learn"
pre: "4. "
weight: 40
date: 2018-08-24T10:53:26-05:00
---
{{% notice noiframe %}}
This textbook was authored for the **CIS 400 - Object-Oriented Design, Implementation, and Testing** course at Kansas State University. This front matter is specific to that course. If you are not enrolled in the course, please disregard this section.
{{% /notice %}}
The following is an outline of the topics we will be covering and when.
{{% notice info %}}
Please be aware that this schedule and topic list will likely undergo some revision during the semester.
{{% /notice %}}
Week 1 (Week of 8/17/2020)
* How we learn programming
* The context in which object-orientation emerged
* **Exam 0 - The Pretest**
Week 2 (Week of 8/24/2020)
* Classes and Objects
* Ecapsulation
* Data Hiding
* State and Behavior
* Objects in Memory
* Documenting Objects
* Data Milestone 1
Week 3 (Week of 8/31/2020)
* Message Passing
* Interfaces
* Automated Testing
* Test-Driven Design
* Data Milestone 2
Week 4 (Week of 9/7/2020)
* Polymorphism
* Types
* Inheritance
* Dynamic Dispatch
* Data Milestone 3
Week 5 (Week of 9/14/2020)
* Exam I
Week 6 (Week of 9/21/2020)
* Desktop Development
* Windows Presentation Foundation vs. Windows Forms
* Component-Based Design
* XAML
* POS Milestone 1
Week 7 (Week of 9/28/2020)
* Data Binding
* MVVM Architecture
* Testing User Interfaces
* POS Milestone 2
Week 8 (Week of 10/5/2020)
* Component Interaction
* Advanced Debugging technqiues
* POS Milestone 3
Week 9 (Week of 10/12/2020)
* DLL Integration
* POS Milestone 4
Week 10 (Week of 10/19/2020)
* Exam II
Week 11 (Week of 10/26/2020)
* .NET Core
* Webservers
* Razor Pages
* Web Milestone 1
Week 12 (Week of 11/2/2020)
* Web Forms
* Request Processing
* Aggregation Functions
* Web Milestone 2
Week 13 (Week of 11/9/2020)
* LINQ
* Web Milestone 3
Week 14 (Week of 11/16/2020)
* Blazor components
* Web Milestone 4
Week 15 (Week of 11/30/2020) [Distance Week]
* Asynchronous functions
Week 16 (Week of 12/7/2020)
* Final
\ No newline at end of file
---
title: "Course Textbooks"
pre: "5. "
weight: 50
date: 2018-08-24T10:53:26-05:00
---
{{% notice noiframe %}}
This textbook was authored for the **CIS 400 - Object-Oriented Design, Implementation, and Testing** course at Kansas State University. This front matter is specific to that course. If you are not enrolled in the course, please disregard this section.
{{% /notice %}}
This course does not have a required print textbook. The resources presented in the modules are also organized into an online textbook that can be accessed here: [{{< param textbookURL >}}]({{< param textbookURL >}}). You may find this a useful reference if you prefer a traditional texbook layout. Additionally, since the textbook exists outside of Canvas' access control, you can continue to utilize it after the course ends.
{{% notice warning %}}
Please note that the materials presented in Canvas have additional graded assignments and exercises worked into the reading order that do not appear in the online edition of the textbook. You are responsible for completing these!
{{% /notice %}}
## O'Riley for Higher Education
If you are looking for additional resources to support your learning, a great resource that is availabe to Kansas State University students is the [O'Riley For Higher Education](https://go.oreilly.com/kansas-state-university) digital library offered through the Kansas State University Library. These include electronic editions of thousands of popular textbooks as well as videos and tutorials. As of this writing, a search for object-orientation returns 13,237 results and C# returns 5,984 results. In particular, I would recommend these books:
* ["The Object-Oriented Thought Process"](https://learning.oreilly.com/library/view/the-object-oriented-thought/9780135182130/) by Matt Weisfeld for learning more about object-orientation.
* ["Mastering Windows Presentation Foundation"](https://learning.oreilly.com/library/view/mastering-windows-presentation/9781838643416/) by Sheridan Yuen for learning about WPF.
* ["xUnit Test Patterns: Refactoring Test Code"](https://learning.oreilly.com/library/view/xunit-test-patterns/9780131495050/) by Gerard Meszaros for learning about the xUnit framework.
There are likewise materials for other computer science topics you may have an interest in - it is a great resource for all your CS coursework. It costs you nothing (technically, your access was paid for by your tuition and fees), so you might as well make use of it!
---
title: "Course Software"
pre: "6. "
weight: 60
date: 2018-08-24T10:53:26-05:00
---
{{% notice noiframe %}}
This textbook was authored for the **CIS 400 - Object-Oriented Design, Implementation, and Testing** course at Kansas State University. This front matter is specific to that course. If you are not enrolled in the course, please disregard this section.
{{% /notice %}}
For this course, we will be using a number of software packages including:
* Microsoft Visual Studio 2019
* Microsoft Visio 2019
* Xamarin Workbooks
These have been installed in the classroom lab, as well as all Engineering and Computer Science labs. It is strongly suggested that you install the same versions on your own development machines if you plan on working from home. Alternatively, you can _remote desktop_ into a lab computer and use the installed software there.
## Remote Desktop Access
To use a remote desktop, you must first install a remote desktop client on your computer. Microsoft supplies a client for most platforms, which you can find links to and information about [here](https://docs.microsoft.com/en-us/windows-server/remote/remote-desktop-services/clients/remote-desktop-clients?redirectedfrom=MSDN).
The remote desktop server is behind a network firewall, so when accessing it from off-campus, you must be using the K-State Virtual Private Network (VPN). It has its own client that also must be installed. You can learn about K-State's VPN and download the client on [K-State's VPN Page](https://www.k-state.edu/its/security/secure-data/vpn/)
For remote desktop servers, you can use either those maintained by [The Department of Computer Science](https://support.cs.ksu.edu/CISDocs/wiki/Remote_Access) or the [College of Engineering](https://cecs.engg.ksu.edu/labs/vdi).
## Installing on Your Machine
If you would prefer to install the software on your own development machine, you can obtain no-cost copies of Microsoft Visual Studio Professional Edition and Microsoft Visio through Microsoft's [Azure Portal](https://azureforeducation.microsoft.com/devtools) and signing in with your K-State eid and password.
After signing in, click the "Software" option in the left menu, and browse the available software for what you need.
The Visual Studio Community Edition is also available as a free download [here](https://visualstudio.microsoft.com/downloads/). While not as full-featured as the Professional edition you can download through Azure Portal, it will be sufficient for the needs of this class.
Xamarin Workbooks is a free tool and can be downloaded from [here](https://docs.microsoft.com/en-us/xamarin/tools/workbooks/install).
## RocketChat
The CS Department's RocketChat server can be accessed as a web-based app from [https://chat.cs.ksu.edu](https://chat.cs.ksu.edu).
In addition, RocketChat offers free desktop and mobile client apps you can download from [here](https://rocket.chat/install/). Once installed, they will prompt you for a server address to connect to. Use the CS Departmental server address: [https://chat.cs.ksu.edu](https://chat.cs.ksu.edu).
\ No newline at end of file
This diff is collapsed.
+++
title = "Course Information"
date = 2018-08-24T10:53:05-05:00
weight = 1
chapter = true
pre = "0. "
+++
### Forward
# CIS 400 Course Information
Getting Oriented
{{% notice noiframe %}}
This textbook was authored for the **CIS 400 - Object-Oriented Design, Implementation, and Testing** course at Kansas State University. This front matter is specific to that course. If you are not enrolled in the course, please disregard this section.
{{% /notice %}}
\ No newline at end of file
---
title: "Chapter 0 Introduction"
pre: "1."
weight: 10
date: 2018-08-24T10:53:26-05:00
---
Lorem Ipsum
---
title: "Introduction"
pre: "1."
weight: 10
date: 2018-08-24T10:53:26-05:00
---
Before we delve too deeply into how to reason about Object-Orientation and how to utilize it in your programming efforts, it would be useful to understand _why_ object-orientation came to exist. This initial chapter seeks to explore the origins behind object-oriented programming.
## Key Terms
Some key terms to learn in this chapter are:
* The Software Crisis
* Structured Programming
---
title: "The Growth of Computing"
pre: "2. "
weight: 20
date: 2018-08-24T10:53:26-05:00
---
By this point, you should be familiar enough with the history of computers to be aware of the evolution from the massive room-filling vaccum tube implementations of ENIAC, UNIVAC, and other first-generation computers to transistor-based mainframes like the PDP-1, and the eventual introduction of the microcomputer (desktop computers that are the basis of the modern PC) in the late 1970's. Along with a declining size, each generation of these machines also cost less:
<table>
<tr>
<th>Machine</th>
<th>Release Year</th>
<th>Cost at Release</th>
<th>Adjusted for Inflation</th>
</tr>
<tr>
<td>ENIAC</td>
<td>1945</td>
<td>$400,000</td>
<td>$5,288,143</td>
</tr>
<tr>
<td>UNIVAC</td>
<td>1951</td>
<td>$159,000</td>
<td>$1,576,527</td>
</tr>
<tr>
<td>PDP-1</td>
<td>1963</td>
<td>$120,000</td>
<td>$1,010,968</td>
</tr>
<tr>
<td>Commodore PET</td>
<td>1977</td>
<td>$795</td>
<td>$5,282</td>
</tr>
<tr>
<td>Apple II (4K RAM model)</td>
<td>1977</td>
<td>$1,298</td>
<td>$8,624</td>
</tr>
<tr>
<td>IBM PC</td>
<td>1981</td>
<td>$1,565</td>
<td>$4,438</td>
</tr>
<tr>
<td>Commodore 64</td>
<td>1982</td>
<td>$595</td>
<td>$1,589</td>
</tr>
</table>
This increase in affordability was also coupled with an increase in computatinal power. Consider the ENIAC, which computed at 100,000 cycles per second. In contrast, the relatively inexpensive Commodore 64 ran at 1,000,000 cycles per second, while the more pricy IBM PC ran 4,770,000 cycles per second.
Not surprisingly, governments, corporations, schools, and even individuals purchased computers in larger and larger quantities, and the demand for software to run on these platforms and meet these customers' needs likewise grew. Moreover, the sophistication expected from this software also grew. Edsger Dijkstra described it in these terms:
<blockquote>
The major cause of the software crisis is that the machines have become several orders of magnitude more powerful! To put it quite bluntly: as long as there were no machines, programming was no problem at all; when we had a few weak computers, programming became a mild problem, and now we have gigantic computers, programming has become an equally gigantic problem.
_Edsger Dijkstra, The Humble Programmer (EWD340), Communications of the ACM_
</blockquote>
Coupled with this rising demand for programs was a demand for skilled software developers, as reflected in the following table of graduation rates in programming-centric degrees (the dashed line represents the growth of _all_ bachelor degrees, not just computer-related ones):
![Annual Computer-Related Bachelor Degrees Awarded in the US]({{<static "images/1.1.2.1.png">}})
Unfortunately, this graduation rate often lagged far behind the demand for skilled graduates, and was marked by several periods of intense growth (the period from 1965 to 1985, 1995-2003, and the current surge beginning around 2010). During these surges, it was not uncommon to see students hired directly into the industry after only a course or two of learning programming (coding boot camps are a modern equivalent of this trend).
All of these trends contributed to what we now call the _Software Crisis_.
---
title: "The Software Crisis"
pre: "3. "
weight: 30
date: 2018-08-24T10:53:26-05:00
---
At the 1968 NATO Software Engineering Conference held in Garmisch Germany, the term "Software Crisis" was coined to describe the current state of the software development industry, where common problems included:
* Projects that ran over-budget
* Projects that ran over-time
* Software that made inefficient use of calculations and memory
* Software was of low quality
* Software that failed to meet the requirements it was developed to meet
* Projects that became unmanagable and code difficult to maintain
* Software that never finished development
The software development industry sought to counter these problems through a variety of efforts:
* The development of new programming languages with features intended to make it harder for programmers to make errors.
* The development of Integrated Development Environments (IDEs) with developer-centric tools to aid in the software development process, including syntax highlighting, interactive debuggers, and profiling tools
* The development of code repository tools like SVN and GIT
* The development and adoption of code documentation standards
* The development and adoption of program modeling languages like UML
* The use of automated testing frameworks and tools to verify expected functionality
* The adoption of software development practices that adopted ideas from other engineering disciplines
This course will seek to instill many of these ideas and approaches into your programming practice through adopting them in our everyday work. It is important to understand that unless these practices are used, the same problems that defined the software crisis continue to occur!
In fact, some software engineering experts suggest the software crisis isn't over, pointing to recent failures like the [Denver Airport Baggage System](http://calleam.com/WTPF/?page_id=2086) in 1995, the [Ariane 5 Rocket Explosion](http://www-users.math.umn.edu/~arnold//disasters/ariane.html) in 1996, the [German Toll Collect](https://www.dw.com/en/german-government-cancels-toll-contract/a-1116772-0) system cancelled in 2003, the rocky [healthcare.gov launch](https://en.wikipedia.org/wiki/HealthCare.gov#Issues_during_launch) in 2018, and the massive vulnerabilities known as the [Meltdown and Spectre exploits](https://meltdownattack.com/) discovered in 2018.
\ No newline at end of file
---
title: "Language Evolution"
pre: "4. "
weight: 40
date: 2018-08-24T10:53:26-05:00
---
One of the strategies that computer scientists employed to counter the software crisis was the development of new programing languages. These new languages would often 1) adopt new techniques intended to make errors harder to make while programming, and 2) remove problematic features that had existed in earlier languages.
## A Fortran Example
Let's take a look at a working (and in current use) program built using Fortran, one of the most popular programming languages at the onset of the software crisis. This software is the Environmental Policy Integrated Climate (EPIC) Model, created by researchers at Texas A&M:
<blockquote>
Environmental Policy Integrated Climate (EPIC) model is a cropping systems model that was developed to estimate soil productivity as affected by erosion as part of the Soil and Water Resources Conservation Act analysis for 1980, which revealed a significant need for improving technology for evaluating the impacts of soil erosion on soil productivity. EPIC simulates approximately eighty crops with one crop growth model using unique parameter values for each crop. It predicts effects of management decisions on soil, water, nutrient and pesticide movements, and their combined impact on soil loss, water quality, and crop yields for areas with homogeneous soils and management.
<a href="https://epicapex.tamu.edu/epic/">EPIC Homepage</a>
</blockquote>
You can download the [raw source code](https://my.syncplicity.com/share/qkybbapeauicx0l/epic1102_code%20032819) and the [accompanying documentation](https://agrilifecdn.tamu.edu/epicapex/files/2015/05/EpicModelDocumentation.pdf). Open and unzip the source code, and open a file at random using your favorite code editor. See if you can determine what it does, and how it fits into the overall application.
Try this with a few other files. What do you think of the organization? Would you be comfortable adding a new feature to this program?
## New Language Features
You probably found the Fortran code in the example difficult to wrap your mind around - and that's not surprising, as more recent languages have moved away from many of the practices employed in Fortran. Additionally, our computing environment has dramatically changed since this time.
### Symbol Character Limits
One clear example is symbol names for variables and procedures (functions) - notice that in the Fortran code they are typically short and cryptic: `RT`, `HU`, `IEVI`, `HUSE`, and `NFALL`, for example. You've been told since your first class that variable and function names should express clearly what the variable represents or a function does. Would `rainFall`, `dailyHeatUnits`, `cropLeafAreaIndexDevelopment`, `CalculateWaterAndNutrientUse()`, `CalculateConversionOfStandingDeadCropResidueToFlatResidue()` be easier to decipher? (Hint: the documentation contains some of the variable notations in a list starting on page 70, and some in-code documentation of global variables occurs in *MAIN_1102.f90*.).
Believe it or not, there was an actual _reason_ for short names in these early programs. A six character name would fit into a 36-bit register, allowing for fast dictionary lookups - accordingly, early version of FORTRAN enforced a limit of six characters for variable names[^namelength]. However, it is easy to replace a symbol name with an automatically generated symbol during compilation, allowing for _both_ fast lookup and human readability at a cost of some extra computation during compilation. This step is built into the compilation process of most current programming languages, allowing for arbitrary-length symbol names with no runtime performance penalty.
[^namelength]: Weishart, Conrad (2010). ["How Long Can a Data Name Be?"](https://www.idinews.com/history/nameLength.html)
### Structured Programming Paradigm
Another common change to programming languages was the removal of the `GOTO` statement, which allowed the program execution to jump to an arbitrary point in the code (much like a [choose-your-own adventure](https://en.wikipedia.org/wiki/Choose_Your_Own_Adventure) book will direct you to jump to a page). The GOTO came to be considered too primitive, and too easy for a programmer to misuse [^goto].
[^goto]: Dijkstra, Edgar (1968). ["Go To Statement Considered Harmful"](https://homepages.cwi.nl/~storm/teaching/reader/Dijkstra68.pdf)
However, the actual _functionality_ of a `GOTO` statement remains in higher-order programming languages, abstracted into control-flow structures like conditionals, loops, and switch statements. This is the basis of [structured programming](https://en.wikipedia.org/wiki/Structured_programming), a paradigm adopted by all modern higher-order programming langauges. Each of these control-flow structures can be represented by careful use of `GOTO` statements (and, in fact the resulting assembly code from compiling these langauges does just that). The benefit is using structured programming promotes "reliability, correctness, and organizational clarity" by clearly defining the circumstances and effects fo code jumps [^wirth1974].
[^wirth1974]: Wirth, Nicklaus (1974). ["On the Composition of Well-Structured Programs"](https://oberoncore.ru/_media/library/wirth_on_the_composition_of_well-structured_programs.pdf)
### Object-Orientation Paradigm
The object-orientation paradigm was similarly developed to make programming large projects easier and less error-prone. We'll examine just how it seeks to do so in the next few chapters. But before we do, you might want to see how language poularity has fared since the onset of the software crisis, and how new languages have appeared and grown in popularity in this animatated chart from _Data is Beautiful_:
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/Og847HVwRSI" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
Interestingly, the four top languages in 2019 (Python, JavaScript, Java, and C#) all adopt the object-oriented paradigm - though the exact details of how they implement it vary dramatically.
The term "Object Orientation" was coined by Alan Kay while he was a graduate student in the late 60's. Alan Kay, Dan Ingalls, Adele Goldberg, and others created the first object-oriented language, [Smalltalk](https://en.wikipedia.org/wiki/Smalltalk), which became a very influential language from which many ideas were borrowed. To Alan, the essential core of object-orientation was three properties a language could possess: [^Elliot2018]
* Encapsulation
* Message passing
* Dynamic binding
[^Elliot2018]: Eric Elliot, "The Forgotten History of Object-Oriented Programming," _Medium_, Oct. 31, 2018.
We'll take a look at each of these in the next few chapters.
\ No newline at end of file
---
title: "Summary"
pre: "5. "
weight: 50
date: 2018-08-24T10:53:26-05:00
---
In this chapter, we've discussed the environment in which object-orientation emerged. Early computers were limited in their computational power, and langauges and programming techniques had to work around these limitations. Similarly, these computers were very expensive, so their purchasers were very concerned about getting the largest possible return on thier investment. In the words of Niklaus Wirth:
<blockquote>
Tricks were necessary at this time, simply because machines were built with limitations imposed by a technology in its early development stage, and because even problems that would be termed "simple" nowadays could not be handled in a straightforward way. It was the programmers' very task to push computers to their limits by whatever means available.
</blockquote>
As computers became more powerful and less expensive, the demand for programs (and therefore programmers) grew faster than universities could train new programmers. Unskilled programmers, unweildy programming langauges, and programming approaches developed to address the problems of older technology led to what became known as the "software crisis" where many projects failed or floundered.
This led to the development of new programming techniques, languages, and paradigms to make the process of programming easier and less error-prone. Among the many new programming paradigms was _structured programming paradigm_, which introduced control-flow structures into programming langauges to help programmers reason about the order of program execution in a clear and consistent manner. Also developed during this time was the _object-oriented paradigm_, which we will be studying in this course.
\ No newline at end of file
+++
title = "Forward"
title = "Introduction"
date = 2018-08-24T10:53:05-05:00
weight = 0
weight = 01
chapter = true
pre = "<b>0. </b>"
+++
### Chapter 0
# Chapter Title Here
# Introduction
Chapter 0 tagline.
Setting the Stage
......@@ -4,8 +4,10 @@ pre: "1. "
weight: 1
date: 2018-08-24T10:53:26-05:00
---
A signature aspect of object-oriented languages is (as you might expect from the name), the existence of *objects* within the language. In this chapter, we take a deep look at objects, exploring why they were created, what they are at both a theoretical and practical level, and how they are used.
## Key Terms
Some key terms to learn in this chapter are:
......
---
title: "Encapsulation"
pre: "2. "
weight: 2
date: 2018-08-24T10:53:26-05:00
---
The first criteria that Alan Kay set for an object-oriented langauge was _encapsulation_. In computer science, the term encapsulation refers to organizing code into units, which provide two primary benefits:
* Providing a mechanism for organizing complex software
* The ability to control access to encapsulated data and functionality
Think back to the FORTRAN EPIC model we [introduced earlier]({{<ref "1-object-orientation/00-introduction/04-language-evolution">}}). All of the variables in that program were declared _globally_, and there were _thousands_. How easy was it to find where a variable was declared? Initialized? Used? Are you sure you found _all_ the spots it was used?
Also, how easy was it to determine what _part_ of the system a particular block of code belonged to? If I told you the program invovled modeling hydrology (how water moves through the soils), weather, erosion, plant growth, plant residue decoposition, soil chemistry, planting, harvesting, and chemical applications, would you be able to find the code for each of those processes?
Remember from our discussion on [the growth of computing]({{<ref "1-object-orientation/00-introduction/02-the-growth-of-computing">}}) the idea that as computers grew more powerful, we looked to use them in more powerful ways? The EPIC project grew from that desire - what if we could model _all the aspects influencing how well a crop grows_? Then we could use that to make better decisions in agriculture. Or, what if we could model the processes involved in weather? If we could do so, we could help save lives by predicting dangerous storms! A century ago, you knew a tornado was coming when you heard its roaring winds approaching your home. Now we have warnings that conditions are favorable to produce one hours in advance! This is all thanks to using computers to model some very complex systems.
But how do we go about writing those complex systems? I don't know about you, but I wouldn't want to write a model the way the EPIC programmers did. And neither did most software developers at the time - so computer scientists set out to define better ways to write programs. David Parnas formalized some of the best ideas emerging from those efforts in his 1975 paper "On the Criteria To Be Used in Decomposing Systems into Modules". [^Parnas1972]
[^Parnas1972]: D. L. Parnas, ["On the criteria to be used in decoposing systems into modules"](https://dl-acm-org.er.lib.k-state.edu/doi/10.1145/361598.361623) _Communications of the ACM_, Dec. 1972.