Fundamentalsof codingYeah, Its really true!
We will use Ruby in our examples.
Because...10.times { puts "Hello world!" }class HelloWorldApp {public static void main(String[] args) {for(int i = 0; i < ...
Important question.Why is coding so difficult?
Important question.Why is coding so difficult?In fact, its not!
The start of a new day.
The start of a new day, in Ruby.if alarm.is_ringing? # Asking alarm if it is ringingself.wake_up() # Waking upself.do_gymn...
Nouns vs Verbs.Nouns are objects.Nouns can do things.The verb is called a method or function.The verb actually do things.
God creating human beings.
God creating human beings.Now using blueprints (classes).
Classes.class Humandef initialize(name, intelligence)@name = name@intelligence = intelligenceendendadam = Human.new( "Adam...
Inheritance.
Inheritance.class Woman < Humanattr_accessor :surnamedef gossip()@intelligence = @intelligence + 1endendclass Man < Humand...
Encapsulation.
Encapsulation.class Woman < Humanattr_accessor :surnamedef gossip()@intelligence = @intelligence + 1endendclass Man < Huma...
Polymorphism.
Polymorphism.class Woman < Humanattr_accessor :surnamedef gossip()@intelligence = @intelligence + 1endendclass Man < Human...
Object Oriented Programming at aglance.Together:● Encapsulation● Inheritance● Polymorphismmake up the fundament of OOP.
End.Thank you.
Upcoming SlideShare
Loading in …5
×

Fundamentals of coding

296 views

Published on

The presentation for the students of Technical University of Moldova.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
296
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Fundamentals of coding

  1. 1. Fundamentalsof codingYeah, Its really true!
  2. 2. We will use Ruby in our examples.
  3. 3. Because...10.times { puts "Hello world!" }class HelloWorldApp {public static void main(String[] args) {for(int i = 0; i < 10; i++) {System.out.println("Hello World");}}}
  4. 4. Important question.Why is coding so difficult?
  5. 5. Important question.Why is coding so difficult?In fact, its not!
  6. 6. The start of a new day.
  7. 7. The start of a new day, in Ruby.if alarm.is_ringing? # Asking alarm if it is ringingself.wake_up() # Waking upself.do_gymnastics(1.minute)if self.need_to_go? # Asking yourself.car.start_engine()if self.saw(stopSign) # One more conditionalself.stop_car()endendend
  8. 8. Nouns vs Verbs.Nouns are objects.Nouns can do things.The verb is called a method or function.The verb actually do things.
  9. 9. God creating human beings.
  10. 10. God creating human beings.Now using blueprints (classes).
  11. 11. Classes.class Humandef initialize(name, intelligence)@name = name@intelligence = intelligenceendendadam = Human.new( "Adam", 10 )eve = Human.new( "Eve", 9 )3000000000.times do | i |Human.new( "Eve #" + i.to_s, rand(100) )end
  12. 12. Inheritance.
  13. 13. Inheritance.class Woman < Humanattr_accessor :surnamedef gossip()@intelligence = @intelligence + 1endendclass Man < Humandef gossip()@intelligence = @intelligence - 10endend
  14. 14. Encapsulation.
  15. 15. Encapsulation.class Woman < Humanattr_accessor :surnamedef gossip()@intelligence = @intelligence + 1endendclass Man < Humandef gossip()@intelligence = @intelligence - 10endend
  16. 16. Polymorphism.
  17. 17. Polymorphism.class Woman < Humanattr_accessor :surnamedef gossip()@intelligence = @intelligence + 1endendclass Man < Humandef gossip()@intelligence = @intelligence - 10endend
  18. 18. Object Oriented Programming at aglance.Together:● Encapsulation● Inheritance● Polymorphismmake up the fundament of OOP.
  19. 19. End.Thank you.

×