0% found this document useful (0 votes)
66 views44 pages

CSC 201

The document outlines the schedule and topics to be covered in a computer science course, including an introduction to programming concepts like algorithms, the software development lifecycle, and chapters on problem solving, implementation, and maintenance. It also discusses using C++ and an IDE called CodeBlock. Interactive elements like CodeLabs, CodeBlocks, hands-on exercises, and Q&A sessions will help students learn programming concepts and the C++ language.

Uploaded by

Ifeanyi Progress
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
66 views44 pages

CSC 201

The document outlines the schedule and topics to be covered in a computer science course, including an introduction to programming concepts like algorithms, the software development lifecycle, and chapters on problem solving, implementation, and maintenance. It also discusses using C++ and an IDE called CodeBlock. Interactive elements like CodeLabs, CodeBlocks, hands-on exercises, and Q&A sessions will help students learn programming concepts and the C++ language.

Uploaded by

Ifeanyi Progress
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 44

Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

CSC-201 - Computer Science I


Lecture #1: Introduction and Overview
Chapters 1 and 2

Dr. Chuck Cartledge

August 29, 2016 at 9:33am

1/44
Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

Table of contents I
1 Schedule

2 Overview 8 Q&A

3 Chapters 1 & 2 9 Conclusion

4 Break 10 References

5 CodeLab 11 Files

6 CodeBlock 12 Vita

7 Hands on

2/44
Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

Schedule for the semester

Wk. Date Topic Wk. Date Topic


1 08/22 Chap 1 – 2 9 10/17 Chap 10
2 08/29 Chap 3 – 4 10 10/31 Chap 10 – 11
3 09/05 Chap 5 11 10/31 Chap 10 – 11
4 09/12 Test – Chap 6 12 11/07 Test– Chap 14
5 09/19 Chap 7 13 11/14 Chap 14
6 09/26 Chap 8 14 11/28 Chap 18
7 10/03 Chap 9 15 12/05 Chap 18
8 10/10 Test – Chap 10 16 12/12 Exam

3/44
Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

Why are we here?

Some reasons are obvious, others not so much

1 The course is a requirement


2 The language is common
3 The language has interesting
features
4 Understanding the language
helps with other languages

4/44
Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

Why are we here?

Same image.

5/44
Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

Why are we here?

Computer languages are not static.

Languages are created and evolve


to meet new needs.
Languages have some underlying
common factors, because they all
run on computers.

Image from [1].

http://www.extremetech.com/computing/91572-the-
evolution-of-computer-languages-infographic

6/44
Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

Why are we here?

Comparing various known languages

Each language is reflection of the


current state of the art in solving
a particular type of problem.
You can expect to learn and use
many different languages over
the course of your career, and
supporting different programming
paradigms,
http://hyperpolyglot.org/

Use Hyperployglot.org as a language cross reference.

7/44
Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

Why are we here?

Hammer and nails . . .

“. . . it is tempting,
if the only tool you
have is a hammer, to
treat everything as if it
were a nail.”
Abraham H. Maslow [4]

Image from [9].

8/44
Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

Why are we here?

Socratic method (part of your grade).

The Socratic
method includes the
use of systematic
questioning, inductive
reasoning, universal
definitions, and a
disavowal of knowledge.
James C. Overholser [5]

Figure: “Just one more question.


...”

9/44
Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

Chapter 1

What is computer programming?

Computer programming is
creating a series of steps for a
computer to execute to achieve a
result.

Image from [8].

Computers are really, really stupid; but fast.


10/44
Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

Chapter 1

An algorithm is a series of language agnostic steps

Algorithms say what needs to get


done, not how.
Algorithms can be time, or
memory efficient. Good ones are
both.

Image from [2].

Start with easy algorithms first.


11/44
Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

Chapter 1

How does a computer “run” a program?

There are lots of steps in the language (source code)


process: 5 A compiler translates the
1 A human has to source code into object
understand the problem code
2 A human selects the 6 The computer loads the
appropriate algorithm object code
3 A human selects the 7 The computer starts
appropriate language program execution at a
4 A human writes the “well known” spot in the
necessary steps in the object code

Only the last two steps are fast.


12/44
Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

Chapter 1

What we’ll do:

1 We’ll address a problem


2 We’ll may, or may not use an algorithm
3 We’ll use C++
4 We’ll use the CodeBlock IDE to edit, compile, and run our
program
5 We’ll learn new parts of the language

13/44
Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

Chapter 1

Software development life cycle (SDLC)

There are many different SDLC


models.
For our purposes, we’ll focus on:
1 Problem solving
(requirements and design)
2 Implementation
(construction and
verification)
3 Maintenance
Image from [3].

All models have these phases.


14/44
Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

Chapter 1

Problem solving phase[6]

Conceptualization and design


Analyze the problem and specify what the solution must do
Develop an algorithm to solve the problem
Verify that your solution really solves the problem

15/44
Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

Chapter 1

Implementation phase

Testing your program to see if it produces correct results


Debugging your program to identify and correct errors

16/44
Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

Chapter 1

Maintenance

Use and modify the program to meet changing requirements


or correct errors that show up in using it
Maintenance begins when your program is put into use and
accounts for the majority of effort on most programs
Wholly rewriting program with a clear design sometimes a
useful alternative to modifying the existing program to meet
changing requirements

17/44
Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

Chapter 1

First captured computer bug - 1945

Relay switches are part of


early (and some current)
computers
Grace Hopper found a moth
stuck between the relay
contacts
Bug was removed from the
computer and the program
worked
Image from [10].

18/44
Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

Chapter 1

Whats inside a computer?

Things that are common to all digital computers:


A way to input and output
data
A central processing unit
(CPU)
Memory (volatile and
non-volatile)
A language the CPU
understands
The language is composed
of binary values Topics of CSC-205 and CSC-215.

Other computer types have similar components.


19/44
Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

Chapter 2

Elements of C++ programs


Every program must have a main
function that returns an integer.
Every identifier is composed of
letters, numbers, or underscores,
and must start with a letter or
underscore.
Identifiers are case sensitive
Open and closing curly braces
define a context, and may be
nested.
There are a limited number of
built-in data types.
Assignments to identifiers are
identifier = expression; 20/44
Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

Chapter 2

Examples of variable assignments

a = 3;
int a = 3;
const int a = 3;
name = "Samatha";
string name = "Samantha";
const string name = "Samantha";
fullName = name + " Bee";
f = &main;
c = (*f)();

The last two are more advanced.

21/44
Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

Chapter 2

How to get values in and out


C++ requires a preprocessor directive to include the ability to
input and output values.

#include<iostream>

Once we include the directive, we can output values:

std::cout << ’’Hello world.’’ << std::endl;


std::cout << thisIsA_variable << anotherVariable << std::en

And we can input values into variables:

std::cin >> anInt;


std::cin >> aString;

The “std::” refers to a namespace. We’ll talk about that later.


22/44
Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

Chapter 2

Built-in data types.

All other types are user-defined


and brought in via preprocessor
directives.
signed is default, unsigned
must be specified
short is at least 16 bits wide
long is at least 32 bits
long long is at least 64 bits

Image from [7].

23/44
Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

Chapter 2

Same image.

Image from [7].


24/44
Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

Chapter 2

Additional data refinements

The choices made by each implementation about the sizes of the


fundamental types are collectively known as data model. Four data
models found wide acceptance:
32 bit systems:
LP32 or 2/4/4 (int is 16-bit, long and pointer are 32-bit)
(Win16 API)
ILP32 or 4/4/4 (int, long, and pointer are 32-bit) (Win32 API,
Unix and Unix-like systems)
64 bit systems:
LLP64 or 4/4/8 (int and long are 32-bit, pointer is 64-bit)
(Win64 API)
LP64 or 4/8/8 (int is 32-bit, long and pointer are 64-bit)
(Unix and Unix-like systems)

25/44
Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

Break time.

Take about 10 minutes.

26/44
Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

CodeLab main screen

Is available via the Internet.


Password is: TIDEWA-8886-0

https:
//codelab3.turingscraft.com/codelab/jsp/login1.jsp

27/44
Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

Same image.

https:
//codelab3.turingscraft.com/codelab/jsp/login1.jsp 28/44
Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

CodeBlock main screen

Should be installed on everyone’s


machine.

29/44
Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

Same image.

30/44
Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

Open a file for editing

We will be using standalone files.


Not projects.
Most files will be attached to a
presentation.

31/44
Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

Same image.

32/44
Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

A file will appear in a tab

Most of our coding and


exploration will be using only a
few files.

33/44
Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

Same image.

34/44
Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

Compile and run a file with F9

Feed back from the compiler will


appear in the “Build messages”
tab

35/44
Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

Same image.

36/44
Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

Practice exercises

Programs to load into CodeBlocks and get running:


1 firstone.cpp
2 error.cpp
3 leapYear.cpp
4 dinner.cpp
5 greet.cpp
Others, if you have time.

37/44
Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

Q & A time.

“’The Answer to the Great


Question . . . Of Life, the Universe
and Everything . . . is
. . . forty-two,’ said Deep
Thought, with infinite majesty
and calm.”
Douglas Adams, The
Hitchhiker’s Guide to the
Galaxy

38/44
Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

What have we covered?

Why are we here.


Where we’re going.
How we’ll get there.
Basic ideas of computer
programming.
Hands on programming with
CodeLab and CodeBlock.

Next time Chapters 3 & 4.

39/44
Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

References I

[1] Sebastian Anthony, The evolution of computer languages


(infographic),
http://www.extremetech.com/computing/91572-the-
evolution-of-computer-languages-infographic, 2011.
[2] Owen Astrachan, Bubble sort: an archaeological algorithmic
analysis, ACM SIGCSE Bulletin, vol. 35, ACM, 2003, pp. 1–5.
[3] Eric Johnson, Secure software development lifecycle overview,
https:
//software-security.sans.org/blog/2015/04/07/
secure-software-development-lifecycle-overview,
2015.
[4] Abraham H. Maslow, The psychology of science, Henry
Regency, 1966.
40/44
Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

References II

[5] James C. Overholser, Elements of the socratic method: V.


self-improvement, Psychotherapy: Theory, Research, Practice,
Training 33 (1996), no. 4, 549.
[6] Sylvia Sorkin, Programming and problem solving with c++,
Teacher Resource Jones and Barlett Learning, 2014.
[7] C++ Staff, Fundamental types,
http://en.cppreference.com/w/cpp/language/types,
2016.
[8] Derivativesinvesting Staff, Qc 7 tools,
http://www.derivativesinvesting.net/article/
277260716/qc-7-tools/, 2016.

41/44
Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

References III

[9] Happiness Staff, Abraham maslow,


http://www.pursuit-of-happiness.org/history-of-
happiness/abraham-maslow/, 2016.
[10] Wikipedia Staff, Grace hopper,
https://en.wikipedia.org/wiki/Grace_Hopper, 2016.

42/44
Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

Files of interest

1 area.cpp 9 leapYear.cpp

2 chessboard.cpp 10 rain.cpp

3 dinner2.cpp
11 rain.in
4 dinner.cpp
12 rhyme.cpp
5 error.cpp
13 shell.cpp
6 firstone.cpp

7 greet2.cpp
14 wrap.cpp

8 greet.cpp 15 ProgramCourseGuide 880-01.pdf

43/44
Schedule Overview Chapters 1 & 2 Break CodeLab CodeBlock Hands on Q & A Conclusion References Files Vita

Who am I?

Father
Husband
PhD, Computer Science, 2014
CAPT, USN retired 2004 (31+
years)
A perennial student
1st computer: 1970, donated ICBM
guidance computer, machine code,
paper/mylar tape, and drum
memory
Interests: autonomic systems, real–time applications, distributed
processing, long-term preservation of digital data, Big Data
44/44

You might also like