1 / 27

COMPSCI 107 Computer Science Fundamentals

COMPSCI 107 Computer Science Fundamentals. Introduction. Waiheke Island. Philosophy. Research Interests. ACM Special Interest Group in Computer Science Education. My kids. Research on lectures. A n efficient way to teach – not an effective way to learn Research on learning:

raziya
Download Presentation

COMPSCI 107 Computer Science Fundamentals

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. COMPSCI 107Computer Science Fundamentals Introduction

  2. Waiheke Island COMPSCI 107 - Computer Science Fundamentals

  3. Philosophy COMPSCI 107 - Computer Science Fundamentals

  4. Research Interests • ACM Special Interest Group in Computer Science Education COMPSCI 107 - Computer Science Fundamentals

  5. My kids COMPSCI 107 - Computer Science Fundamentals

  6. Research on lectures • An efficient way to teach – not an effective way to learn • Research on learning: • Actively doing something is effective • Learning from peers is effective • Critically evaluating your own performance is essential COMPSCI 107 - Computer Science Fundamentals

  7. Research on learning What is effective? • Actively doing something (bring laptop to class if possible) • Critically evaluating yourselves • Learning from peers COMPSCI 107 - Computer Science Fundamentals

  8. Assessment • Laboratories every week (starting this week) ………. 25% • Exercises during labs • Exercises after labs(homework) • Mid-semester Test ……………………………………………... 15% • 9th April 2014, in class, during normal lecture time • Final Exam………………………………………………………….. 60% • Date to be announced COMPSCI 107 - Computer Science Fundamentals

  9. Resources • Lectures • Overheads and recordings • Forum • Question and answers – peers, tutors and lecturers • Textbook • Problem Solving with Algorithms and Data Structures • Online, free, open source • Additional resources • Python.org • PythonTutor.com COMPSCI 107 - Computer Science Fundamentals

  10. Learning and Teaching in CS 107 Making informed choices about programming • Understanding the trade-offs Focus on ways of storing and manipulating data • Different ways of structuring data storage • Efficiency • Searching • Sorting Some new programming ideas • Recursion • Exceptions COMPSCI 107 - Computer Science Fundamentals

  11. Fibonacci numbers • Next number is sum of previous two numbers • 1, 1, 2, 3, 5, 8, 13, 21 … • Mathematical definition COMPSCI 107 - Computer Science Fundamentals

  12. Question • Which of the following would you choose? deffib_a(n): if n == 0 or n == 1: return n if n >= 2: return fib_a(n - 1) + fib_a(n - 2) deffib_b(n): if n == 0 or n == 1: return n prev = 1 prev_prev = 0 for i in range(2, n+1): temp = prev + prev_prev prev_prev = prev prev = temp return prev COMPSCI 107 - Computer Science Fundamentals

  13. Empirical testing • How long will it take for fib_a(100) to execute? COMPSCI 107 - Computer Science Fundamentals

  14. Fibonacci numbers 2 1 3 2 4 3 5 5 6 8 7 13 8 21 9 34 10 55 20 6,765 30 832,040 40 102,334,155 50 12,586,269,025 60 1,548,008,755,920 70 190,392,490,709,135 80 23,416,728,348,467,685 90 2,880,067,194,370,816,120 100 354,224,848,179,261,915,075 COMPSCI 107 - Computer Science Fundamentals

  15. Ethics • Computer programmers shape the world • Potentially huge impact on society • Deal with private and sometimes sensitive information COMPSCI 107 - Computer Science Fundamentals

  16. Question What are ethics? COMPSCI 107 - Computer Science Fundamentals

  17. Moral Principles Those are my principles, and if you don't like them... well, I have others. --- Groucho Marx COMPSCI 107 - Computer Science Fundamentals

  18. Question What are the attributes of an ethical (moral) person? COMPSCI 107 - Computer Science Fundamentals

  19. Why should we think about ethics? • Moral decisions are hard, especially when they cost you • People regret making the wrong moral choices • Thinking and talking about ethics prepares you to make decisions that you can live with COMPSCI 107 - Computer Science Fundamentals

  20. Question • Imagine that you work for a software company and are in a meeting with clients. The client asks if the software can perform a particular task and the boss says “Yes, and those bugs you mentioned have been resolved in the next version that will be released next week” • You know that the software probably can’t perform the task mentioned, and that the software is still riddled with bugs and the next version is months away. What do you say? COMPSCI 107 - Computer Science Fundamentals

  21. Ethical behaviour • Would you use a missile to kill other innocents? • Would you give the missile to a terrorist group that planned to kill others? • Would you write the software that was used to control the missile? • Would you write software for a company that had contracts with the military if you didn’t know what the product was? COMPSCI 107 - Computer Science Fundamentals

  22. ACM Code of Ethics • ACM • http://www.acm.org/about/code-of-ethics • Ethics are sometimes complex • Case of the Killer Robot • http://www.onlineethics.org/Resources/19049/killerrobot.aspx COMPSCI 107 - Computer Science Fundamentals

  23. Formal instructions When the steps in a process are well defined, we can store them in the computers memory in a way that the computer can follow them. • The language we store the instructions must be formal language • Reduces ambiguity • Python is a programming language designed to be easy to read • Each step in the program is known as a statement • A program is a sequence of statements • Ways of running a program • Interactive execution – great for learning • Creating a module (file) and executing the module COMPSCI 107 - Computer Science Fundamentals

  24. Python variables • Variables are names of locations used to store information • Information comes in different types • Names of variables are constrained • Assignment used to store a value in a variable • x = 3 COMPSCI 107 - Computer Science Fundamentals

  25. Arithmetic operations • Mathematical operators • Addition + • Subtraction - • Multiplication * • Division / • Exponentiation ** • Floor division // • Modulus % • “In place” operators • x += 1 is the same as x = x + 1 • x -= 1 is the same as x = x - 1 • x *= 2 is the same as x = x * 2 • … COMPSCI 107 - Computer Science Fundamentals

  26. Common data types • integers • 0, -4, 23 • floating point numbers • 0.0, -4.23, 83.456 • boolean • True, False • string • 'Hello', "Goodbye" COMPSCI 107 - Computer Science Fundamentals

  27. Convert a value from ounces to grams • Given that 1 ounce is equal to 28.3495 grams, write code that starts with a value in ounces and prints the equivalent weight in grams. COMPSCI 107 - Computer Science Fundamentals

More Related