• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Fundamentals of coding
 

Fundamentals of coding

on

  • 236 views

The presentation for the students of Technical University of Moldova.

The presentation for the students of Technical University of Moldova.

Statistics

Views

Total Views
236
Views on SlideShare
236
Embed Views
0

Actions

Likes
0
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Fundamentals of coding Fundamentals of coding Presentation Transcript

    • 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 < 10; i++) {System.out.println("Hello World");}}}
    • 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_gymnastics(1.minute)if self.need_to_go? # Asking yourself.car.start_engine()if self.saw(stopSign) # One more conditionalself.stop_car()endendend
    • 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", 10 )eve = Human.new( "Eve", 9 )3000000000.times do | i |Human.new( "Eve #" + i.to_s, rand(100) )end
    • Inheritance.
    • Inheritance.class Woman < Humanattr_accessor :surnamedef gossip()@intelligence = @intelligence + 1endendclass Man < Humandef gossip()@intelligence = @intelligence - 10endend
    • Encapsulation.
    • Encapsulation.class Woman < Humanattr_accessor :surnamedef gossip()@intelligence = @intelligence + 1endendclass Man < Humandef gossip()@intelligence = @intelligence - 10endend
    • Polymorphism.
    • Polymorphism.class Woman < Humanattr_accessor :surnamedef gossip()@intelligence = @intelligence + 1endendclass Man < Humandef gossip()@intelligence = @intelligence - 10endend
    • Object Oriented Programming at aglance.Together:● Encapsulation● Inheritance● Polymorphismmake up the fundament of OOP.
    • End.Thank you.