Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Introduction to programming

320 views

Published on

An introduction to Computer Programming, an overview of various programming concepts and what makes scratch programming better for high school students

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Introduction to programming

  1. 1. 21/07/15 05:19 AM CSC Alliance — 1 Kimera Richard E-mail: rkimera@must.ac.ug Phone: 0701 437989 INSTITUTE OF COMPUTER SCIENCE DEPARTMENT OF INFORMATION SYSTEMS AND TECHNOLOGY Intro to Computer Programming http://Westechies.blogspot.com http://kimrichies.blogspot.com
  2. 2. MUST- ICS rkimera@must.ac.ug What is a program A sequence of instructions that a computer can interpret and execute;  If I tell you the way from ICS to Administration Block … I will tell sequence of instructions…. Any wrong instruction leads to a undesired result. A program is something that runs on your computer. In case of MS Windows program is of .EXE or .COM extensions MS Word, Power point, Excel are all computer programs
  3. 3. MUST- ICS rkimera@must.ac.ug Discussion Question: How advantageous is Computer Programming in relation to National development?
  4. 4. MUST- ICS rkimera@must.ac.ug Programming Concepts Data Types Variables Operators Conditional Statements Looping Statements Functions and working with Files Application programming Interfaces (API’s) e.t.c
  5. 5. MUST- ICS rkimera@must.ac.ug Data Types and Variables Data Type: It is basically a scheme for representing data OR data storage location e.g Int, String, float, boolean, byte, e.t.c A variable is a named data storage location in your computer's memory. By using a variable's name in your program, you are, in effect, referring to the data stored there.
  6. 6. MUST- ICS rkimera@must.ac.ug Operators  Operators are symbols which take one or more operands or expressions and perform arithmetic or logical computations.  E.g +, -, *, /, %, =, ++, - -. ==, <, >, //, &&  Operands are variables or expressions which are used in conjunction with operators to evaluate the expression.  Combination of operands and operators form an expression.
  7. 7. MUST- ICS rkimera@must.ac.ug Conditional Statements If…else statement – Tests if a certain condition is true/ false and executes a given statement Switch Statement – Similary works as the if..else statement
  8. 8. MUST- ICS rkimera@must.ac.ug Looping Statements Executes a certain condition and loops up to when the set condition is met Examples of statement include; While loop Do…….while Break and continue goto for
  9. 9. MUST- ICS rkimera@must.ac.ug Functions/Methods Functions/Methods are independent sections in a code that perform some specific task and optionally returns a value when called The help break a complex problem or task into a smaller portions
  10. 10. MUST- ICS rkimera@must.ac.ug Writing Computer Programs A programmer uses an editor to create or modify files containing C code e.g Notepad, Codeblocks, Visual studio, Android studio, e.t.c Code is also known as source code. After a source file/Project has been created, the programmer must invoke the compiler before the program can be executed (run). For advanced IDE’s(Integrated Drive Electronics), the program is compiled as you code.
  11. 11. MUST- ICS rkimera@must.ac.ug Introduction to programming languages Programming languages can be; Server side languagesServer side languages – Code is stored on the server and accessed by a clied basically through the browser. E.g php Client side languagesClient side languages – code can be stored on either the client or server e.g HTML Interpreted languagesInterpreted languages – Code will execute even if it contains errors, no compile is needed e.g HTML Compiled languagesCompiled languages – Code will not execute/run if the compile fails to understand some statements e.g C, Java Any more???
  12. 12. MUST- ICS rkimera@must.ac.ug Categories of Programming languages Procedure languagesProcedure languages – Follow a step by step program execution e.g C, C++, e.t.c Object Oriented Programming languagesObject Oriented Programming languages – Classes are used a data types for Objects. Event Driven Languages-Event Driven Languages- The program runs basing on user actions, this is common in GUI programming. Events can be generated when a user clicks a button, touches the scroon, moves a mouse, types on the key board, etc. Examples… Java, Visual Basic, C++. OO Php Scripting languagesScripting languages – light weight languages e.g php, python, javascript Mobile programming language –Mobile programming language – Light weight languages that run on mobile devices e.g Android, windows OS, swift/Objective C, Symbian, WebOS, Blackberry OS.
  13. 13. MUST- ICS rkimera@must.ac.ug Programming support Tools Basic Editors e.g Notepad, Notepad ++ IDE’s (WYSIWYG) e.g Netbeans, Dreamweaver, Codeblocks Content management systems e.g Joomla, Wordpress, Drupal, etc Mockups – pencil, fireworks, etc
  14. 14. MUST- ICS rkimera@must.ac.ug Example of program written in C #include <stdio.h> int main( void ) { int value1, value2, product ; printf(“Enter two integer values: “) ; scanf(“%d%d”, &value1, &value2) ; product = value1 * value2 ; printf(“Product = %dn”, product) ; return 0 ; }
  15. 15. MUST- ICS rkimera@must.ac.ug Example of program written in Java /* Sample Java Program */ public class Sample { public static void main (String [] args) { int i; for (i = 1; i <= 10; i++) { System.out.println ("Number: " + i); } } }
  16. 16. MUST- ICS rkimera@must.ac.ug Example of program written in Objective C #import <Foundation/Foundation.h> int main() { /* my first program in Objective-C */ NSLog(@"Hello, World! n"); return 0; } Source: http://www.tutorialspoint.com/objective_c/objective_c _environment_setup.htm
  17. 17. MUST- ICS rkimera@must.ac.ug Example of program written in Android package com.example.kim.myapplication; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_main, menu); return true; } return super.onOptionsItemSelected(item); } }
  18. 18. MUST- ICS rkimera@must.ac.ug Programming Languages
  19. 19. MUST- ICS rkimera@must.ac.ug Discussion Question If we are to teach Computer programming in Secondary Schools, which one of the above programming languages would be simpler Lets think about the our school labs and resources available
  20. 20. MUST- ICS rkimera@must.ac.ug Scratch Is one of the best! Was it on the list?
  21. 21. MUST- ICS rkimera@must.ac.ug QUESTIONS What do you think could be the best way of teaching computer programming in your school?
  22. 22. MUST- ICS rkimera@must.ac.ug

×