When writing a program, we often need to store the value of some important concept used in our program, such as the value resulting from an intermediate computation. A variable is a concept in programming languages that allows us to associate a value with a symbolic name that can be used at different places in our program. There are specific rules for naming a variable, as mentioned on slide 2. It is important to assign the name of a variable as something that the variable represents. We often name our variables starting with a lower case letter. Sometimes, the best name may be more than one word, as in currentTaxYear or birthDate. In such cases, it is a convention to use what is called Camel Case, where the additional word is capitalized. These are just suggested conventions and not really the rules of Snap!
Try solving the exercise on slide 4 ("Variables" video) on your own, without looking at the answer on the later slides. The presentation offers two solutions to the "swap" concept. Do you understand these?
The last slide of the "Variables" video introduces the concept of a data type. It is helpful at times to know what values a particular variable can represent, such as numbers, strings, or other types of values. We will talk more about data types in a future lesson in this unit as it relates to creating our own blocks and being able to pass in values to those blocks.
The video below that will show you how to create variables in Snap!, including a solution to the swap exercise presented on slide 4.
Monday, September 22, 2014
9/22/15 - Snap! Core Programming Structures
Lesson Objectives
This lesson introduces the three core structures that can be found in programming languages: sequence, decision/conditional (if), and iteration (loops) constructs. An important concept in conditional and iteration statements is that of a Boolean expression. The lesson will introduce comparison (relational) and Boolean (logical) operators that can be composed to express statements that are evaluated to true or false. The ability to express Boolean expressions is core to the test conditions of decision and iteration statements. Programs also need to store values as they perform a computation. The ability to declare variables, and the notion of data types, are also discussed in this lesson. You are encouraged to type in all of the examples in the slides/presentations/videos yourself in Snap! and try to get them to work. Overall, this lesson will take much more time to complete than past lessons if you decide to follow along and try out all of the programs on your own. Those who have taught computer science before will likely find these lessons as fundamental, but the context of presentation within Snap! may be offer new ideas.
Class Exercise - Decision Structure - grade converter from video
Compose the solution using if/then and boolean expressions
Tuesday, September 16, 2014
Lesson Plans Comp 2 and 3 9/16/14
Today you will work on the 1st 2 sections of the Computer Science programming piece.
1. Understand what software engineering is and why it is important to thoughtfully plan out you program before coding it.
2. Get acquainted with Snap! and code a small program or two.
Introduction to Networking
Download the newest version of packet tracer and get it running on your Mac. I have found that wine wrap has been the most stable. Work with each other to figure it out.
Recap last weeks work -
Terms:
End Device
Intermediary Device
Networking Media
Encoding
Clients and Servers
Peer to Peer
Physical Topology
Logical Topology
Chapter 1 Objectives:
Continue to read Chapter 1 starting with 1.2.2.1 and take notes
Lab 1.2.3.3 Converged Networks
Pay attention to Internet, Intranet and Extranet
Cont. to read 1.2.4 (Connecting to the Internet) and do the packet tracer exercise
1.3 (Converged Networks) and the Lab
1.4 The Changing Network Environment
It is OK if you decide that you would like to spend more time on the programming piece today.
You may spend some time creating a proposal for the middle school Hour of Code.
Section 2 - Snap! Overview
Snap! Overview
Lesson Objectives
Before learning about some of the general constructs used in programming that are covered in the rest of Unit 3, this lesson provides a general overview of the Snap! environment. You will create two short programs, and learn how to store your own programs in several different ways. The lesson is composed of a short video that you are encouraged to follow as you build your own similar programs and become comfortable with the Snap! browser-based environment. There are many things that will not be covered in this lesson. In fact, the entire unit will not cover every concept in Snap!. Our goal is to provide you with a set of experiences that allow you to understand some of the core ideas in programming, such that you have the confidence to then explore more on your own.
When learning a new foreign language, I have observed that it is easier to read in that language than to write in the same language. It seems that understanding something already provided is easier than synthesizing something new on your own. It takes practice to be able to write new expressions in a foreign language. I have found the same to be true in learning how to program. It is often the case that students can understand a program that is given to them much better than they can actually produce that same program on their own. The potential trap is to think that some proficiency in reading and understanding a program is the same as creating a new program on your own. In the same way that it takes practice to be able to write and speak in a new foreign language, you must practice and go through some hands-on activities in order to grasp the skill of programming on your own. It will be very tempting to look at a program provided to you, understand it, and think that you could produce that yourself. We encourage you instead to get involved with the coding activities that will be suggested in this unit that are designed to give you more practice in developing your programming skills, which will assist you in teaching your own future students about programming.
Lesson Tasks
Please work on the following during your exploration of this lesson:
Visit the Snap! website and look around at some of the information provided by the Snap! team. A gentle warning - there is a Snap! reference manual available. However, we suggest that you wait until the end of this unit before you try to read the manual. The Snap! manual has several advanced concepts that are discussed very early in the manual. The manual may be more accessible to those who already teach computer science, but the reference manual may be challenging to understand at first for a new CS Principles teacher who has never programmed before.
Watch the video linked below. There are no slides for this lesson. A suggestion is to first watch the video, and then come back to the subsequent steps below to review the video and try some hands-on activities.
Go to the URL that actually runs Snap! in the browser: http://snap.berkeley.edu/run. Be adventurous and explore around - you won't break anything important at this stage! Look at the different categories in the palette area, and how new blocks emerge when you click on each category. Can you guess what some of the blocks might do? Can you summarize in your own words what some of the categories represent as a theme? For example, what is the core theme of the blocks in the Motion category?
Try duplicating the "Hello World" program that is introduced at the first minute mark of the video. Pause the video in one tab of your browser, and try to duplicate what is being done in your own Snap! environment. Try to run your program by clicking on the green flag.
Explore the various ways that you can save this program. First, export the program as an XML on your desktop. Can you see where the file was then added to the Desktop? Try to then create a New project in Snap! that is empty, and then see what happens if you then import your saved program back into Snap! This file is not intended to be read by humans, but just an internal representation of your program that Snap! can read and write. The XML format (Extensible Markup Language) is a very important standard for sharing information, and is used by Snap! as a representation for storing your program.
Click on the cloud button at the top of the Snap! screen. You may want to try to create your own account by signing up (there is a sign-up button that you can click, which will generate an email to you with account information). This is not necessary now, but will be useful later.
Create a new project in Snap! (the "New" option in the file icon at the top of the screen). Then, try to create the square drawing program on your own that is introduced in the second half of the video. In particular, experiment with the "duplicate" block option that is shown in the video as a way to save time in dragging and dropping blocks (time 5:20 in the video). Were you able to get the ability to ask the user for the size of each side? Do you see how more general that makes your program, rather than drawing a square of the same size each time? We will come back to this idea in a future lesson in this unit.
Congratulations - some of you who may have never programmed before just created your first two (albeit very simple!) programs!
Please note: If the video below appears blurry, please allow time for the full resolution to download as a stream. You may also want to try viewing all of the Snap! screencasts that are in this unit in Full Screen mode, or in a separate browser tab.
Watch the video below!!!
https://www.youtube.com/watch?v=jFs3pn7zzoc
Section 1 - programming design
CS Programming:
Interesting video on what a software engineer does and the software development process.
Lesson Objectives
There is often the tendency to want to rush into software development by going straight to programming without giving much thought to the requirements and design of their program. Although this may be tempting for smaller programs, this is not the best practice for creating quality software. In this lesson, we first consider an overview of several basic concepts (e.g., hardware, software, memory and storage, and programming languages) and then cover the various phases traditionally performed in software development. Particular emphasis is made on the need for planning, with several examples of disasters (some related to software, and some from other domains) resulting from poor planning before implementation. The rest of this unit is focused on programming, but it is important for you to understand that it is not wise to jump into coding without some forethought.
Lesson Tasks
1. Watch this video. It is geared towards the instructor, but Prof. Gray talks about what programs and software languages are, how your computers processes them and the importance of planning.
2. Software development has often been described as a mixture of art and engineering. This lesson focuses on the engineering of software and the need to plan and design a program before implementing it in code. The compelling reason that is given in this lesson is the potential hazards resulting from software failure, such as the Ariane 5 disaster cited in the slides. The somewhat surprising (or maybe not!) reality is that software fails often, and in various degrees of calamity. To demonstrate the ever present failures of software, a VERY STRONG suggestion is to look over the Risks to the Public that are compiled by Peter Neumann. Similar to the ACM TechNews, this compiled weekly list of software errors could be a topic for current events discussion. For example, this lesson is assigned during the voting season for Primary elections - there is a topic from June 6th related to the problems associated with fraud in online voting.
Take a look at the current entries. Which article caught you attention?
3. Review the 5 phases of software design and compare to the version presented in the video.
http://en.wikibooks.org/wiki/Introduction_to_Software_Engineering/Process/Life_Cycle
Have you used a similar process when creating other projects?
I do something very similar when designing a woodworking project.\:
What are my bench requirements (size, weight load, style)
Design the bench
Build it
Does it do what I wanted it to
Tweak
Does it meet my requirements?
4. Huge failures is design:
Tacoma Bridge and video You may have seen this physics
Ariane 5 and video
5. Related to the above idea of the types of errors associated with a program, make sure that you understand the difference between the syntax of a language and its semantics. Regarding syntax, a compiler parses a program to make sure that the program conforms to the correct rules of a programming language. For the purpose of this course, the parsing of a program can be likened to the activity of diagramming sentences in an English class - the compiler must be able to determine that the program conforms to the grammar of the language. The semantics of the language refers to the specific meaning ascribed to the language operators and constructs. A program may be syntactically correct, but semantically wrong, which can lead to a logic error.
What type of error was the Ariane 5?
6. Of the development steps presented in the video, which step do you think takes the longest?
Subscribe to:
Posts (Atom)