0% found this document useful (0 votes)
2 views53 pages

Lesson 1

The document provides an introduction to programming, emphasizing its definition, importance, and the various programming languages, particularly Java and Python. It outlines the characteristics, applications, and evolution of both languages, highlighting their differences in syntax and usage. Additionally, it discusses basic programming concepts and includes activities for students to engage with the material.

Uploaded by

zekizek929
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views53 pages

Lesson 1

The document provides an introduction to programming, emphasizing its definition, importance, and the various programming languages, particularly Java and Python. It outlines the characteristics, applications, and evolution of both languages, highlighting their differences in syntax and usage. Additionally, it discusses basic programming concepts and includes activities for students to engage with the material.

Uploaded by

zekizek929
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 53

Grade 10

Mr. Errold Kim D. Cruza


(Computer Subject Teacher)

INTRODUCTION TO
PROGRAMMING
Definition of
Programming
 Programming is the process of
instructing a computer to perform a task
by providing it with a sequence of
instructions, also known as code, that
specifies the operations to be performed
and the order in which they are to be
executed.
Importance of Learning
Programming at a Young Age
 Problem-Solving Skills
 Critical Thinking
 Creativity and Innovation
 Future Career Opportunities
 Digital Literacy
 Collaboration and Communication
 Adaptability and Resilience
 Preparation for the Future
Programming Languages
Programming Languages
 What are Programming Languages?
-Programming languages are formal
languages used to instruct computers to
perform specific tasks. They enable
programmers to communicate instructions
to computers effectively.
Types of Programming
Languages:
High-Level vs. Low-Level Languages:

 High-Level Languages: Designed to be


easy for humans to read and write.
Examples include Python, Java, C++,
and JavaScript.
 Low-Level Languages: Closer to
machine code and hardware. Examples
include Assembly language.
High-Level Languages
Low-Level Languages
Python Programming
Language
Overview of Python
 Characteristics:
- Interpreted language: Code is executed
line by line.High-level: Syntax is human-
readable and abstracted from hardware.
- Dynamically typed: Variable types are
determined at runtime.
- Versatile: Used in web development,
data analysis, artificial intelligence, etc.
Applications
 Web development (Django, Flask)
 Data analysis and visualization (Pandas,
Matplotlib)
 Artificial intelligence and machine
learning (TensorFlow, PyTorch)
Python Example Codes
Java Programming
Language
Overview of Java:
 Characteristics:
- Compiled language: Code is compiled
into bytecode and then executed on Java
Virtual Machine (JVM).
- Object-oriented: Emphasizes modular
and reusable code through classes and
objects.
- Platform-independent: Runs on any
device with a Java Virtual Machine.
Applications
 Enterprise applications (banking
systems, e-commerce platforms)
 Android app development
 Big data technologies (Hadoop, Apache
Spark)
Java Example Codes
Basic Concepts of
Programming
Basic Concepts of Programming

 Variables and data types


 Operators (arithmetic, comparison,
logical)
 Control structures (if statements,
loops)
Definition
 Variables are containers
used to store data values
in a computer program.
They provide a way to
label and manipulate
data in memory.
Characteristics:
 Name: A variable is given a name
(identifier) that uniquely identifies it
within the program.
 Value: Stores a data value that can
change during the execution of the
program.
 Type: Variables have a data type that
determines the kind of data they can
hold.
Example in Python:

 Here, ‘age’ stores an integer value,


‘name’ stores a string, and is_student
stores a boolean value (True).
Java vs Python
Brief overview of Java and
Python
 Java:
 Type: Object-oriented, statically typed.

 Syntax: Strongly typed, requires explicit declaration of variables.

 Performance: Generally faster due to static typing and JVM


optimizations.

 Platform: Runs on the Java Virtual Machine (JVM), making it cross-


platform (write once, run anywhere).

 Use Cases: Enterprise applications, Android app development,


large systems, server-side applications.

 Notable Features: Strong concurrency support, rich API, extensive


libraries, and frameworks like Spring and Hibernate.
Brief overview of Java and
Python
 Python:
 Type: High-level, dynamically typed.

 Syntax: Easy-to-read and concise, supports multiple programming


paradigms (object-oriented, imperative, functional).

 Performance: Slower compared to Java due to dynamic typing and


interpreted nature.

 Platform: Interpreted language, widely used across different platforms.

 Use Cases: Web development, data analysis, artificial intelligence,


scientific computing, scripting, automation.

 Notable Features: Simple syntax, extensive standard library, popular


frameworks like Django and Flask, and a strong community focus on
data science and machine learning with libraries like NumPy, Pandas,
and TensorFlow.
History and Evolution of
Java
Origins and Early Development:
 1991: Java was conceived by James Gosling and
his team at Sun Microsystems as part of a project
initially known as "Oak". The goal was to create a
language for programming embedded systems in
consumer electronics.

 1995: Oak was renamed "Java", and it was officially


released as a core component of Sun Microsystems’
development platform. It gained widespread
attention after being showcased in the Netscape
Navigator web browser, which allowed Java applets
(small applications) to run in the browser.
Key Milestones:
 Java 1.0 (1996): The first official release included the
foundational libraries and the core language features.

 Java 1.1 (1997): Introduced inner classes, JDBC (Java


Database Connectivity), and RMI (Remote Method
Invocation).

 Java 2 (1998): Marked a major milestone with the


introduction of the Java 2 Platform, which included
Swing for GUI development, the Collections Framework,
and the introduction of three distinct platforms: Standard
Edition (SE), Enterprise Edition (EE), and Micro Edition
(ME).
Further Evolution:
 Java 5 (2004): Known as J2SE 5.0, it introduced significant
language features like generics, metadata annotations, enumerated
types, and the enhanced for loop.

 Java 6 (2006): Focused on performance improvements, scripting


support through the inclusion of the Java Compiler API, and
enhancements to the JVM.

 Java 7 (2011): Included features like the try-with-resources


statement, the diamond operator, and the fork/join framework for
parallel processing.

 Java 8 (2014): A major release with lambda expressions, the Stream


API, and the introduction of the java.time package for improved
date and time handling.

 Java 9 (2017): Introduced the module system (Project Jigsaw),


allowing for better modularization of code.
Further Evolution:
 Java 10 (2018): Added features like local-variable
type inference (var).

 Java 11 (2018): The first Long-Term Support (LTS)


release after Java 8, introducing new features and
removing deprecated ones.

 Java 12-16 (2019-2021): Focused on incremental


updates with new features like switch expressions,
text blocks, and pattern matching.

 Java 17 (2021): Another LTS release, incorporating


many new features from previous versions and long-
Recent Developments:
 Java 18-21 (2022-2024):
Continued to add features and
improvements, including support
for records, sealed classes, and
enhancements to pattern
matching.
Current Status
 Java continues to be widely used in
enterprise environments, Android app
development, and various other
applications. It is maintained by Oracle
Corporation and has a strong community
that contributes to its ongoing
development and evolution.
 Java's evolution reflects its adaptability
and continued relevance in the
programming world.
History and Evolution of Python
Origins and Early Development
 1980s: Python was conceived by Guido van
Rossum during his work at Centrum Wiskunde
& Informatica (CWI) in the Netherlands. It was
designed as an alternative to the ABC
language, which van Rossum found too limiting.

 1991: Python 0.9.0 was released to the public.


This version included many features that are
still present today, such as exception handling,
functions, and the core data types (lists, dicts,
and strings).
Key Milestones
 Python 1.0 (1994): The first official release. It introduced
features like modules, exceptions, functions, and the core data
types. It also had a strong emphasis on code readability and
simplicity.

 Python 2.0 (2000): Introduced list comprehensions, garbage


collection, and Unicode support. Python 2.x continued to
evolve over the years with many incremental updates,
including new features like the with statement, @staticmethod,
and @classmethod decorators.

 Python 2.7 (2010): The last major release in the Python 2.x
series. It became a Long-Term Support (LTS) version,
providing bug fixes and security updates until its official end of
life in January 2020.
Python 3.x Era:
 Python 3.0 (2008): A major release that was not backward
compatible with Python 2.x. It aimed to fix design flaws and clean
up the language. Key features included print as a function, new
syntax for division (true division), and improved Unicode support.

 Python 3.1-3.4 (2009-2014): Incremental improvements and new


features, such as the collections module enhancements, the
introduction of asyncio, and improvements in performance and
standard library modules.

 Python 3.5 (2015): Introduced significant features such as the


async and await keywords for asynchronous programming, type
hints, and the matrix multiplication operator.Python 3.6 (2016):
Added formatted string literals (f-strings), underscores in numeric
literals, and improvements to the standard library.
Python 3.x Era:
 Python 3.7 (2018): Brought new features like data classes, context
variables, and performance improvements.

 Python 3.8 (2019): Introduced assignment expressions (the walrus


operator :=), positional-only parameters, and f-string improvements.

 Python 3.9 (2020): Added new features like dictionary merge operators,
type hinting improvements, and the removal of deprecated modules.

 Python 3.10 (2021): Brought structural pattern matching, precise line


numbers in tracebacks, and other enhancements.Python 3.11 (2022):
Focused on performance improvements and introduced features such
as exception groups and improved error messages.

 Python 3.12 (2023): Continued to build on previous improvements with


further optimizations and new language features.
Current Status
 Python remains one of the most popular
programming languages, widely used in web
development, data science, artificial intelligence,
automation, and more. Its emphasis on
readability, ease of learning, and a vast
ecosystem of libraries and frameworks contribute
to its ongoing popularity.

 Python is maintained by the Python Software


Foundation (PSF) and continues to evolve with
contributions from a global community of
developers.
Activity 1
 Create a Timeline for both JAVA and
PYTHON.
Syntax and Readability
Java
 Method Declarations:
 Methods require explicit declarations of
return types and parameters.

 For example:
Java
 Explicit Declarations
 Type Declarations: In Java, you must
explicitly declare the type of each
variable.
 For example:
Boilerplate Code
 Getters and Setters: Java often requires you to write
boilerplate code for getters and setters, though frameworks
and tools can help reduce this.

 For example:
Class Definitions
 Class and Object Creation: Java requires explicit
class definitions and object creation.

 For example:
Exception Handling
 Try-Catch Blocks: Java requires
explicit exception handling, which can
add to the verbosity.
 For example:
Generics and Type Parameters
 Generics: Java's use of generics
requires specifying type parameters,
which can add verbosity.
 For example:
Java Verbose Syntax Summary
 While Java's verbose syntax can be
seen as a drawback due to the
additional lines of code and boilerplate it
often requires, it is also designed to
provide strong type safety, clarity, and
maintainability. Many developers find
that the explicit nature of Java's syntax
helps to prevent errors and improves the
readability of the code, especially in
large and complex systems.
Python
 Although Python is dynamically typed, it
often requires explicit initialization and
clear variable assignments, which can
add to the verbosity:
 For example:
Class and Method
Definitions
 Defining classes and methods in Python can be more
verbose, especially when implementing features like getters
and setters.
 For example:
Exception Handling
 Python's exception handling requires explicit try-except
blocks, which can add verbosity to error-prone code sections
 For example:
Decorators
 While decorators are powerful, they can make function
definitions longer and more complex.

 For example:
Decorators
 Data Validation.
 Validating data types or values often requires explicit checks:

 For example:
Context Managers
 Using context managers for resource management (like file
handling) adds some verbosity:

 For example:
Activity 2:
 Using the Venn Diagram compare and
contrast JAVA and PYTHON Syntax
Verbose

You might also like