SlideShare ist ein Scribd-Unternehmen logo
1 von 25
Agenda
•Computer
•Program
•Human Vs. Computer Instruction
•Programming Languages
•Interpreter & Compiler
•Memory
•Recursion
•Modularity
Computer
• Is more intelligent than human ???
– Of course Not!
• A slave that only does what it is told
• Is always right; can never be wrong
• Good at performing lengthy and recurring tasks
Program
•A set of instructions that tells the computer what to
do.
–Takes input(s)
–Processes input(s)
–Produces output(s)
–Garbage In, Garbage Out (G.I.G.O.)
•Computer executes the program exactly as you have
instructed it. It will do no more or no less than what is
contained in your specific instructions.
Human Vs. Computer Instructions
• Ahmed throws the ball fast
Subject Action Object
Ahmed Throw Ball
Computer
Function Throw(ball)
{
1. Lift the ball.
2. Move hand in backward direction
3. Move hand in forward direction exerting good amount of force.
4. Leave the ball.
}
Computer instructions will be executed how it tells to do.
Human instruction execution may change every time you instruct.
Programming Languages
•Low Level Languages
–Machine Code
–Assembly Language
•High Level Languages
–C#, X++, C etc.
int a = 10;
int b = 20;
int result;
result = a + b;
Interpreter and Compiler
•A computer can only understand machine language, therefore we need
a program which can translate high level into machine language.
•A program is translated into machine language by interpreter or
compiler.
•Interpreter
–Each instruction is interpreted from the programming language as
needed (line by line of code).
–Every time the program is run, the interpreter must translate each
instruction again.
–E.g.
•PHP, JavaScript, Pearl, Python etc.
•Compiler
–A compiler makes the translation once so that the source code don’t
have to be translated each time the program is run.
–Compiler take less time for execution since it translates code once.
–E.g.
• C#, Java, X++ etc. too.
Memory
• While a program is running, its data must be stored in
memory.
• A running program uses two regions of memory to
store data.
• –Stack
• –Heap
• How much memory is required for an item, and where
and how it’s stored, depends on its type.
• Language runtime takes care of memory allocation.
• For X++ the Microsoft Dynamics AX runtime manages
the storage allocation of data on stack and heap.
Stack
• A stack is an array of memory that acts as a last-in, first-out (LIFO) data
structure.
• Stack-based memory allocation is very simple and typically faster than
heap-based memory allocation
• Data can be added to and deleted only from the top of the stack.
• Placing a data item at the top of the stack is called pushing the item onto
the stack.
• Deleting an item from the top of the stack is called popping the item from
the stack.
Heap
• Chunks of memory are allocated to store certain
kinds of data objects.
• Memory can be stored and removed from the
heap in any order.
• Heap is also known as dynamic memory.
Data type
A classification for identifying one of various types of data
•A type as a template for creating data structures.
•A type is defined by the following elements:
–A name.
–A data structure to contain its data members.
–Behaviors and constraints.
E.g.
–Integer
•32 bit or 64bit, stores integers only.
–Boolean
•1 byte, true or false.
–Real
•64 bit, floating point numbers.
Data type
There are two kind of data types:
Value type
–Stored in stack.
–Require only a single segment of memory.
–E.g.
•Integer
•Boolean
•Real
Reference type
–Require two segments of memory
–The first contains the actual data—and
is always located in the heap.
–The second is a reference that points to
where in the heap the data is stored.
–E.g.
•String
•Object
Variables
The name, or identifier, for a variable points to a memory location
where information of a specific data type is stored.
•Names must be limited to ASCII letters, digits, and the underscore
character (_).
•Letters can be either uppercase or lowercase.
•The first character must be either a letter or the underscore
character.
•Best Practice, variable names should begin with a lowercase
letter i.e. Camel Casing.
–myVariable, custTable
•Why use Variables ?
–Variables can maintain the same value throughout the program.
–Changing value at one place will reflect throughout the scope.
Variable Declaration
Variable always be declared with some data type.
Declaration with initialization
Multiple Declaration
–The variables in a multiple-variable declaration must all be
of the same type.
–The variable names must be separated with commas.
Method
Lines of code that perform a specific task.
–[ Modifiers ] ReturnType MethodName( ParameterList )
{
//body
}
Public void Test(int i)
{
}
Modifiers public | protected |
private|static
ReturnType Datatype | void
MethodName Identifier
Parameter Datatype Variableidentifier [ =
Expression ]
Method Example
Return sum of any two integers.
Method Invocation
•Execution of the current method suspends at that point
of the invocation.
•Control transfers to the beginning of the invoked
method.
•The invoked method executes until it completes.
•Control returns to the calling method.
Method Parameters
• By Value
• –It allocates space on the stack for the formal
parameters.
• –It copies the values of the actual parameters to
the formal parameters.
• By Reference
• –It copies the address of variable not the value.
• –The actual parameter must be a variable.
By reference & By Value Example
•Local variable
–Alive until method returns.
•Global variable
–Alive until application shutdown.
–Company Name
•Constants
–Once set, the value cannot be changed
–Must be used instead of hard-coded values
–E.g. Labels file
Variable Scope
Variable Scope Example
Control Statements
Conditional
•Skip part of code or execute only desired portion
–If
–If Else
–If Else-if Else
–Switch
Loops
•Executes same lines of code once or more than one time
–While
–Do - While
–For
Conditional- if-[else-if] – [else]
if statement evaluates a question (condition).
•Executes a statement(s) if condition is true.
•Syntax
if(expression)
{
statement
}
[ elseif(expression) //can have multiple elseif
// statements
{
statement
}………
else // only one else statement
{
statement
}
]
Recursion
•Recursion can be used to manage repetition.
•Recursion is a process in which a module
achieves a repetition of algorithmic steps by
calling itself.
•Each recursive call is based on a different,
generally simpler, instance.
Fundamental Rules
Base Case
–Always have at least one case that can be solved without
recursion.
Make Progress
– Any recursive call must progress towards a base case.
Always Believe
– Always assume the recursive call works.
Compound Interest Rule
– Never duplicate work by solving the same instance of a
problem in separate recursive calls.
Recursion Example
Calculating 5!
Input n = 5;
Factorial (n);
120
•5* a where a = Factorial(n -1)
a = 24
•4* a
a = 6
•3 * a
a = 2
•2* 1

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (17)

C- language Lecture 8
C- language Lecture 8C- language Lecture 8
C- language Lecture 8
 
Java introduction
Java introductionJava introduction
Java introduction
 
Algorithms 101 for Data Scientists (Part 2)
Algorithms 101 for Data Scientists (Part 2)Algorithms 101 for Data Scientists (Part 2)
Algorithms 101 for Data Scientists (Part 2)
 
SFDC Introduction to Apex
SFDC Introduction to ApexSFDC Introduction to Apex
SFDC Introduction to Apex
 
C- language Lecture 5
C- language Lecture 5C- language Lecture 5
C- language Lecture 5
 
Embedded C - Optimization techniques
Embedded C - Optimization techniquesEmbedded C - Optimization techniques
Embedded C - Optimization techniques
 
Data Evolution on HBase (with Kiji)
Data Evolution on HBase (with Kiji)Data Evolution on HBase (with Kiji)
Data Evolution on HBase (with Kiji)
 
Overview of CoffeeScript
Overview of CoffeeScriptOverview of CoffeeScript
Overview of CoffeeScript
 
Compiler construction tools
Compiler construction toolsCompiler construction tools
Compiler construction tools
 
Syntax directed-translation
Syntax directed-translationSyntax directed-translation
Syntax directed-translation
 
C programming
C programmingC programming
C programming
 
10 instruction sets characteristics
10 instruction sets characteristics10 instruction sets characteristics
10 instruction sets characteristics
 
System Programming Overview
System Programming OverviewSystem Programming Overview
System Programming Overview
 
System Programming Unit III
System Programming Unit IIISystem Programming Unit III
System Programming Unit III
 
Cd ch1 - introduction
Cd   ch1 - introductionCd   ch1 - introduction
Cd ch1 - introduction
 
Lexical1
Lexical1Lexical1
Lexical1
 
learn JAVA at ASIT with a placement assistance.
learn JAVA at ASIT with a placement assistance.learn JAVA at ASIT with a placement assistance.
learn JAVA at ASIT with a placement assistance.
 

Andere mochten auch

Compiler vs interpreter
Compiler vs interpreterCompiler vs interpreter
Compiler vs interpreterParas Patel
 
Prof. Dr. Aung Tun Thet: The Art and Science of Management
Prof. Dr. Aung Tun Thet: The Art and Science of ManagementProf. Dr. Aung Tun Thet: The Art and Science of Management
Prof. Dr. Aung Tun Thet: The Art and Science of ManagementThu Nandi Nwe
 
Management – as art or science?
Management – as art or science?Management – as art or science?
Management – as art or science?Eleny Iasinovschi
 
Function of management, different authors, managemnet
Function of management, different authors, managemnetFunction of management, different authors, managemnet
Function of management, different authors, managemnetBebolious Pharoo
 
Definitions of management by various author
Definitions of management by various authorDefinitions of management by various author
Definitions of management by various authorPawel Gautam
 

Andere mochten auch (7)

Compiler vs interpreter
Compiler vs interpreterCompiler vs interpreter
Compiler vs interpreter
 
Prof. Dr. Aung Tun Thet: The Art and Science of Management
Prof. Dr. Aung Tun Thet: The Art and Science of ManagementProf. Dr. Aung Tun Thet: The Art and Science of Management
Prof. Dr. Aung Tun Thet: The Art and Science of Management
 
Management – as art or science?
Management – as art or science?Management – as art or science?
Management – as art or science?
 
Management definitions by great management scholars
Management definitions by great management scholarsManagement definitions by great management scholars
Management definitions by great management scholars
 
Function of management, different authors, managemnet
Function of management, different authors, managemnetFunction of management, different authors, managemnet
Function of management, different authors, managemnet
 
Role of manager
Role of managerRole of manager
Role of manager
 
Definitions of management by various author
Definitions of management by various authorDefinitions of management by various author
Definitions of management by various author
 

Ähnlich wie General Programming Concept

Reading Notes : the practice of programming
Reading Notes : the practice of programmingReading Notes : the practice of programming
Reading Notes : the practice of programmingJuggernaut Liu
 
Intro to Data Structure & Algorithms
Intro to Data Structure & AlgorithmsIntro to Data Structure & Algorithms
Intro to Data Structure & AlgorithmsAkhil Kaushik
 
.NET UY Meetup 7 - CLR Memory by Fabian Alves
.NET UY Meetup 7 - CLR Memory by Fabian Alves.NET UY Meetup 7 - CLR Memory by Fabian Alves
.NET UY Meetup 7 - CLR Memory by Fabian Alves.NET UY Meetup
 
Programming Language
Programming  LanguageProgramming  Language
Programming LanguageAdeel Hamid
 
Lecture 15 run timeenvironment_2
Lecture 15 run timeenvironment_2Lecture 15 run timeenvironment_2
Lecture 15 run timeenvironment_2Iffat Anjum
 
FPL - Part 1 (Sem - I 2013 )
FPL - Part 1  (Sem - I  2013 ) FPL - Part 1  (Sem - I  2013 )
FPL - Part 1 (Sem - I 2013 ) Yogesh Deshpande
 
Compiler Construction
Compiler ConstructionCompiler Construction
Compiler ConstructionAhmed Raza
 
Android webinar class_java_review
Android webinar class_java_reviewAndroid webinar class_java_review
Android webinar class_java_reviewEdureka!
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesInductive Automation
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesInductive Automation
 
10 instruction sets characteristics
10 instruction sets characteristics10 instruction sets characteristics
10 instruction sets characteristicsSher Shah Merkhel
 
Performance Tuning by Dijesh P
Performance Tuning by Dijesh PPerformance Tuning by Dijesh P
Performance Tuning by Dijesh PPlusOrMinusZero
 
Java platform
Java platformJava platform
Java platformVisithan
 

Ähnlich wie General Programming Concept (20)

Reading Notes : the practice of programming
Reading Notes : the practice of programmingReading Notes : the practice of programming
Reading Notes : the practice of programming
 
Intro to Data Structure & Algorithms
Intro to Data Structure & AlgorithmsIntro to Data Structure & Algorithms
Intro to Data Structure & Algorithms
 
.NET UY Meetup 7 - CLR Memory by Fabian Alves
.NET UY Meetup 7 - CLR Memory by Fabian Alves.NET UY Meetup 7 - CLR Memory by Fabian Alves
.NET UY Meetup 7 - CLR Memory by Fabian Alves
 
Programming Language
Programming  LanguageProgramming  Language
Programming Language
 
Lecture 15 run timeenvironment_2
Lecture 15 run timeenvironment_2Lecture 15 run timeenvironment_2
Lecture 15 run timeenvironment_2
 
FPL - Part 1 (Sem - I 2013 )
FPL - Part 1  (Sem - I  2013 ) FPL - Part 1  (Sem - I  2013 )
FPL - Part 1 (Sem - I 2013 )
 
Compiler Construction
Compiler ConstructionCompiler Construction
Compiler Construction
 
Basics of C
Basics of CBasics of C
Basics of C
 
chapter 5.ppt
chapter 5.pptchapter 5.ppt
chapter 5.ppt
 
73d32 session1 c++
73d32 session1 c++73d32 session1 c++
73d32 session1 c++
 
CPP12 - Algorithms
CPP12 - AlgorithmsCPP12 - Algorithms
CPP12 - Algorithms
 
Android webinar class_java_review
Android webinar class_java_reviewAndroid webinar class_java_review
Android webinar class_java_review
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best Practices
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best Practices
 
2CPP17 - File IO
2CPP17 - File IO2CPP17 - File IO
2CPP17 - File IO
 
10 instruction sets characteristics
10 instruction sets characteristics10 instruction sets characteristics
10 instruction sets characteristics
 
Performance Tuning by Dijesh P
Performance Tuning by Dijesh PPerformance Tuning by Dijesh P
Performance Tuning by Dijesh P
 
Java platform
Java platformJava platform
Java platform
 
C# basics...
C# basics...C# basics...
C# basics...
 
Redshift deep dive
Redshift deep diveRedshift deep dive
Redshift deep dive
 

Mehr von Haris Bin Zahid

Procedural vs. object oriented programming
Procedural vs. object oriented programmingProcedural vs. object oriented programming
Procedural vs. object oriented programmingHaris Bin Zahid
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented ProgrammingHaris Bin Zahid
 
Abstraction and Encapsulation
Abstraction and EncapsulationAbstraction and Encapsulation
Abstraction and EncapsulationHaris Bin Zahid
 
Abstract class and Interface
Abstract class and InterfaceAbstract class and Interface
Abstract class and InterfaceHaris Bin Zahid
 
Foundations of Selection
Foundations of SelectionFoundations of Selection
Foundations of SelectionHaris Bin Zahid
 
Human Resource Planning and Job Analysis
Human Resource Planning and Job AnalysisHuman Resource Planning and Job Analysis
Human Resource Planning and Job AnalysisHaris Bin Zahid
 
Employee Rights and HR Communications
Employee Rights and HR CommunicationsEmployee Rights and HR Communications
Employee Rights and HR CommunicationsHaris Bin Zahid
 
Equal Opportunity Employment
Equal Opportunity EmploymentEqual Opportunity Employment
Equal Opportunity EmploymentHaris Bin Zahid
 
Strategic Implications of a Dynamic HRM Environment
Strategic Implications of a Dynamic HRM EnvironmentStrategic Implications of a Dynamic HRM Environment
Strategic Implications of a Dynamic HRM EnvironmentHaris Bin Zahid
 

Mehr von Haris Bin Zahid (11)

Procedural vs. object oriented programming
Procedural vs. object oriented programmingProcedural vs. object oriented programming
Procedural vs. object oriented programming
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented Programming
 
Abstraction and Encapsulation
Abstraction and EncapsulationAbstraction and Encapsulation
Abstraction and Encapsulation
 
Abstract class and Interface
Abstract class and InterfaceAbstract class and Interface
Abstract class and Interface
 
Recruiting
RecruitingRecruiting
Recruiting
 
Foundations of Selection
Foundations of SelectionFoundations of Selection
Foundations of Selection
 
Human Resource Planning and Job Analysis
Human Resource Planning and Job AnalysisHuman Resource Planning and Job Analysis
Human Resource Planning and Job Analysis
 
Employee Rights and HR Communications
Employee Rights and HR CommunicationsEmployee Rights and HR Communications
Employee Rights and HR Communications
 
Equal Opportunity Employment
Equal Opportunity EmploymentEqual Opportunity Employment
Equal Opportunity Employment
 
Fundamentals of HRM
Fundamentals of HRMFundamentals of HRM
Fundamentals of HRM
 
Strategic Implications of a Dynamic HRM Environment
Strategic Implications of a Dynamic HRM EnvironmentStrategic Implications of a Dynamic HRM Environment
Strategic Implications of a Dynamic HRM Environment
 

Kürzlich hochgeladen

Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...kalichargn70th171
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfproinshot.com
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 

Kürzlich hochgeladen (20)

Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 

General Programming Concept

  • 1. Agenda •Computer •Program •Human Vs. Computer Instruction •Programming Languages •Interpreter & Compiler •Memory •Recursion •Modularity
  • 2. Computer • Is more intelligent than human ??? – Of course Not! • A slave that only does what it is told • Is always right; can never be wrong • Good at performing lengthy and recurring tasks
  • 3. Program •A set of instructions that tells the computer what to do. –Takes input(s) –Processes input(s) –Produces output(s) –Garbage In, Garbage Out (G.I.G.O.) •Computer executes the program exactly as you have instructed it. It will do no more or no less than what is contained in your specific instructions.
  • 4. Human Vs. Computer Instructions • Ahmed throws the ball fast Subject Action Object Ahmed Throw Ball Computer Function Throw(ball) { 1. Lift the ball. 2. Move hand in backward direction 3. Move hand in forward direction exerting good amount of force. 4. Leave the ball. } Computer instructions will be executed how it tells to do. Human instruction execution may change every time you instruct.
  • 5. Programming Languages •Low Level Languages –Machine Code –Assembly Language •High Level Languages –C#, X++, C etc. int a = 10; int b = 20; int result; result = a + b;
  • 6. Interpreter and Compiler •A computer can only understand machine language, therefore we need a program which can translate high level into machine language. •A program is translated into machine language by interpreter or compiler. •Interpreter –Each instruction is interpreted from the programming language as needed (line by line of code). –Every time the program is run, the interpreter must translate each instruction again. –E.g. •PHP, JavaScript, Pearl, Python etc. •Compiler –A compiler makes the translation once so that the source code don’t have to be translated each time the program is run. –Compiler take less time for execution since it translates code once. –E.g. • C#, Java, X++ etc. too.
  • 7. Memory • While a program is running, its data must be stored in memory. • A running program uses two regions of memory to store data. • –Stack • –Heap • How much memory is required for an item, and where and how it’s stored, depends on its type. • Language runtime takes care of memory allocation. • For X++ the Microsoft Dynamics AX runtime manages the storage allocation of data on stack and heap.
  • 8. Stack • A stack is an array of memory that acts as a last-in, first-out (LIFO) data structure. • Stack-based memory allocation is very simple and typically faster than heap-based memory allocation • Data can be added to and deleted only from the top of the stack. • Placing a data item at the top of the stack is called pushing the item onto the stack. • Deleting an item from the top of the stack is called popping the item from the stack.
  • 9. Heap • Chunks of memory are allocated to store certain kinds of data objects. • Memory can be stored and removed from the heap in any order. • Heap is also known as dynamic memory.
  • 10. Data type A classification for identifying one of various types of data •A type as a template for creating data structures. •A type is defined by the following elements: –A name. –A data structure to contain its data members. –Behaviors and constraints. E.g. –Integer •32 bit or 64bit, stores integers only. –Boolean •1 byte, true or false. –Real •64 bit, floating point numbers.
  • 11. Data type There are two kind of data types: Value type –Stored in stack. –Require only a single segment of memory. –E.g. •Integer •Boolean •Real Reference type –Require two segments of memory –The first contains the actual data—and is always located in the heap. –The second is a reference that points to where in the heap the data is stored. –E.g. •String •Object
  • 12. Variables The name, or identifier, for a variable points to a memory location where information of a specific data type is stored. •Names must be limited to ASCII letters, digits, and the underscore character (_). •Letters can be either uppercase or lowercase. •The first character must be either a letter or the underscore character. •Best Practice, variable names should begin with a lowercase letter i.e. Camel Casing. –myVariable, custTable •Why use Variables ? –Variables can maintain the same value throughout the program. –Changing value at one place will reflect throughout the scope.
  • 13. Variable Declaration Variable always be declared with some data type. Declaration with initialization Multiple Declaration –The variables in a multiple-variable declaration must all be of the same type. –The variable names must be separated with commas.
  • 14. Method Lines of code that perform a specific task. –[ Modifiers ] ReturnType MethodName( ParameterList ) { //body } Public void Test(int i) { } Modifiers public | protected | private|static ReturnType Datatype | void MethodName Identifier Parameter Datatype Variableidentifier [ = Expression ]
  • 15. Method Example Return sum of any two integers.
  • 16. Method Invocation •Execution of the current method suspends at that point of the invocation. •Control transfers to the beginning of the invoked method. •The invoked method executes until it completes. •Control returns to the calling method.
  • 17. Method Parameters • By Value • –It allocates space on the stack for the formal parameters. • –It copies the values of the actual parameters to the formal parameters. • By Reference • –It copies the address of variable not the value. • –The actual parameter must be a variable.
  • 18. By reference & By Value Example
  • 19. •Local variable –Alive until method returns. •Global variable –Alive until application shutdown. –Company Name •Constants –Once set, the value cannot be changed –Must be used instead of hard-coded values –E.g. Labels file Variable Scope
  • 21. Control Statements Conditional •Skip part of code or execute only desired portion –If –If Else –If Else-if Else –Switch Loops •Executes same lines of code once or more than one time –While –Do - While –For
  • 22. Conditional- if-[else-if] – [else] if statement evaluates a question (condition). •Executes a statement(s) if condition is true. •Syntax if(expression) { statement } [ elseif(expression) //can have multiple elseif // statements { statement }……… else // only one else statement { statement } ]
  • 23. Recursion •Recursion can be used to manage repetition. •Recursion is a process in which a module achieves a repetition of algorithmic steps by calling itself. •Each recursive call is based on a different, generally simpler, instance.
  • 24. Fundamental Rules Base Case –Always have at least one case that can be solved without recursion. Make Progress – Any recursive call must progress towards a base case. Always Believe – Always assume the recursive call works. Compound Interest Rule – Never duplicate work by solving the same instance of a problem in separate recursive calls.
  • 25. Recursion Example Calculating 5! Input n = 5; Factorial (n); 120 •5* a where a = Factorial(n -1) a = 24 •4* a a = 6 •3 * a a = 2 •2* 1