Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
21 views

Gis Programming Assignment 1

Uploaded by

tanianorah2
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Gis Programming Assignment 1

Uploaded by

tanianorah2
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

NAME: TANIA GUETH NORAH

REG NO: ENC222-0132/2021

UNIT: GIS PROGRAMMING

TITLE: ASSIGNMENT 1
HOW PYTHON EXECUTES A SCRIPT:

PYTHON INTERPRETER:

 A python interpreter is a computer program that converts each high-level program


statement into machine code. An interpreter translates the command that you write out
into code that the computer can understand.
 When using a python interpreter, the programmer types in the command, the interpreter
reads the command, evaluates it, prints the results, and then goes back to read the
command.

HOW THE PYTHON INTERPRETER WORKS:

STEP 1: INTERPRETER STARTS WITH SOURCE CODE ANALYSIS


 The interpreter checks or analyses the source code (High-level language you write programs
in). So CPython receives the source code and initializes several commands to do some vital
things.
 The interpreter ensures you follow Python’s syntax for writing code. It also checks for
incorrect lines of code. If it encounters any error in a line, it stops the program from running
and produces an error message.

STEP 2: INTERPRETER GENERATES BYTE CODE


 After lexical analysis (process described in step one) the interpreter moves to byte code
generation. After receiving the tokens, the interpreter generates the Abstract Syntax Tree
(AST). The tree is converted to machine language (i.e: 1s and 0s)

STEP 3: INTERPRETER INITILIZES A PVM

 The interpreter initializes the Python Virtual Machine. PVM is crucial as it’s what converts
the byte code into binary code.
 After conversion, the results are then printed. Python prints out the correct result if there
are no high-level language errors. Otherwise it prints out an error message.

PYTHON INTERPRETER TO BE USED:

Most people recommend the use of Python 3.x interpreter as it has more improved features such as
bug fixes, security and standard library modules.

HOW DOES THE COMPUTER KNOW WHERE THE INTERPRETER IS?

PYTHON FOLDER STRUCTURE:

 There are 2 main general structures: the flat layout and the src layout
 The “flat layout” refers to organising a project’s files in a folder or repository, such that the
various configuration files and import packages are all in the top level directory.
 .
├── README.md
├── noxfile.py
├── pyproject.toml
├──setup.py
├──awesome_package/
│ ├── __init__.py
│ └── module.py
└──tools/
├── generate_awesomeness.py
└── decrease_world_suck.py
 The “src layout” deviates from the flat layout by moving the code that is intended to be
importable (i.e import awesome_package, also known as import packages) into a
subdirectory.
 .
├── README.md
├── noxfile.py
├── pyproject.toml
├── setup.py
├── src/
│ └── awesome_package/
│ ├── __init__.py
│ └── module.py
└── tools/
├── generate_awesomeness.py
└── decrease_world_suck.py

INTEGRATED DEVELOPMENT ENVIRONMENT.

WHAT ARE IDEs?

 It is a software application that helps programmers develop software code efficiently. It


increases developer productivity by combining capabilities such as software editing,
building, testing and packaging in an easy to use application.

WHY ARE IDEs IMPORTANT?

 They are important because they include functionality that goes beyond text editing. They
provide a central interface for common developer tools, making the software development
process more efficient.

REASONS FOR USING IDEs

1) Code Editing Automation


 Programming languages have rules for how statements must be structured. Because an IDE
knows these rules, it contains many intelligent features for automatically writing or editing
the source code.
2) Syntax Highlighting
 An IDE can format the written text by automatically making some words bold or italic, or
by using different font colours. These visual cues make the source code more readable
and give instant feedback about accidental syntax errors.
3) Intelligent Code Completion
 An IDE can make suggestions to complete a code statement when the developer begins
typing.
4) Refactoring Support
 Code refactoring is the process of restructuring the source code to make it more
efficient and readable without changing its core functionality.
COMMON FEATURES OF AN IDE
 Source code editor
 Build automation – Performing repeatable development tasks that are typically part of every
code change.
 Debugger – Process of fixing any errors or bugs that testing reveals.

COMMON IDEs USED:

1. IDLE (Integrated Development and Learning Environment)


 It is an integrated development environment for Python, which has been bundles with
the default implementation of the language.
 It is the default IDE that comes with Python.

Pros of using IDLE

i. It is easy to use and navigate, with a simple interface that is well-suited to new
programmers.
ii. It is lightweight and fast, which makes it a good choice for older computers or those with
limited resources
iii. It is included with Python, so you don’t need to download or install anything extra to start
using it.

Cons to using IDLE

i. It lacks some advanced features that more experienced programmers might find useful, such
as debugging tools or code completion.
ii. Its simple interface can make it difficult to find certain features or settings.
iii. It does not have the best performance when working with large projects.

2. Aptana Studio.
 It is an open source IDE for building web applications.
 It supports JavaScript, HTML, DOM and CSS with code completion, outlining,
JavaScript debugging, error and warning notifications and integrated
documentation.
 The main features of Aptana studio are:
i. GIT Integration
ii. IDE Customization
iii. Integrated debugger
iv. Deployment wizard
v. Built-In Terminal
vi. HTML, CSS and JavaScript Code assist

PyCharm as an IDE
 Most professional developers use PyCharm and it has been considered the best IDE for
python developers.
 It was developed by the Czech company JetBrains and it’s a cross-platform IDE.
 It gives daily tips to improve your knowledge of how you can use it more efficiently which is
a very good feature.
 It comes in two versions, community version and a professional version where the
community version is free but the professional version is paid for.
 Its other features are:
i. It is considered an intelligent code editor, fast and safe refactoring, and smart code.
ii. Features for debugging, profiling, remote development, testing the code, auto code
completion, quick fixing, error detection and tools of the database.

Advantages of PyCharm

 It is easy to install and use.


 Syntax and error maintenance can help in the analysis of syntax errors even before you
compile your code.
 Import assistance can allow importing missing libraries from another part of the project.
 Code completion allows you to complete the names of classes, methods, parameters and
other variables depending on the context.
 It comes with many plugins that can be used to enhance a project.
 It has a huge community that can help you in case you find any difficulty.

Disadvantages of using PyCharm

 It takes more space than other text editors, which degrades the functionality of code
 The community version is idle for Python development only and does not allow to use of
other programming languages.
 The professional version is somewhat expensive.
 It can be complicates for beginners to set a virtual environment and variable, and thus they
might not prefer to use it.

You might also like