Software Programming J. Holvikivi 2014
Basic principle of how a computer works INPUT OUTPUT Information Data PROCESS
What Can Computers Do? Input/Output operations Reads input Writes output Processing operations Math (computation) Decision making (logic) Photo courtesy of Imation Corporation
What Happens Inside Control flow Data flow Instruction flow Control Unit Arithmetic Logic Unit Data flow Instruction flow Input Unit Output Unit Main memory
ALU Arithmetic and Logic Unit Arithmetic and Logic Unit performs all computations and logical operations 2 + 2 = 4 1 AND 0 is NOT TRUE 2 + 2 < 5
Machine instructions Adding values stored in memory Step 1: Get the value from memory location 6C and place it in a register. =LOAD Step 2: Get the other value to be added from memory location 6D and place it in another register. =LOAD Step 3: Activate the addition circuitry with the registers used in steps 1 and 2 as inputs with another register designated to store the result. =ADD Step 4: Store the result in memory location 6E. =STORE Step 5: Stop. =HALT others: MOVE, OR, AND, ROTATE, JUMP
Machine language Code: Step 1: 156C LOAD Step 2: 166D LOAD Step 3: 5056 ADD Step 4: 306E STORE Step 5: C000 HALT
Working with a file Memory: RAM Hard disk Processor Save Device drivers Windows OS Text file MS Word Load to memory MsWord Device drivers and others Text file OS kernel Save Data files Processor
Software System software Application software office programs Operating system GUI Utilities Device drivers networking software Application software office programs graphical software browsers 15.11.2018 Jaana Holvikivi
Programming Languages Machine Language: 56FC Assembler (mnemonic): ADD Procedural Languages Fortran, Pascal, Python Cobol, BASIC Object-Oriented Languages C ++ Java, C#
Programming Languages Functional languages Prolog, XSLT, Haskell Scripting languages Javascript, php Application development tools .NET Framework Oracle UML tools Natural Languages – not yet
Algorithm A sequence of steps that directs the execution of a task A sheet of music operating instructions for a washing machine instructions for constructing model airplanes Algorithms in computers programs the intelligence required to solve a problem or to perform a task is encoded in the algorithm to follow the directions of an algorithm is "merely mechanical"
Program design Start Problem solving Algorithm flow chart pseudo code Source code Compiler Interpreter Executable program in machine language Instructions in machine language End
Programming language features Data types Constants Variables Expressions Operators Statements: conditional, loops Functions Objects Methods Events 15.11.2018 Jaana Holvikivi
Scratch: Computational Concepts Description sequence identifying a series of steps for a task loops running the same sequence multiple times parallelism making things happen at the same time events one thing causing another thing to happen conditionals making decisions based on conditions operators support for mathematical and logical expressions data storing, retrieving, and updating values 15.11.2018 Jaana Holvikivi
Scratch: Computational Practices Description being iterative and incremental developing a little bit, then trying it out, then developing some more testing and debugging making sure that things work – and finding and fixing mistakes reusing and remixing making something by building on what others – or you – have done abstracting and modularizing building something large by putting together collections of smaller parts 15.11.2018 Jaana Holvikivi
Features in Scratch 15.11.2018 Jaana Holvikivi
Operators Assignment Operators + addition - Subtraction * Multiplication / Division % remainder Comparison Operators, true or false == is equal to != is not equal 5!=8 returns true < less than > Greater than >= Greater than or equal <= less than or equal 15.11.2018 Jaana Holvikivi
Operators RESULT Logical Operators && AND || OR ! NOT AND 1 OR NOT 1 OR NOT 15.11.2018 Jaana Holvikivi
Conditional statements 15.11.2018 Jaana Holvikivi
Loops Wait Repeat Forever Expressions 15.11.2018 Jaana Holvikivi
First Steps in programming use sequence, selection, and repetition in programs and various forms of input and output & variables
Effective Saving Strategies Your Responsibility To Save And Backup Frequently. Save Every 5 Minutes Change Filename Every 15 Minutes No Auto Saves On Most Developer Software
Task 1 Go to Scratch home page, and Join Scratch. You need to create an account in order to be able to save your work. Use some other ID and password than in Metropolia systems. Go through the basics of project creation selecting Try it out or holiday card: http://scratch.mit.edu/hoc 15.11.2018 Jaana Holvikivi
Task 2 Explore projects that are posted on the Scratch site. Try different types of projects! Choose one interesting project and try to understand its functioning. Show the project to your team and explain it. 15.11.2018 Jaana Holvikivi
Task 3 Explore different features Scripts, Costumes and Sounds. Try different types of projects, see what is available for modification! Select some very serious science or mathematics project for modification, such as fractals or operating systems. Finally, create a project where you can ask your classmates to join. 15.11.2018 Jaana Holvikivi