Programming Fundamentals


Published on

For most programming/scripting languages the concepts are all the same. The only thing that changes is the syntax in which it is written. Some languages may be easier to remember than others, but if you follow the basic guide line, it will make learning any programming language easier. This is in no way supposed to teach you everything about programming, just a general knowledge so when you do program you will understand what you are doing a little bit better.

Published in: Education, Technology

Programming Fundamentals

  1. 1. TRIVUz
  2. 2. Why Programming? What is Computer? What is Program? What is Programming?
  3. 3. So, Program isSome instruction computer followto do our task. And this sequenceof instructions is called a program.
  4. 4. And, Programming isThe process of writing programs iscalled programming.
  5. 5. What is the PROCESS? Continue…
  6. 6. Follow the steps given below tobecome a successful programmer: Define the problem: Examine the problem until you understand it thoroughly. Outline the solution: Analyze the problem.
  7. 7. Continue… Expand the outline of the solution into an algorithm: Write a step-by-step procedure that leads to the solution. Test the algorithm for correctness: Provide test data and try to work out the problem as the computer would. This is a critical step but one that programmers often forget.
  8. 8. Continue… Convert the algorithm into a program: Translate the instructions in the algorithm into a computer program using any programming language. Document the program clearly: Describe each line of instruction or at least some important portions in the program. This will make the program easy to follow when accessed later for corrections or changes.
  9. 9. Continue… Run the program: Instruct the computer to execute the program. The process of running the program differs from language to language. Debug the program: Make sure that the program runs correctly without any errors or bugs as they are called in computer terminology. Finding the errors and fixing them is called debugging. Don’t get depressed when bugs are found. Think of it as a way to learn.
  10. 10. Programming Language?
  11. 11. Prerequisite… ? Almost nothing… 
  12. 12. Platform… ?Mac, Linux, Windows…. Any of them…
  13. 13. How old are you?What is your educational Background? I don’t care… 
  14. 14. So, Who Are You?You are currently a computer userwho love to use computer.And definitely you are a user of aprogram.
  15. 15. You are going to be… The creator of the Program. You will be the Programmer.
  16. 16. So again, What is programming? When we want a computer to perform a specific task, such as generating a marks sheet or a salary slip, we have to create a sequence of instructions in a logical order that a computer can understand and interpret. This sequence of instructions is called a program. The process of writing programs is called programming.
  17. 17. The task of programming involves a lot of effort and carefulplanning. Without this, the computer will produce erroneousresults. The following steps should go into the planning ofprogram: Defining and analyzing the problem Developing the solution logically using an algorithm
  18. 18. Defining and analyzing the problemBefore writing a program, we have to defineexactly what Data we need to provide (input) and Information we want the program to produce (the output).Once we know these, we can figure out how to develop the solution.
  19. 19. Understanding INPUTSuppose we want to write a program to work outthe total and average of a student’s marks in fivesubjects, we would need to mention the marksin the five subjects as input.
  20. 20. Understanding OUTPUTNext, we have to think of the output — theelements that should be displayed and thosethat should not. In the marks example, since thetask is to prepare a marks sheet, the marks in allthe five subjects, their total and average shouldbe displayed on the screen.
  21. 21. INPUTBangla = 60English = 80Math = 100History = 70
  22. 22. OUTPUTAverage : 77.5
  23. 23. PROCESSINGAverage = (Bangla + English + Math + History) / 4
  24. 24. Lets write our very first program Get Inputs from the user Save them somewhere Use a math logic to process Show the result / output.
  25. 25. Getting INPUTS Make a user interface to collect INPUT from user
  26. 26. Handling Inputsvar a = (input for bangla)var b = (input for english)var c = (input for math)var d = (input for history)
  27. 27. Processing & Outputvar average; // another variableaverage = (a + b + c + d) / 4;print average;
  28. 28. OUTPUT Our program process the input and show this output.
  29. 29. VARIABLE What is variable? Variable Naming?
  30. 30. Data Types
  31. 31. Type, Length, Range
  32. 32. Lab - 1 Let’s try variable in PHP environment
  33. 33. Input Interface<html><head><title>Programming – 1</title></head><body><form name="test" method="GET”> Name: <input type="text" name=”InputName" /> <input type="submit" name="submit" value="Go" /></form></body></html>
  34. 34. Programming Process<?php if(isset($_GET[InputName])) { $name = $_GET[InputName]; echo $name ; } else { // some other code or load form }?>
  35. 35. Another Input<html><head><title>Programming – 2</title></head><body><form name="test" method="GET”> Name: <input type="text" name=”num" /> <input type="submit" name="submit" value="Go" /></form></body></html>
  36. 36. Programming Process<?php if(isset($_GET[’num])) { $number1 = $_GET[’num]; echo $number1; $sqr = $number1 * $number1; echo “<br /> “ . $sqr; } else { // some other code or load form }?>
  37. 37. Make a Simple Calculator<html><head><title>Programming – 3</title></head><body><form name="test" method="GET”> Name: <input type="text" name=”num1" /> <input type="text" name=”num2" /> <input type="submit" name="submit" value=”Sum" /></form></body></html>
  38. 38. Class Contents Get all class contents & codes from our site
  39. 39. Assignment Read some article regarding data types Read some article regarding numbers Read some article proved by Academy Write some article regarding all of these
  40. 40. Q&A TRIVUz Academy
  41. 41. THANK YOU MS Alam TRIVUz