Programmeren Kun Je Leren Workshop Hackathon 16-06-2012


Published on

Door Alper Cugun.

Published in: Education, Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
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\n\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\n\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\n\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
  •\n\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
  • \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): = name = 0 def spend(self): -= 1000000 def bailout(self, amount): += 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•• — ruby• — javascript
    25. 25. Just do it!
    26. 26. Scraperwiki