Skip to main content

Programming ?!!!


PROGRAMMING

Hi Everyone !

What is Programming ?

Programming is the process of taking an algorithm and encoding it into a notation, a programming language, so that it can be executed by a computer.

Define Programming Language 

programming language is a special language programmers use to develop software programs, scripts, or other sets of instructions for computers to execute. 

Types of Programming Language

Different languages have different purposes, so it makes sense to talk about different kinds, or types, of languages. Some types are:
  • Machine languages, that are interpreted directly in hardware
  • Assembly languages, that are thin wrappers over a corresponding machine language
  • High-level languages, that are anything machine-independent
  • System languages, that are designed for writing low-level tasks, like memory and process management
  • Scripting languages, that are generally extremely high-level and powerful
  • Domain-specific languages, that are used in highly special-purpose areas only
  • Visual languages, that are non-text based
  • Esoteric languages, that are not really intended to be used, but are very interesting, funny, or educational in some way.

Machine Code

Most computers work by executing stored programs in a fetch-execute cycle. Machine code generally features:
  • Registers to store values and intermediate results
  • Very low-level machine instructions (addsubdivsqrt)
  • Labels and conditional jumps to express control flow
  • A lack of memory management support β€” programmers do that themselves
Machine code is usually written in hex. Here’s an example for the Intel 64 architecture:
89 F8 A9 01 00 00 00 75 06 6B C0 03 FF C0 C3 C1 E0 02 83 E8 03 C3

Assembly Language

An assembly language is an encoding of machine code into something more readable. It assigns human-readable labels (or names) to storage locations, jump targets, and subroutine starting addresses, but doesn’t really go too far beyond that.
        .globl  f
        .text
f:
        mov     %edi, %eax      # Put first parameter into eax register
        test    $1, %eax        # Examine least significant bit
        jnz     odd             # If it's not a zero, jump to odd
        imul    $3, %eax        # It's even, so multiply it by 3
        inc     %eax            # and add 1
        ret                     # and return it
odd:
        shl    $2, %eax         # It's odd, so multiply by 4
        sub    $3, %eax         # and subtract 3
        ret                     # and return it
And here’s the same function, written for the SPARC:
        .global f
f:
        andcc   %o0, 1, %g0
        bne     .L1
        sll     %o0, 2, %g2
        sll     %o0, 1, %g2
        add     %g2, %o0, %g2
        b       .L2
        add     %g2, 1, %o0
.L1:
        add     %g2, -3, %o0
.L2:
        retl
        nop

High-Level Languages

A high-level language gets away from all the constraints of a particular machine. HLLs have features such as:

  • Names for almost everything: variables, types, subroutines, constants, modules
  • Complex expressions (e.g. 2 * (y^5) >= 88 && sqrt(4.8) / 2 % 3 == 9)
  • Control structures (conditionals, switches, loops)
  • Composite types (arrays, structs)
  • Type declarations
  • Type checking
  • Easy, often implicit, ways to manage global, local and heap storage
  • Subroutines with their own private scope
  • Abstract data types, modules, packages, classes
  • Exceptions
e.g ; 
  1. C++
  2. C#
  3. Cobol
  4. Fortran
  5. Java
  6. JavaScript
  1. Objective C
  2. Pascal
  3. Perl
  4. PHP
  5. Python
  6. Swift

System Languages

System programming languages differ from application programming languages in that they are more concerned with managing a computer system rather than solving general problems in health care, game playing, or finance. In a system langauge, the programmer, not the runtime system, is generally responsible for:
  • Memory management
  • Process management
  • Data transfer
  • Caches
  • Device drivers
  • Directly interfacing with the operating system

Scripting Languages

Scripting languages are used for wiring together systems and applications at a very high level. They are almost always extremely expressive (they do a lot with very little code) and usually dynamic (meaning the compiler does very little, while the run-time system does almost everything).

Esoteric Languages

An esoteric language is one not intended to be taken seriously. They can be jokes, near-minimalistic, or despotic (purposely obfuscated or non-deterministic).



Java Programming Language

  • enables programmers to write computer instructions using English-based commands instead of having to write in numeric codes.
  • It’s known as a high-level language because it can be read and written easily by humans.
Java was designed with a few key principles in mind:

Ease to use 
  • The fundamentals of Java came from a programming language called C++. Although C++ is a powerful language, it is complex in its syntax and inadequate for some of Java's requirements. Java built on and improved the ideas of C++ to provide a programming language that was powerful and simple to use.
Reliability 
  • Java needed to reduce the likelihood of fatal errors from programmer mistakes. With this in mind, object-oriented programming was introduced. When data and its manipulation were packaged together in one place, Java was robust.
Security 
  • Because Java was originally targeting mobile devices that would be exchanging data over networks, it was built to include a high level of security. Java is probably the most secure programming language to date.
Platform Independence 
  • Programs need to work regardless of the machines they're being executed on. Java was written to be a portable and cross-platform language that doesn't care about the operating system, hardware, or devices that it's running on.
e.g ;



Language Paradigm

Definition
is a way in which computer language looks at the problem to be solved.


Types of Language Paradigm 

(a) Procedural 
  • Simple and straight forward
  • Routines and subroutines 
  • Top down , step by step instruction
(b) Object-oriented Program (OOP)
  • Approach to problem using where all computations are carried out using objects.
  • Object knows how to perform certain actions and how to interact with other elements of the program.
  • Example : Object is Ben ( People ) , Ben can Walk ( method ).
(c) Logic 
  • The program is the description of the desired results in the form of symbolic logic.
  • Example : Statements and symbolic logic 
  • Language : Prolog

Language Translator 

Definition : is a program that translates from one programming language into another.

Types of Translator :

(a) Interpreter 
  • Translates one high-level program instructions at atime (line by line) into machine code and immediately execute the code 
(b) Compiler 
  • Translate entire source program into an executable object program and saves it in a file which is ready for execution 
(c) Assembler 
  • Converts programs written in assembly language to machine code so that it can be executed


References :


Comments

Popular posts from this blog

How to disassemble a system unit πŸ™ƒ

HELLO EVERYONE πŸ‘‹πŸ» IM BACKKK !  So today im gonna share my experience about assembling and disassembling a system unit that me and friends did last friday ☺️   HOW TO DISASSEMBLE A SYSTEM UNIT πŸ’»   Step 1; Outer Casing  🌸 First off, unscrew the four screws on the back of the computer. On most computer cases, there will be large knobs that you can unscrew by hand or by screw driver on the back-right side of the computer. Once the screws removed then just slide it off . Step 2 ; System fan  🌸 most computers have 2 fans   a) system fan -the one blowing air to the computer b) CPU fan - the one blowing air onto the CPU heat sink . 🌸 unplug the fan from motherboard . Next , you need to unscrew the fan from the outside . You should now be able to lift the fan out the PC . Step 3 ; CPU fan  🌸 The CPU fan is located right on top of the CPU heat sink . It is hard to access becau...

Database

What is Database ? A database is a collection of  information  that is organized so that it can be easily accessed, managed and updated. Data is organized into rows, columns and tables, and it is indexed to make it easier to find relevant information. What is Database Management System? A database management system (DBMS) is system software for creating and managing  databases . The DBMS provides users and programmers with a systematic way to create, retrieve, update and manage  data .  Tables (Database) A database table is composed of records and fields that hold data. Tables are also called datasheets. Each table in a database holds data about a different, but related, subject. Figure 1 Record (Database) Data is stored in records.  A record is composed of fields and contains all the data about one particular person, company, or item in a database.  In this database, a record contains the data for one ...
The Computer System Unit The system unit is the box-like case that contains the electronic components of a computer. Many people erroneously refer to this as the CPU.                                                                            The Motherboard The motherboard is sometimes called the system board or main board. It is the main circuit board of a microcomputer.                                                                           Hard Disk Drive A hard disk drive is a high capacity, non-volatile, magnetic data storage device with a volume (disk) that is usually non-re...