CONCEITOS DE LINGUAGEM DE PROGRAMAÇÃO …rogerio/material_auxiliar/CLP20131_caract... ·...

37
CONCEITOS DE LINGUAGEM DE PROGRAMAÇÃO CARACTERÍSTICAS João Gabriel Ganem Barbosa

Transcript of CONCEITOS DE LINGUAGEM DE PROGRAMAÇÃO …rogerio/material_auxiliar/CLP20131_caract... ·...

Page 1: CONCEITOS DE LINGUAGEM DE PROGRAMAÇÃO …rogerio/material_auxiliar/CLP20131_caract... · Programação Estruturada ! Programação Modular ! Programação Linear ! Programação

CONCEITOS DE LINGUAGEM DE PROGRAMAÇÃO

CARACTERÍSTICAS

João Gabriel Ganem Barbosa

Page 2: CONCEITOS DE LINGUAGEM DE PROGRAMAÇÃO …rogerio/material_auxiliar/CLP20131_caract... · Programação Estruturada ! Programação Modular ! Programação Linear ! Programação

Sumário

¨  Motivação ¨  História ¨  Linha do Tempo ¨  Divisão

¤ Conceitos ¤ Paradigmas ¤ Geração

¨  Tipos de Dados ¨  Operadores ¨  Estruturada vs OO

¤ Vantagens ¤ Desvantagens

Page 3: CONCEITOS DE LINGUAGEM DE PROGRAMAÇÃO …rogerio/material_auxiliar/CLP20131_caract... · Programação Estruturada ! Programação Modular ! Programação Linear ! Programação

Introdução - Motivacional

¨  Por que estudar CLP?

¨  Conhecer os princípios e mecanismos por trás da linguagem

¨  Facilitar a curva de aprendizado das linguagens ¨  Melhorar o uso e diminuir o tempo de programação ¨  Escolher melhor a linguagem para resolver um

problema

Page 4: CONCEITOS DE LINGUAGEM DE PROGRAMAÇÃO …rogerio/material_auxiliar/CLP20131_caract... · Programação Estruturada ! Programação Modular ! Programação Linear ! Programação

História

¨  O primeiro trabalho foi da Ada Lovelace, em 1843.

¨  Uma das primeiras linguagens de programação para computadores foi Plankalkul

¨  O primeiro compilador escrito foi para a linguagem A-0, em 1952 por Grace Hopper

Page 5: CONCEITOS DE LINGUAGEM DE PROGRAMAÇÃO …rogerio/material_auxiliar/CLP20131_caract... · Programação Estruturada ! Programação Modular ! Programação Linear ! Programação

História

¨  A primeira linguagem de alto nível amplamente usada foi Fortran, criada em 1954

Page 6: CONCEITOS DE LINGUAGEM DE PROGRAMAÇÃO …rogerio/material_auxiliar/CLP20131_caract... · Programação Estruturada ! Programação Modular ! Programação Linear ! Programação

Linha do Tempo – Década de 50

1954 – FORTRAN 1958 – LISP 1959 - COBOL

Page 7: CONCEITOS DE LINGUAGEM DE PROGRAMAÇÃO …rogerio/material_auxiliar/CLP20131_caract... · Programação Estruturada ! Programação Modular ! Programação Linear ! Programação

Décadas de 60 e 70

¨  1962 – Simula ¨  1964 – Basic ¨  1970 – Pascal ¨  1973 – C ¨  1972 – Smalltalk (OO) ¨  1972 - Prolog

Page 8: CONCEITOS DE LINGUAGEM DE PROGRAMAÇÃO …rogerio/material_auxiliar/CLP20131_caract... · Programação Estruturada ! Programação Modular ! Programação Linear ! Programação

Década de 80

¨  1982 – ADA (Sistemas modulares)

¨  1983 – C++

¨  1987 – Perl

Page 9: CONCEITOS DE LINGUAGEM DE PROGRAMAÇÃO …rogerio/material_auxiliar/CLP20131_caract... · Programação Estruturada ! Programação Modular ! Programação Linear ! Programação

Década de 90

¨  1990 – Haskell ¨  1991 – Python ¨  1991 – Java ¨  1993 – Ruby ¨  1993 – Lua ¨  1995 – JavaScript ¨  1995 – PHP ¨  2000 – C#

Page 10: CONCEITOS DE LINGUAGEM DE PROGRAMAÇÃO …rogerio/material_auxiliar/CLP20131_caract... · Programação Estruturada ! Programação Modular ! Programação Linear ! Programação

Conceitos

¤ Programação Estruturada ¤ Programação Modular ¤ Programação Linear ¤ Programação Orientada a Objetos

Page 11: CONCEITOS DE LINGUAGEM DE PROGRAMAÇÃO …rogerio/material_auxiliar/CLP20131_caract... · Programação Estruturada ! Programação Modular ! Programação Linear ! Programação

Programação Estruturada

¤ Três estruturas: Sequência, Decisão e Repetição

¤ Haskell

¤ Dominou a criação de software até a OO

¤ Ainda é amplamente utilizada

Page 12: CONCEITOS DE LINGUAGEM DE PROGRAMAÇÃO …rogerio/material_auxiliar/CLP20131_caract... · Programação Estruturada ! Programação Modular ! Programação Linear ! Programação

Programação Modular

¤ Desenvolvimento de rotinas através de módulos

¤ Modula-2 e Modula-3

Page 13: CONCEITOS DE LINGUAGEM DE PROGRAMAÇÃO …rogerio/material_auxiliar/CLP20131_caract... · Programação Estruturada ! Programação Modular ! Programação Linear ! Programação

Programação Linear

¤ Utilizado para resolução de problemas matemáticos

Page 14: CONCEITOS DE LINGUAGEM DE PROGRAMAÇÃO …rogerio/material_auxiliar/CLP20131_caract... · Programação Estruturada ! Programação Modular ! Programação Linear ! Programação

Programação Orientada a Objetos

Baseado na composição e interação entre unidades chamadas de objetos Maior facilidade em modelar o mundo real Mais utilizada atualmente para desenvolvimento

Page 15: CONCEITOS DE LINGUAGEM DE PROGRAMAÇÃO …rogerio/material_auxiliar/CLP20131_caract... · Programação Estruturada ! Programação Modular ! Programação Linear ! Programação

Paradigmas

¨  Imperativos ¤ Procedural

n BASIC e Fortran

¤ Estrutura de Blocos n Pascal e C

¤ Orientação a Objetos n C++, Java, Python

¤ Computação Distribuída n Ada

Page 16: CONCEITOS DE LINGUAGEM DE PROGRAMAÇÃO …rogerio/material_auxiliar/CLP20131_caract... · Programação Estruturada ! Programação Modular ! Programação Linear ! Programação

Paradigmas

¨  Declarativos ¤ Funcional

n  LISP e Haskell

¤ Programação Lógica n Prolog

Page 17: CONCEITOS DE LINGUAGEM DE PROGRAMAÇÃO …rogerio/material_auxiliar/CLP20131_caract... · Programação Estruturada ! Programação Modular ! Programação Linear ! Programação

Gerações

¨  1ª Geração ¤ Estruturas de controle orientadas a máquina ¤ Fortran

¨  2ª Geração ¤ Estruturadas para minimizar o uso do GOTO ¤ Algol 60

¨  3ª Geração ¤ Enfase a Simplicidade e Eficiência ¤ Pascal

Page 18: CONCEITOS DE LINGUAGEM DE PROGRAMAÇÃO …rogerio/material_auxiliar/CLP20131_caract... · Programação Estruturada ! Programação Modular ! Programação Linear ! Programação

Gerações

¨  4ª Geração ¤ Linguagens com abstração de dados ¤ Encapsulamento ¤ Ada

¨  5ª Geração ¤ Orientação a Objeto ¤ Paradigma Funcional ¤ Java, Prolog

Page 19: CONCEITOS DE LINGUAGEM DE PROGRAMAÇÃO …rogerio/material_auxiliar/CLP20131_caract... · Programação Estruturada ! Programação Modular ! Programação Linear ! Programação

Características das Linguagens de Programação

¨  Simplicidade ¨  Abstração de dados ¨  Ortogonalidade ¨  Expressividade ¨  Eficiência ¨  Portabilidade ¨  Leitura ¨  Confiabilidade

Page 20: CONCEITOS DE LINGUAGEM DE PROGRAMAÇÃO …rogerio/material_auxiliar/CLP20131_caract... · Programação Estruturada ! Programação Modular ! Programação Linear ! Programação

Abstração de Dados

¨  Abstração é o processo ou resultado de generalização por redução do conteúdo da informação de um conceito ou fenômeno observável

¨  A abstração de dados permite reduzir a informação necessária para a criação de um programa através das variáveis envolvidas em uma única entidade fechada.

Page 21: CONCEITOS DE LINGUAGEM DE PROGRAMAÇÃO …rogerio/material_auxiliar/CLP20131_caract... · Programação Estruturada ! Programação Modular ! Programação Linear ! Programação

Abstração de Dados

¨  Exemplo:

¨  struct Cliente { ! Nome! Idade! CPF! }!

Page 22: CONCEITOS DE LINGUAGEM DE PROGRAMAÇÃO …rogerio/material_auxiliar/CLP20131_caract... · Programação Estruturada ! Programação Modular ! Programação Linear ! Programação

Encapsulamento

¨  Separar um programa em partes

¨  Tornar o software Flexível

¨  Fácil Manutenção

¨  Impedir acesso a atributos

¨  Acesso se dá por métodos definidos

Page 23: CONCEITOS DE LINGUAGEM DE PROGRAMAÇÃO …rogerio/material_auxiliar/CLP20131_caract... · Programação Estruturada ! Programação Modular ! Programação Linear ! Programação

Polimorfismo

¨  Classes derivadas de uma Classe base conseguem tomar diferentes formas

¨  Herança

¨  Mesmo métoodo, comportamentos diferentes

Page 24: CONCEITOS DE LINGUAGEM DE PROGRAMAÇÃO …rogerio/material_auxiliar/CLP20131_caract... · Programação Estruturada ! Programação Modular ! Programação Linear ! Programação

Tipos de Dados

¨  int ¨  float ¨  double ¨  char ¨  byte ¨  short ¨  long ¨  boolean

Page 25: CONCEITOS DE LINGUAGEM DE PROGRAMAÇÃO …rogerio/material_auxiliar/CLP20131_caract... · Programação Estruturada ! Programação Modular ! Programação Linear ! Programação

Estruturas de Repetição

¨  if ¨  else ¨  switch ¨  for ¨  while ¨  do while ¨  break ¨  continue ¨  return

¨  try ¨  catch ¨  finally

Page 26: CONCEITOS DE LINGUAGEM DE PROGRAMAÇÃO …rogerio/material_auxiliar/CLP20131_caract... · Programação Estruturada ! Programação Modular ! Programação Linear ! Programação

Palavras Reservadas C

¨  auto ¨  break ¨  case ¨  char ¨  const ¨  continue ¨  default ¨  do double ¨  else ¨  enum

¨  extern ¨  float ¨  for ¨  goto ¨  if ¨  int ¨  long ¨  register ¨  return ¨  short

¨  signed ¨  sizeof ¨  static struct ¨  switch ¨  typedef ¨  union ¨  unsigned ¨  void ¨  volatile ¨  while

Page 27: CONCEITOS DE LINGUAGEM DE PROGRAMAÇÃO …rogerio/material_auxiliar/CLP20131_caract... · Programação Estruturada ! Programação Modular ! Programação Linear ! Programação

Palavras Reservadas Java

¨  package ¨  import ¨  new ¨  class ¨  interface ¨  enum ¨  abstract ¨  final ¨  implements ¨  extends ¨  instanceof ¨  public ¨  private ¨  protected

¨  super ¨  this ¨  throw ¨  throws ¨  try ¨  catch ¨  finally ¨  if ¨  else ¨  for ¨  do ¨  while ¨  switch ¨  case

¨  default ¨  break ¨  continue ¨  return ¨  boolean ¨  byte ¨  short ¨  int ¨  long ¨  double ¨  float ¨  char ¨  void ¨  strictfp

¨  transient ¨  volatile ¨  synchronized ¨  native ¨  assert ¨  static ¨  goto ¨  const ¨  true ¨  false ¨  null

Page 28: CONCEITOS DE LINGUAGEM DE PROGRAMAÇÃO …rogerio/material_auxiliar/CLP20131_caract... · Programação Estruturada ! Programação Modular ! Programação Linear ! Programação

Operadores Aritméticos

Operador Descrição

= Atribuição

+ Soma

- Subtração

/ Divisão

% Resto

Page 29: CONCEITOS DE LINGUAGEM DE PROGRAMAÇÃO …rogerio/material_auxiliar/CLP20131_caract... · Programação Estruturada ! Programação Modular ! Programação Linear ! Programação

Incremento e Decremento

Operador Descrição

++ Incremento ( x++ ou ++x)

-- Decremento (x-- ou --x)

Page 30: CONCEITOS DE LINGUAGEM DE PROGRAMAÇÃO …rogerio/material_auxiliar/CLP20131_caract... · Programação Estruturada ! Programação Modular ! Programação Linear ! Programação

Operadores Relacionais

Operador Descrição

> Maior que

< Menor que

>= Maior ou igual

<= Menor ou igual

== Igual a

!= Diferente de

Page 31: CONCEITOS DE LINGUAGEM DE PROGRAMAÇÃO …rogerio/material_auxiliar/CLP20131_caract... · Programação Estruturada ! Programação Modular ! Programação Linear ! Programação

Operadores Lógicos

Operador Descrição

&& E

|| OU

! Não (Negação)

Page 32: CONCEITOS DE LINGUAGEM DE PROGRAMAÇÃO …rogerio/material_auxiliar/CLP20131_caract... · Programação Estruturada ! Programação Modular ! Programação Linear ! Programação

Operadores Bit-a-Bit

Operador Descrição

& E

| OU

ˆ XOR (Ou exclusivo)

<< Shift a esquerda

>> Shift a direita

Page 33: CONCEITOS DE LINGUAGEM DE PROGRAMAÇÃO …rogerio/material_auxiliar/CLP20131_caract... · Programação Estruturada ! Programação Modular ! Programação Linear ! Programação

Estruturada Vs OO

¨  Portabilidade ¤ Em Java, o programa roda em cima de uma máquina

virtual, que pode ser instalada nos sistemas mais utilizados (linux, OS e Windows), permitindo uma portabilidade muito maior que o C

¤ Em C, o programa é distribuído no formato binário executável exclusivamente para a plataforma em que foi compilado, podendo dar conflito até em tipos diferentes de processador

Page 34: CONCEITOS DE LINGUAGEM DE PROGRAMAÇÃO …rogerio/material_auxiliar/CLP20131_caract... · Programação Estruturada ! Programação Modular ! Programação Linear ! Programação

Estruturada Vs OO

¨  Segurança ¤ Em C, é possível ao programador acessar áreas de

memória que não dizem respeito ao programa. ¤ Vírus podem ser criados em C ¤ Java é amplamente utilizado em serviços WEB por ser

mais seguro (mas nem tanto).

Page 35: CONCEITOS DE LINGUAGEM DE PROGRAMAÇÃO …rogerio/material_auxiliar/CLP20131_caract... · Programação Estruturada ! Programação Modular ! Programação Linear ! Programação

Estruturada Vs OO

¨  Encapsulamento ¤ Em Java, pode-se declarar os atributos e métodos

como public, protected e private

¤ Em C, através de Structs

Page 36: CONCEITOS DE LINGUAGEM DE PROGRAMAÇÃO …rogerio/material_auxiliar/CLP20131_caract... · Programação Estruturada ! Programação Modular ! Programação Linear ! Programação

Estruturada Vs OO

¨  Aplicações ¤ Java

n OpenOffice n  Jdownloader n Netbeans

¤ C n Kernel do Linux

Page 37: CONCEITOS DE LINGUAGEM DE PROGRAMAÇÃO …rogerio/material_auxiliar/CLP20131_caract... · Programação Estruturada ! Programação Modular ! Programação Linear ! Programação

CLP

¨  Dúvidas?