Programming Paradigms By Tyler Smith. Event Driven Event driven paradigm means that the program executes code in reaction to events. The limitation of.

Slides:



Advertisements
Similar presentations
PHP I.
Advertisements

JavaScript I. JavaScript is an object oriented programming language used to add interactivity to web pages. Different from Java, even though bears some.
1 COMM 1213 H1 COMP 4923 X1 JavaScript 1 (Readings: Ch. 10, 11 Knuckles)
Programming Paradigms and languages
Primitive Data Types There are a number of common objects we encounter and are treated specially by almost any programming language These are called basic.
14/11/11.  These words have special meanings in themselves  These should NOT be used as Identifiers.  For example:  Break, do, function, case, else,
COSC 120 Computer Programming
PHP Intro/Overview Squirrel Book pages Server-side Scripting Everything you need to know in one slide 1.Web server (with PHP “plug-in”) gets a.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Python November 18, Unit 7. So Far We can get user input We can create variables We can convert values from one type to another using functions We can.
Javascript II Expressions and Data Types. 2 JavaScript Review programs executed by the web browser programs embedded in a web page using the script element.
CHAPTER 3: CORE PROGRAMMING ELEMENTS Introduction to Computer Science Using Ruby (c) 2012 Ophir Frieder et al.
1 CS101 Introduction to Computing Lecture 29 Functions & Variable Scope (Web Development Lecture 10)
Software Design & Development Software Design & Development Programming Types Event Driven Programming Event driven programming Is a type of programming.
Software design and development Marcus Hunt. Application and limits of procedural programming Procedural programming is a powerful language, typically.
Unit Six Assignment 1 Chris Boardley.
Python quick start guide
PHP: Hypertext Processor Fred Durao
August Chapter 1 - Essential PHP spring into PHP 5 by Steven Holzner Slides were developed by Jack Davis College of Information Science and Technology.
Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 1 Introduction to Computers and Programming.
Python.
AIT 616 Fall 2002 PHP. AIT 616 Fall 2002 PHP  Special scripting language used to dynamically generate web documents  Open source – Free!!!  Performs.
CIS Computer Programming Logic
Introduction to Python
General Computer Science for Engineers CISC 106 Lecture 02 Dr. John Cavazos Computer and Information Sciences 09/03/2010.
NMED 3850 A Advanced Online Design January 26, 2010 V. Mahadevan.
JavaScript Lecture 6 Rachel A Ober
Introduction to Java CSIS 3701: Advanced Object Oriented Programming.
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
Cis303a_chapt03-2a.ppt Range Overflow Fixed length of bits to hold numeric data Can hold a maximum positive number (unsigned) X X X X X X X X X X X X X.
ASP.NET Programming with C# and SQL Server First Edition Chapter 3 Using Functions, Methods, and Control Structures.
CS 11 java track: lecture 1 Administrivia need a CS cluster account cgi-bin/sysadmin/account_request.cgi need to know UNIX
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
Using Client-Side Scripts to Enhance Web Applications 1.
Lec 6 Data types. Variable: Its data object that is defined and named by the programmer explicitly in a program. Data Types: It’s a class of Dos together.
Introduction to PHP A user navigates in her browser to a page that ends with a.php extension The request is sent to a web server, which directs the request.
5 BASIC CONCEPTS OF ANY PROGRAMMING LANGUAGE Let’s get started …
Overview: 1. Discussion of the basic architecture of a web application. 2. Discussion of the relevance of using MySQL and PHP in a web application.
Variables When programming it is often necessary to store a value for use later on in the program. A variable is a label given to a location in memory.
Python Programming Using Variables and input. Objectives We’re learning to use basic knowledge of variables combined with user input. Outcomes Continue.
Data Types and Variables. Data Type! Computers are all about Data! Data can be in the form of Text Dates Sounds Pictures.
JavaScript, Fourth Edition
Core Java Introduction Byju Veedu Ness Technologies httpdownload.oracle.com/javase/tutorial/getStarted/intro/definition.html.
8-1 Compilers Compiler A program that translates a high-level language program into machine code High-level languages provide a richer set of instructions.
JavaScript Assignment Statements Expressions Global Functions CST 200 JavaScript.
Introduction to Python Dr. José M. Reyes Álamo. 2 Three Rules of Programming Rule 1: Think before you program Rule 2: A program is a human-readable set.
Introduction to JavaScript CSc 2320 Fall 2014 Disclaimer: All words, pictures are adopted from “Simple JavaScript”by Kevin Yank and Cameron Adams and also.
IS2802 Introduction to Multimedia Applications for Business Lecture 4: JavaScript, Loops, and Conditional Statements Rob Gleasure
Language Find the latest version of this document at
 Variables can store data of different types, and different data types can do different things.  PHP supports the following data types:  String  Integer.
Introduction to JavaScript MIS 3502, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 2/2/2016.
Dr. Abdullah Almutairi Spring PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used,
Expressions and Data Types Professor Robin Burke.
Introduction to Javascript. What is javascript?  The most popular web scripting language in the world  Used to produce rich thin client web applications.
PHP – PHP Hypertext Processor A quick overview. How is PHP used? Embedded with HTML, e.g. Not like CGI: PHP files not an executable Used with servers.
Introduction to JavaScript MIS 3502, Fall 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 9/29/2016.
Choosing Data Types Database Administration Fundamentals
Creating Database Objects
Prof: Dr. Shu-Ching Chen TA: Samira Pouyanfar Spring 2017
IGCSE 4 Cambridge Data types and arrays Computer Science Section 2
Scope, Objects, Strings, Numbers
JavaScript Syntax and Semantics
Prof: Dr. Shu-Ching Chen TA: Samira Pouyanfar Hector Cen Fall 2017
Engineering Innovation Center
Introduction to Python
PHP Intro/Overview Bird Book pages 1-11,
PHP.
Tutorial 10: Programming with javascript
Data Types and Maths Programming Guides.
Creating Database Objects
Presentation transcript:

Programming Paradigms By Tyler Smith

Event Driven Event driven paradigm means that the program executes code in reaction to events. The limitation of this paradigm is that makes execution order ambiguous, and these threads can use a lot of memory. *Thread: Events are executed in a separate process so they can run simultaneously.

Event Driven Example This example will popup a message when the body of the document is clicked. HTML elements have methods that waits for them to be clicked. When it is clicked, it executes the function stored. ```JavaScript document.getElementById(‘body’).onclick=function() { alert(“STOP CLICKING”); } ```

Traditional Procedural Paradigm A procedural paradigm executes commands linearly. This means that it’s not possible to use more than one processor core, making the paradigm unusable for more efficient programming(This is the main limitation), but it is useful for having multiple users connected at the same time. One application of this is on web servers with PHP.

Procedural Example Below is an example of a PHP API that will return all data on a name stored in a database, given the predefined function ‘make_sql_request’. This code executes line by line, in order. ```PHP $name = mysql_real_escape_string($_REQUEST[‘name’]) $request = ‘SELECT * FROM `db` WHERE `name` = `‘. $name. ‘`’ $recv = make_sql_request($request); print_r($recv) ```

Traditional Object Oriented Paradigm Object orientation is the focus on the ‘object’ datatype. The object data type was built to mimic objects in real life. An object type variable has properties and methods. These are used to gather data from the object, or execute actions using the object. The limitations of this data type is that you are unable to iterate it, and it takes more time to initialize.

Object Oriented Example Creating an object called student, and using that object in a function: ```Python class Student(object): name = "" age = 0 major = "" def __init__(self, name, age, major): self.name = name self.age = age self.major = major def make_student(name, age, major): student = Student(name, age, major) return student ```

Data Types

Datatypes NameExamplesizeComment String mystring = ‘Hello World’ 12Gb, in x86. Feasibly infinite in x64, dependant on RAM (In Python) A string is a list of characters. Strings are iterable, and can be used in an array of functions. Integer $myinteger = 10; 4 bytes An integer is another term for ‘Whole number’. Integers aren’t iterable, but they can be used in various maths functions, such as adding, multiplying and more. Float global _start section.data val: dq bytes Floating point numbers are useful for data presentation. Note: Floating point numbers are never accurate. Boolean var myboolean = true; 1 bit Booleans are useful to return from functions and to test for in conditions. Array int myarray[1] = {0, 1}; array is made up of all datatypes within the array IE: 8 bytes Arrays are very much iterable, and are useful to store lots of information that is editable and flexible within programming. Associative Array myassociativearray = {'Hello' => ‘World’, 'Answer' => 42} associative array is made up of all datatypes within the array IE: 8 bytes, along with the string used to list it This data type is useful for categorizing data, but still passing it as a single variable, similar to an object.

1. String A string is a list of characters. This is how to define a string in Python: mystring = ‘Hello World’ A string is a list of characters. Strings are iterable, and can be used in an array of functions. Strings in the Python interpreter can be of almost any size due to Python’s modern architecture.

2. Integer An integer is another term for ‘Whole number’. Here’s and example of defining an integer in PHP: $myinteger = 10; An integer is another term for ‘Whole number’. Integers aren’t iterable, but they can be used in various maths functions, such as adding, multiplying and more. PHP also has modern arch, so integers can be of almost any length.

3. Float A float type is a number with decimal places. This how to define a floating point in NASM x86 assembly syntax: global _start section.data val: dq Floating point numbers are useful for data presentation. Note: Floating point numbers are never accurate. Assembly can buffer memory in any size, as the language is almost the lowest of levels.

4. Boolean A boolean value is a variable that can only be in two forms. Usually ‘true’ or ‘false’, but can be ‘0’ or ‘1’. This is an example of setting a boolean in JavaScript: var myboolean = true; Booleans are useful to return from functions and to test for in conditions. Booleans in Javascript use a single bit. A 1 or 0.

5. Array An array is a variable that can contains multiple values. Here is an example of an array in C: int myarray[1] = {0, 1}; Arrays are very much iterable, and are useful to store lots of information that is editable and flexible within programming. In C, the number of bytes in the array is defined by the statement. In this case, there are two buffers of a 4 bits.

6. Associative Array An associative array is another type of array that can contain string type definitions. Here is an example of an Associative array in Ruby: myassociativearray = {'Hello' => ‘World’, 'Answer' => 42} This data type is useful for categorizing data, but still passing it as a single variable, similar to an object.

Conclusion Choosing a data type is important to a programmer as a datatype that can store the required information efficiently. When an appropriate data type is chosen, code is easier to read, programs are faster, and storage is more efficient. For example: Trying to store a time as a string would take a lot of code to convert it back to a format that we can use (Depending on the string format).