Programmeren Kun Je Leren Workshop Hackathon 16-06-2012

290 views

Published on

Door Alper Cugun.

Published in: Education, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
290
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • \n
  • financial opportunity, tremendous need\nmoral pressure, those that can do this now can achieve a lot and should do so\nto be aware about what is happening around you and what is possible\n
  • al-Kwharizmi\n
  • Recipe, if you can cook, you can program. Kids can do it and with practice you may become a master chef.\n\nhttp://www.flickr.com/photos/cproppe/4339535475/\n\nYou may burn something, or produce something inedible. But everything if you do it reflexively, you will probably learn something and do it better the next time.\n\nTo extend this analogy further: you can copy paste program just like you can cook, with ready made ingredients.\n
  • \n
  • The most basic construct.\n\nYou put a value somewhere where you can do something more with it.\n
  • All programming is built from these three. This is what we started with.\n\nIf you know how to do these in one language, it’s pretty easy to do it in another. Difference between Spanish and Italian.\n
  • In computer jargon this is called a branch, because every choice spreads out the possibilities like a tree\n\nhttp://www.flickr.com/photos/squirmelia/3644609288/\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • This is how we used to do stuff. If you only have loops and branches, this is what you get.\n\nPeople would read printouts of machine language. We made things a bit more friendly.\n
  • If you combine loops and choices then things start to get rather complicated rather quickly.\n\nComes down to delegate. You tell somebody what to do and you don’t care how they do it, you just care about the result.\n\nDit gaan we even allemaal in Python doen. Met Ruby ben ik niet bekend genoeg, en Javascript heeft wat rare dingen hierin zitten.\n
  • What’s in the function does not matter for who’s outside of it. You the caller just put something in and you get something out of it according to the definition of the contract or the API.\n\nAll kinds of magic could be going on inside the function, assumptions or bugs. They are not your problem (until they are).\n\nhttp://www.flickr.com/photos/nickharris1/4529228162\n
  • A bit more complicated than funtions, but a natural evolution onwards. Classes are collections of functions (behaviour) that have internal state.\n\nA basic economic model.\n
  • I’m going on holiday to greece next week, so this was top of mind for me.\n\nOf course this is ridiculously simplistic. But with another couple of classes and methods, you would be well on your way to simulating the European currency market.\n\nClass ESFM with functions. That is the power of classes. They not only hide away even more complexity, you can use them to model things.\n\nAnother bunch of lines, and you will be writing a HFT trading bot.\n
  • ruby/javascript: array\n\none of a standard object that most languages have, because they are so useful\nused when the order is important\n
  • map, hash, associative array\n\nanother thing that is always there\nused when the order is not important, but you quickly need to find things\n
  • http://docs.python.org/library/functions.html\nhttp://docs.python.org/py-modindex.html\n\nMost of these have example code. Are usually a lot packaged with your language. Many you can also download.\n\nThat is all configuration and can be annoying, but is not treated during the course of this 45 minutes.\n
  • \n
  • Built in Codea, iPad app\n
  • \n
  • \n
  • http://eloquentjavascript.net/\nhttp://jsfiddle.net/\n
  • \n
  • https://scraperwiki.com/docs/python/python_intro_tutorial/\nhttps://scraperwiki.com/scrapers/funda-amsterdam/\n
  • \n
  • Programmeren Kun Je Leren Workshop Hackathon 16-06-2012

    1. 1. Programmeren kun je leren! Alper Cugun
    2. 2. Why?
    3. 3. Algorithm
    4. 4. Fry an egg• Put pan on furnace• If not vegetarian • Put bacon in pan• For each egg • Break egg and put it pan• Yield delicious egg dish
    5. 5. Assignmentb = “hello”c=1d=3e=c+d
    6. 6. Three constructs• Loops• Choices• Encapsulation
    7. 7. Choices
    8. 8. Pythonif points < 10: print ‘You need more points’else: print “You’re a winner!”
    9. 9. Ruby codeif points < 10 puts ‘You need more points’else puts “You’re a winner!”end
    10. 10. Javascript codeif (points < 10) { alert(‘You need more points’);} else { alert(“You’re a winner!”);}
    11. 11. Loops
    12. 12. Pythonfor counter in range(5): print ‘Counting’, counter
    13. 13. Ruby codefor i in 0..5 puts “Counting #{i}”end
    14. 14. Javascript codefor (var i = 0; i < 10; i++) { alert(‘Counting ‘ + i);}
    15. 15. Encapsulation
    16. 16. Functionsdef oranjeWint(team): if ‘Huntelaar’ in team: return True else: return False…print oranjeWint([‘Sneyder’, ‘’, ‘’])
    17. 17. Classesclass Country: def __init__(self, name): self.name = name self.money = 0 def spend(self): self.money -= 1000000 def bailout(self, amount): self.money += amount
    18. 18. Classessome_country = Country()some_country.spend()some_country.spend()print some_country.moneysome_country.bailout(1000000)
    19. 19. Lista = []b = [1, 2, ‘hello’]print b[0]
    20. 20. Dictionaryb = {‘winst’: 3, ‘verlies’: 0,‘gelijkspel’: 1}print ‘Punten bij verlies:’, b[‘verlies’]
    21. 21. Where to look?• function reference• modules• classes• API docs
    22. 22. Verder leren
    23. 23. Cargo-Bot
    24. 24. Verder leren• stackoverflow.com• tryruby.org — ruby• codecademy.com — javascript
    25. 25. Just do it!
    26. 26. Scraperwiki

    ×