itec 320
DESCRIPTION
ITEC 320. Procedural Programming Dr. Ray Lecture 1. Outline. Welcome Intro to the course Ada – first steps. Syllabus. R Lectures / Interactive demonstrations Office Hours 2:00-3:00 P M MTWF Saturday 7:00-8:00PM or Sun. 3:00-4:00 Website www.radford.edu / aaray => ITEC 320 - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: ITEC 320](https://reader035.vdocuments.net/reader035/viewer/2022062520/56815c7d550346895dca9068/html5/thumbnails/1.jpg)
ITEC 320
Procedural ProgrammingDr. Ray
Lecture 1
![Page 2: ITEC 320](https://reader035.vdocuments.net/reader035/viewer/2022062520/56815c7d550346895dca9068/html5/thumbnails/2.jpg)
Introduction
Outline
• Welcome• Intro to the course• Ada – first steps
![Page 3: ITEC 320](https://reader035.vdocuments.net/reader035/viewer/2022062520/56815c7d550346895dca9068/html5/thumbnails/3.jpg)
Introduction
Syllabus
• R Lectures / Interactive demonstrations• Office Hours 2:00-3:00 PM MTWF– Saturday 7:00-8:00PM or Sun. 3:00-4:00
• Website– www.radford.edu/aaray => ITEC 320
• D2L for submission• Projects• Homework• Exams
![Page 4: ITEC 320](https://reader035.vdocuments.net/reader035/viewer/2022062520/56815c7d550346895dca9068/html5/thumbnails/4.jpg)
Introduction
Introduction
• On a scale of 1 to 10, how interested are you in learning a different language?
• How many lines of code did you write for the largest program you’ve worked on?
• What do you want to learn in this course?
• Share with your neighbor• Introduce yourselves and answers to
the class
![Page 5: ITEC 320](https://reader035.vdocuments.net/reader035/viewer/2022062520/56815c7d550346895dca9068/html5/thumbnails/5.jpg)
Introduction
Languages
• What advantages are there to learning a new computer language?
• What are the some of the reasons for learning a new language?
• Why is this important?– Objective C example
![Page 6: ITEC 320](https://reader035.vdocuments.net/reader035/viewer/2022062520/56815c7d550346895dca9068/html5/thumbnails/6.jpg)
Introduction
1970s
• The era of…• Multiple languages used at the
DOD…• What are some of the problems with
using multiple languages?• What happens when you use multiple
languages for one project?
![Page 7: ITEC 320](https://reader035.vdocuments.net/reader035/viewer/2022062520/56815c7d550346895dca9068/html5/thumbnails/7.jpg)
Introduction
Solution
• Design competition
![Page 8: ITEC 320](https://reader035.vdocuments.net/reader035/viewer/2022062520/56815c7d550346895dca9068/html5/thumbnails/8.jpg)
Introduction
Result
• Procedural / OO mixed language• Multi-threaded / generics• Reliability and maintenance• Readability over writability
$line =~ /.{28}(\d\d)-(\d\d)-(\d\d).{8}(.+)$/
![Page 9: ITEC 320](https://reader035.vdocuments.net/reader035/viewer/2022062520/56815c7d550346895dca9068/html5/thumbnails/9.jpg)
Introduction
Differences
Java
Ada
public class HelloWorld{
public static void main(String[] args){
int x;x=3;System.out.println(x);
}}
with ada.text_io;with ada.integer_text_io;procedure hello1 is x: Integer;begin x := 3; ada.text_io.put_line("Hello World"); ada.integer_text_io.put(x);end hello1;
![Page 10: ITEC 320](https://reader035.vdocuments.net/reader035/viewer/2022062520/56815c7d550346895dca9068/html5/thumbnails/10.jpg)
Introduction
First impressions
• What are your thoughts on what you just saw?
with ada.text_io;with ada.integer_text_io;procedure hello1 is x: Integer;begin x := 3; ada.text_io.put_line("Hello World"); ada.integer_text_io.put(x);end hello1;
![Page 11: ITEC 320](https://reader035.vdocuments.net/reader035/viewer/2022062520/56815c7d550346895dca9068/html5/thumbnails/11.jpg)
Introduction
How to make it work
• Write / Compile / Execute cycle• Editors– vi filename.adb
• Compiler– gnatmake filename
• Execution– filename or ./filename (Mac)
![Page 12: ITEC 320](https://reader035.vdocuments.net/reader035/viewer/2022062520/56815c7d550346895dca9068/html5/thumbnails/12.jpg)
Introduction
Types
• Why is it important to know what type of variable it is that you are using?
• What are the different types of variables you are familiar with?
![Page 13: ITEC 320](https://reader035.vdocuments.net/reader035/viewer/2022062520/56815c7d550346895dca9068/html5/thumbnails/13.jpg)
Introduction
Information
• Largest and smallest numbers possible• Integer add
– ‘first;– ‘last;– ‘range;
• Character– ‘val(65);– ‘pos(‘A’);
• Boolean– Boolean’val(0);– Boolean’pos(true);
![Page 14: ITEC 320](https://reader035.vdocuments.net/reader035/viewer/2022062520/56815c7d550346895dca9068/html5/thumbnails/14.jpg)
Introduction
Extra types
• Natural– 0 to Integer’Last --Biggest integer
• Positive– 1 to Integer’Last
• Chance– 0.0 to 1.0 --Constrained float
![Page 15: ITEC 320](https://reader035.vdocuments.net/reader035/viewer/2022062520/56815c7d550346895dca9068/html5/thumbnails/15.jpg)
Introduction
More types
• Character (8 bit)• Wide_Character (16 bit)• Wide_Wide_Character (32 bit)• Strings– Arrays of characters– Fixed length– 3 types (more later)
![Page 16: ITEC 320](https://reader035.vdocuments.net/reader035/viewer/2022062520/56815c7d550346895dca9068/html5/thumbnails/16.jpg)
Introduction
Conversion
• Anything to String
• String to Integer
• Character conversions
intVar’imgintVar’image
Integer’val(“12”);Integer’value(“123”);
Character’val(65);Character’pos(‘A’);
![Page 17: ITEC 320](https://reader035.vdocuments.net/reader035/viewer/2022062520/56815c7d550346895dca9068/html5/thumbnails/17.jpg)
Introduction
Output
• Convert non-strings to strings– Combine strings with the &
• Output and stay on same line– put( );
• Output and goto next line– put_line( );
• Enter key– new_line;
![Page 18: ITEC 320](https://reader035.vdocuments.net/reader035/viewer/2022062520/56815c7d550346895dca9068/html5/thumbnails/18.jpg)
Introduction
Formatting Output
• width–minimum width
• fore–Minimum number of places before
decimal• aft– Number of places after decimal
• exp–Minimum number of places for the
exponent
put(var, width=>2);
![Page 19: ITEC 320](https://reader035.vdocuments.net/reader035/viewer/2022062520/56815c7d550346895dca9068/html5/thumbnails/19.jpg)
Introduction
Type checking
• Both sides of assignments must match
• Operands of arithmetic operators must match
• Must do it all manually– In Java, int’s will be converted to floats
• Extends to output– System.out.println how we will miss thee– ada.integer_text_io.put(3);– ada.text_io.put(“Lots of typing”);
![Page 20: ITEC 320](https://reader035.vdocuments.net/reader035/viewer/2022062520/56815c7d550346895dca9068/html5/thumbnails/20.jpg)
Introduction
Summary
• Short day• History of ADA• Basics of the language• Introductory comparison of the
languages