0% found this document useful (0 votes)
46 views

Aula 01 - Java

This document provides an introduction to programming in Java without object-oriented concepts. It discusses what programming is, defines what a program is, demonstrates a simple "Hello World" Java program, and discusses Java conventions and tools like Eclipse. It also touches on Java's portability, libraries, and how to improve code through documentation and refactoring.

Uploaded by

jhon123jhon123
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views

Aula 01 - Java

This document provides an introduction to programming in Java without object-oriented concepts. It discusses what programming is, defines what a program is, demonstrates a simple "Hello World" Java program, and discusses Java conventions and tools like Eclipse. It also touches on Java's portability, libraries, and how to improve code through documentation and refactoring.

Uploaded by

jhon123jhon123
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

Projeto de Software / P3

Java sem Orientao a Objetos


Mrcio Ribeiro
[email protected]
twitter.com/marciomribeiro
ou a|ready know
how to program!
3
Aspects of programm|ng
! rogramm|ng |s contro|||ng
! rogramm|ng |s teach|ng
! rogramm|ng |s prob|em so|v|ng
! rogramm|ng |s creanve
! rogramm|ng |s abstracnon
! rogramm|ng |s concrete
! rogramm|ng |s mode|||ng
8ut... what |s a program?!
5
What |s a program?!
! Sequences of |nstrucnons expressed |n spec|hc programm|ng
|anguage
! Instrucnons wr|uen (programmed]coded) by programmers
! Mode| of comp|ex system
Cb[ect-Cr|ented rogramm|ng
to mode| our systems
8ut hrst, we need to study
an CC |anguage!
9
ne||o wor|d!
public class HelloWorld {

public static void main(String[] args) {
System.out.println("Hello World!");
}

}
10
Comp|||ng and Lxecunng
! [avac ne||oWor|d.[ava
! Iava Comp||er
! .c|ass h|e |s generated
! [ava ne||oWor|d
! Iava Interpreter

! What about the ma|n arguments?
! [ava Soma S 9
! args[0] = S
! args[1] = 9
11
Convennons
! Iava |s case sens|nve
! Why code convennons?
! 80 of the ||fenme cost of a p|ece of sohware goes to
ma|ntenance
! nard|y any sohware |s ma|nta|ned for |ts who|e ||fe by the
or|g|na| author
! Code convennons |mprove the readab|||ty of the sohware,
a||ow|ng eng|neers to understand new code more qu|ck|y and
thorough|y
!"#$ !""#$%%&&&'()*+,-'+(.%"-+!/-"&()0%1*2*%+(3-+(/24567856'!".,
12
Iava Code Convennon Lxamp|es
public class LinkedList<E> {

/**
* Adds the specified object at the beginning of this list.
*
* @param object the object to add.
*/
public void addFirst(E object) {
addFirstImpl(object);
}

/**
* Returns the first element in this list.
*
* @return the first element.
*/
public E getFirst() {
return getFirstImpl();
}


}
13
ou can use the [avadoc too|.
14
. to generate n1ML-based documentanon
15
Iava 1echno|ogy
! It |s a |anguage
! n|gh |eve|
! Sohware deve|opment process:



! It |s a p|auorm
! 1wo components
! "#$# &'()*#+ ,#-.'/0
! "#$# 122+'-#34/ 5(46(#77'/6 8/)0(9#-0
16
ortab|||ty
17
Iava |auorm
! Deve|opment
! Comp||anon, Lxecunon, Debugg|ng, Documentanon
! App||canon rogramm|ng Interface (AI)
! Usefu| c|asses
! UI 1oo|k|ts
! Sw|ng, Iava 2D
! Dep|oyment
! Iava Web Start
! Integranon ||brar|es
! Databases, kemote Method Invocanon (kMI)
Lc||pse IDL
19
Lc||pse IDL
! Sohware free
! Cpen-source pro[ect
! Deve|oped by Lc||pse Ioundanon
! kesources:
! I8M kanona|
! 8or|and
! IDL arch|tecture based on p|ug-|ns
! ID1 (Iava Deve|opment 1oo|s) |s [ust one p|ug-|n
! We can |mp|ement our own p|ug-|ns
20
Us|ng Lc||pse
! New pro[ect
! Name
! Locanon
! Layout
! erspecnves
! ro[ect propernes
! Iava 8u||d ath
! New ackage
! New c|ass
! kunn|ng
Let us wr|te a program
|n Iava us|ng Lc||pse!
What can we |mprove?!
23
What can we |mprove?
! Documentanon
! Dehne and document constants
! Very |mportant for ma|ntenance tasks
! 8euer producnv|ty
! Isn't ma|n b|g?
24
kefactor|ng






! Lxamp|es:
! Constants: "kep|ace Mag|c Number w|th Symbo||c Constant"
! Method very b|g: "Lxtract method"
! |sLmpty boo|ean examp|e
A change made to the |nterna| structure of
sohware to make |t eas|er to understand
and cheaper to mod|fy w|thout chang|ng |ts
observab|e behav|or.

You might also like