Skip to content

Commit

Permalink
improve notes
Browse files Browse the repository at this point in the history
  • Loading branch information
parrt committed Aug 12, 2017
1 parent 52dc36b commit caa8879
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 43 deletions.
109 changes: 66 additions & 43 deletions notes/coding.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"source": [
"# Introduction to Python coding\n",
"\n",
"*TODO*:Perhaps recognize to the students that I know they know the simple conditional and looping statements. The goal here is to get them retrained from birth so to speak to properly understand these operations in context. I'd like to show them how to think about these things. We never just decide to stick in another loop because we haven't done one in a while or randomly insert a conditional statement. Either here or somewhere else, we need to really stress the difference between atomic element assignment like numbers and assignment between references. Students had their minds blown in the linked list stuff later. Emphasize that functions can change lists that come in also.\n",
"\n",
"Now that we've studied a problem-solving process and learned the common programming patterns using pseudocode, it's finally time to express ourselves using actual Python programming language syntax. Keep in mind that, to implement any program, we should follow the problem-solving process and write things out in pseudocode first. Then, coding is a simple matter of translating pseudocode to Python.\n",
"\n",
"Let's review our computation model. Our basic raw ingredient is data (numbers or text strings) that lives on our disk typically (or SSDs nowadays). Note: we might have to go get that data with code; see MSAN692. The disk is very large but cannot serve up data fast enough for the processor, which is many orders of magnitude faster than the disk. Consequently, our first act in an analytics program is often to load some data from the disk into temporary memory. The memory is faster than the disk but smaller and disappears when the power goes off or your program terminates. The processor is still much faster than the memory but we have lots of tricks to increase the speed of communication between the processor and memory (e.g., caches).\n",
Expand Down Expand Up @@ -61,7 +63,9 @@
{
"cell_type": "code",
"execution_count": 35,
"metadata": {},
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -100,6 +104,7 @@
"cell_type": "code",
"execution_count": 36,
"metadata": {
"collapsed": false,
"scrolled": true
},
"outputs": [
Expand Down Expand Up @@ -133,7 +138,9 @@
{
"cell_type": "code",
"execution_count": 37,
"metadata": {},
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -193,7 +200,9 @@
{
"cell_type": "code",
"execution_count": 39,
"metadata": {},
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -228,7 +237,9 @@
{
"cell_type": "code",
"execution_count": 40,
"metadata": {},
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -267,7 +278,9 @@
{
"cell_type": "code",
"execution_count": 41,
"metadata": {},
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -367,7 +380,9 @@
{
"cell_type": "code",
"execution_count": 44,
"metadata": {},
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -397,7 +412,9 @@
{
"cell_type": "code",
"execution_count": 45,
"metadata": {},
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
Expand All @@ -424,7 +441,9 @@
{
"cell_type": "code",
"execution_count": 46,
"metadata": {},
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -473,29 +492,6 @@
"Python tutor illustrates [this](https://goo.gl/BSMY6y) nicely:"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<iframe width=\"700\" height=\"320\" frameborder=\"0\" src=\"http://pythontutor.com/iframe-embed.html#code=courses%20%3D%20%5B%0A%20%20%20%20%5B'msan501',%2051%5D,%0A%20%20%20%20%5B'msan502',%2032%5D,%0A%20%20%20%20%5B'msan692',%20101%5D%0A%5D%0Amycourses%20%3D%20courses&codeDivHeight=400&codeDivWidth=350&cumulative=false&curInstr=4&heapPrimitives=false&origin=opt-frontend.js&py=2&rawInputLstJSON=%5B%5D&textReferences=false\"></iframe>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"But\n",
"<iframe width=\"700\" height=\"320\" frameborder=\"0\" src=\"http://pythontutor.com/iframe-embed.html#code=courses%20%3D%20%5B%0A%20%20%20%20%5B'msan501',%2051%5D,%0A%20%20%20%20%5B'msan502',%2032%5D,%0A%20%20%20%20%5B'msan692',%20101%5D%0A%5D%0Amycourses%20%3D%20courses&codeDivHeight=400&codeDivWidth=350&cumulative=false&curInstr=4&heapPrimitives=false&origin=opt-frontend.js&py=2&rawInputLstJSON=%5B%5D&textReferences=false\"></iframe>"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -534,7 +530,9 @@
{
"cell_type": "code",
"execution_count": 49,
"metadata": {},
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
Expand All @@ -560,7 +558,9 @@
{
"cell_type": "code",
"execution_count": 50,
"metadata": {},
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -614,7 +614,9 @@
{
"cell_type": "code",
"execution_count": 51,
"metadata": {},
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -657,6 +659,7 @@
"cell_type": "code",
"execution_count": 52,
"metadata": {
"collapsed": false,
"scrolled": true
},
"outputs": [
Expand All @@ -679,7 +682,9 @@
{
"cell_type": "code",
"execution_count": 53,
"metadata": {},
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -727,7 +732,9 @@
{
"cell_type": "code",
"execution_count": 54,
"metadata": {},
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -770,7 +777,9 @@
{
"cell_type": "code",
"execution_count": 59,
"metadata": {},
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -798,7 +807,9 @@
{
"cell_type": "code",
"execution_count": 55,
"metadata": {},
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -838,6 +849,7 @@
"cell_type": "code",
"execution_count": 61,
"metadata": {
"collapsed": false,
"scrolled": true
},
"outputs": [
Expand Down Expand Up @@ -871,7 +883,9 @@
{
"cell_type": "code",
"execution_count": 62,
"metadata": {},
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -900,6 +914,7 @@
"cell_type": "code",
"execution_count": 58,
"metadata": {
"collapsed": false,
"scrolled": true
},
"outputs": [
Expand Down Expand Up @@ -932,7 +947,9 @@
{
"cell_type": "code",
"execution_count": 27,
"metadata": {},
"metadata": {
"collapsed": false
},
"outputs": [
{
"ename": "NameError",
Expand Down Expand Up @@ -978,7 +995,9 @@
{
"cell_type": "code",
"execution_count": 29,
"metadata": {},
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
Expand All @@ -1004,7 +1023,9 @@
{
"cell_type": "code",
"execution_count": 30,
"metadata": {},
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
Expand All @@ -1028,7 +1049,9 @@
{
"cell_type": "code",
"execution_count": 31,
"metadata": {},
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
Expand Down
2 changes: 2 additions & 0 deletions notes/planning.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Program planning

*TODO*: This seemed to be sort of vague and wishy-washy. Some more-complicated examples to motivate the use of the work plan is probably in order. even without code it's useful to show a complicated problem and how it fits the program outline. Consider merging program and functional work plan discussions. perhaps some actual code here? hmm...maybe not.

A program is a sequence of operations that transforms data or performs computations that ultimately lead to the expected output. *Programming* is the act of designing programs: identifying the operations and their appropriate sequence. In other words, programming is about coming up with a work plan intended for a computer, which we'll describe in semi-precise English called *pseudocode*. *Coding* is the act of translating such high-level pseudocode to programming language syntax. We'll worry about the actual [coding](coding.md) part later, after we learn how to design programs.

At this point, we have an excellent foundation to start building programs because we have an [overall problem-solving strategy](programming.md):

Expand Down

0 comments on commit caa8879

Please sign in to comment.