Professional Programming for Novices - PowerPoint PPT Presentation

Loading...

PPT – Professional Programming for Novices PowerPoint presentation | free to download - id: 3d6d6-NDljM



Loading


The Adobe Flash plugin is needed to view this content

Get the plugin now

View by Category
About This Presentation
Title:

Professional Programming for Novices

Description:

master Python programming language, read technical ... Python ... learn Python standard libraries and use your favorite one (such as email, cmd, ... – PowerPoint PPT presentation

Number of Views:79
Avg rating:3.0/5.0
Slides: 19
Provided by: cydnCy
Learn more at: http://cydn.cybozu.co.jp
Category:

less

Write a Comment
User Comments (0)
Transcript and Presenter's Notes

Title: Professional Programming for Novices


1
Professional Programmingfor Novices
  • Hirotaka Yamamoto
  • 2006/10/05

2
Course Map
  • Goals of this course
  • How the course works
  • Course Structure
  • Learn how to learn
  • How to order your computer?
  • How to write cool code?
  • How to cope with bugs?
  • Whats next?

3
Goals
  • When this course finishes, you will
  • master Python programming language,
  • read technical documents in English,
  • turn your intuitive thinking to logical one,
  • know the basic principles to write cool code,
  • realize what are bugs and how to cope with them,
  • and enjoy programming!

4
How the course works
  • I will not teach you!
  • You will be assigned a challenge every week
  • Do it yourself by the next week
  • Your effort will be reviewed and advised at
    weekly meeting
  • Your next challenge is then assigned along with
    your progress
  • Questions are always welcome!
  • but share your troubles and solutions at our
    Groupware

5
What limits your computers ability?
  • You definitely know what the computers can do
    these days
  • File Sharing, CAD, e-commerce, games, music,
  • Can YOU do such things with your computer?
  • if not, why?
  • Your poor knowledge limits your computer's
    ability!
  • The more you know them, the more your computer
    can do
  • Who loves them most will be the greatest
    programmer!

6
Learn how to learn
  • Learn Python programming language
  • learn Python-2.5 new features (from web) and use
    your favorite one in a short program
  • learn Python standard libraries and use your
    favorite one (such as email, cmd, distutils, etc)
  • Any question is welcome, including
  • how to find the information
  • how to read English
  • what is my favorite
  • which kind of programs looks funny

7
How to order your computer?
  • You need to translate your task into computer
    languages
  • write a program to compute factorial 10 (10!)
  • and see there is more than one way to do it
  • choose the way that satisfies your needs most
  • Computers work logically while you do not
  • imagine how you would solve Sudoku puzzles?
  • example
  • then write it on a paper for anyone who reads it
    can do the same
  • you will need to clear any ambiguity to do so
  • the resulting procedure is so-called "algorithm"
  • and it should require some "data structure" to
    hold data, status, etc.
  • and again, you must see there is more than one
    way to do it ?

8
What is a "good" algorithm?
  • An algorithm may better if it would
  • require less computation (lower order of
    computational complexity), and
  • require less space (of memory, disk, ), and
  • be simple and clear (or stupid)
  • KISS (Keep It Simple and Stupid)
  • In other words, algorithms rule programs
  • so examine your algorithm before writing code

9
Materialize your algorithm
  • The first thing you must do is to choose (or
    design) appropriate data structures to represent
    data, status, etc.
  • Design data structures for
  • a Sudoku puzzle
  • and implement it with load/save functionality
    against files.
  • other required data structures for your algorithm

10
What is a "good" data structure?
  • Data structures are
  • to represent data or states in the algorithm
  • and to be used for computation
  • A good data structure therefore should
  • be abstracted enough for the data or state
  • and make the computation brief and fast
  • For a data structure D, check if it
  • has an appropriate name for the representing data
    or state,
  • supports frequent operations that appear in the
    algorithm,
  • and can do them quickly

11
How to write cool code?
  • Your code should be
  • easy to read
  • consistent coding style, explicit names,
    commented if not trivial, enough documentation,
    one thing at a time
  • easy to maintain
  • no duplication, no magic literals, less
    dependency between modules, well
    structured/layered
  • Coding itself must be a simple work
  • because you should have prepared algorithms and
    data structures beforehand
  • Focus on beautiful coding once you begin!

12
Good coding strategy
  • Divide the problem into pieces you can easily
    solve
  • Divide-and-Conquer
  • Solve the sub problems one by one
  • don't attempt to solve them at once
  • test your code before proceeding this makes it
    easy to do unit tests
  • Refactoring
  • should be done whenever you feel your code
    getting puzzling
  • in other words, DON'T TRY TO WRITE COOL CODE AT
    THE BEGINNING, because you are almost impossible
    to foresee the entire view of the solution
  • Defer tuning
  • tuning tends to make code complicated
  • moreover, tuning may turn out unnecessary

13
Refactoring Principles
  • Avoid duplication
  • do everything once and only once
  • This will help your maintenance when the
    functionality needs to change
  • One thing at a time
  • A method or function should do only one thing
  • Use explicit names
  • for classes, functions, instances, variables,
    etc.
  • Eliminate magic literals
  • separate literal data from the main code

14
How to cope with bugs?
  • Source of Bugs
  • carelessness
  • mistyping, erroneous conditions, etc.
  • failure of imagination
  • fail to handle abnormal inputs, rare status, etc.
  • miscommunication
  • illegal use of functions/methods/protocols by
    colleagues
  • illegal use of applications by end-users

15
Prevent bugs
  • vs. careless mistakes
  • static checking by compilers
  • use good editors
  • test and cover all statements
  • vs. poor imagination
  • do simple things (by divide-and-conquer, etc.)
  • dont do difficult things such as multi-threading
    as long as you can (remember KISS policy!)
  • declare your assumptions
  • use assertion (assert) or design-by-contract
    (DbC)
  • find and fix faulty assumptions through tests
  • vs. miscommunication
  • write comments or specs of your functions/methods
  • write manuals for your customers

16
Hunt Bugs
  • Dont read source code at first!
  • because you can see any kind of bugs in your
    source code. Note that almost all code have some
    assumptions to work correctly.
  • Strategy
  • Reproduce it first
  • Gather facts to narrow possibilities
  • Try something and gather more facts
  • Thats all

17
Summary
  • Through this course you have learned how to be a
    professional programmer
  • but what makes you a professional?
  • A professional must guarantee the quality of his
    work
  • being a professional programmer, you must
    guarantee the quality of your knowledge, ideas,
    and code.

18
Whats next?
  • How to solve complex problems?
  • learn design techniques and how to use them
  • How to work in a team?
  • learn development processes
  • learn development standards
About PowerShow.com