Fundamentals of Programming PDF

Summary

This document provides an overview of programming languages, including their history and different types. It details logic formulation and problem solving steps in programming, focusing on high-level and low-level languages. It also covers algorithms and their characteristics.

Full Transcript

FUNDAMENTALS OF PROGRAMMING LOGIC FORMULATION HISTORY OF PROGRAMMING LANGUAGE Programming Language - It is a PRE – HISTORY media of communication between ○ 2000 B.C.: Babylon used human and machine (computer)....

FUNDAMENTALS OF PROGRAMMING LOGIC FORMULATION HISTORY OF PROGRAMMING LANGUAGE Programming Language - It is a PRE – HISTORY media of communication between ○ 2000 B.C.: Babylon used human and machine (computer). “algorithms” for calendar Program - A logical pattern of computations no explicit instructions to solve a problem. conditional iteration. Programming - The art and science ○ 300 B.C.: Greece, Euclid of designing a program. expresses the greatest Programmer - This refers to the common algorithm using person who designs or creates, iteration. codes, test, debugs and documents ○ 1820 – 1945: Countess Ada a computer program. Lovelace writes a program Logic - It came from the Greek word for Charles Babbage’s logos which is sometimes translated Analytical Engine. as “sentence”, “discourse”, “reason”, ○ 1950’s First Modern “rule”, and “ratio”. It is the study of Programming Languages the principles of correct reasoning. invented. Pseudocode - It is a notation OBJECT ORIENTED resembling a simplified programming ○ Ada: 1977, DoD Committee language, used in program design. It (Department of Defense) is an informal high-level description ○ C++: 1985, Bjarne Stroustrop of the operating principle of a (Bell Lab) computer program or other ○ Java: Sun Microsystem algorithm. Programming languages provides Steps in Problem Solving as a platform to describe the job of computer through instructions. Two Categories of Programming 1. Read the problem at least three times (or however many makes Language. you feel comfortable) 2. Work through the problem 1. High Level/Problem manually with at least three sets of Oriented Language sample data This language is 3. Simplify and optimize your steps designed to give a 4. Write pseudocode better programming 5. Translate pseudocode into code efficiency, i.e. faster and debug program 6. Simplify and optimize your code development. 7. Debug This language is 8. Write useful comments human readable. 9. Practice, practice, practice It is easy to work in this type of khowarizmi, which means a language. Easy to write in procedure or a technique. Software High level language Engineer commonly uses an Ex. Basic, Pascal. algorithm for planning and solving 2. Low Level/Machine the problems. Oriented Language Algorithm has the following ○ This language is characteristics: also called Machine Language. ○ Input - what the algorithm ○ This language is takes in as input. based on machine ○ Output - what the algorithm code produces as output ○ Hard to learn and ○ Definiteness - the steps are write a program in defined precisely Low level language. ○ Correctness - should ○ Ex. Machine Language, produce the correct output. Assembly ○ Finiteness - the steps Language. required should be finite ○ Effectiveness - solves the problem. STRUCTURE PROGRAMMING AND ○ Efficiency - in less time, the TOP-DOWN DESIGN result is obtained. PROGRAM PLANNING - Involves ○ Generality - the algorithm on deciding on the functions of a should be applicable to all program. problems of a similar form. PROGRAM DESIGN - Involves planning how the program will work. CONTROL STRUCTURES OF ALGORITHM CODING - Writing a program code in AND FLOWCHART an appropriate computer language. TESTING/DEBUGGING - Correcting Sequence - In the sequence any errors in the program. structure, statements are placed one DOCUMENTATION - Writing a after the other and the execution detailed description of how the takes place starting from up to down. program works and how it may be Branching (Selection) - In branch used. control, there is a condition and MAINTENANCE - Correcting errors according to a condition, a decision as users point them out. This allows of either TRUE or FALSE is for modification of the program in achieved. In the case of TRUE, one response to user suggestions and of the two branches is explored; but needs. in the case of FALSE condition, the other alternative is taken. Generally, the ‘IF-THEN’ is used to represent STRUCTURE PROGRAMMING AND branch control. TOP-DOWN DESIGN Loop (Repetition) - The Loop or The word “algorithm” relates to the Repetition allows a statement(s) to name of the mathematician Al- be executed repeatedly based on certain loop condition e.g. WHILE, Off Page FOR loops. Connector Flowchart - uses different symbols to design a solution to a problem. Predefined Used to SYMBOL SYMBOL FUNCTION Process represent a NAME Function group of statements Start/ End Used to performing Oval represent one start processing and end of task. flowchart. Preprocessor A step in the Input/ Output Used for process that Parallelogram input and occurs before output the main operation processing or computation. Process Used for Rectangle arithmetic Comments Used to operations provide and data additional manipulation information s or explanations Decision Used to about Making represent the specific parts Diamond operation in of the which there diagram. are two/three alternatives, true and false C# - simple, modern, etc. general-purpose, object-oriented programming language developed Flow Line Used to by Microsoft within its.NET initiative Arrows indicate the flow of led by Anders Hejlsberg. logic by.Net Framework - The.Net connecting framework is a revolutionary symbols. platform that helps you to write the following types of applications: Connector Page ○ Windows applications Circle Connector ○ Web applications ○ Web services Integrated Development Environment (IDE) ○ SharpDevelop 5.1 - open-source IDE for the.NET platform. With it, you Console.ReadKey(); - This makes can edit code in various the program wait for a key press and languages, including C#, it prevents the screen from running VB.NET, F#, IronPython and and closing quickly when the IronRuby, as well as program is launched from the IDE. ASP.NET MVC and WCF. Data Types - classification that specifies which type of value a BASIC SYNTAX variable has and what type of using System; - The first line of the mathematical, relational or logical program using System; - the using operations can be applied to it keyword is used to include the without causing an error. System namespace in the program. Primitive (Value Type) - C# A program generally has multiple primitives are also called value types using statements. and predefined in the.NET namespace framework. Primitive types can be HelloWorldApplication - The next assigned a value directly. The value line has the namespace declaration. assigned is stored on the stack as A namespace is a collection of opposed to the heap. classes. class HelloWorld - The next line has a class declaration, the class HelloWorld contains the data and method definitions that your program uses. Classes generally contain multiple methods. Methods define the behavior of the class. However, the HelloWorld class has only one method Main. static void Main(string[] args) - The next line defines the Main method, which is the entry point for all C# programs. The Main method states what the class does when executed. - The next line is ignored by the compiler and it is put to add comments in the program. Console.WriteLine(“..."); - WriteLine is a method of the Console class defined in the System namespace. This statement causes the message "Hello, World!" to be displayed on the screen.

Use Quizgecko on...
Browser
Browser