SyntaxHighlighter

понедельник, 19 декабря 2011 г.

Simon Peyton-Jones: Closer to Nirvana

Интервью SPJ на channel 9: http://channel9.msdn.com/Blogs/Charles/YOW-2011-Simon-Peyton-Jones-Closer-to-Nirvana

на реддите: http://www.reddit.com/r/haskell/comments/nf4kg/simon_peytonjones_closer_to_nirvana/

how to become a better programmer

  • Programming. Working on interesting projects
  • Working with people far smarter than myself
  • Always listening to what others have to say, regardless if they're junior, intermediate, senior or guru
  • Learning other frameworks/languages, and seeing how they do things, and compare that to stuff that you already know
  • Reading about patterns, best practices, and then examining your stuff and applying those patterns where necessary
  • Consciously try to improve. Never stop learning
  • Read: books, websites, blogs
  • Read other people's code
  • Hit the gym regularly
  • Start a Pet project
  • Contributing to/participating in open-source projects
  • Competing in TopCoder Algorithm contests.
  • Solve problems on Project Euler
  • Challenge yourself with extracurricular activities (dancing, board games, musical instrument)
  • Learn English (for Russian Software Engineers only)

Links:

http://programmers.stackexchange.com/questions/44177/what-is-the-single-most-effective-thing-you-did-to-improve-your-programming-skil

http://stackoverflow.com/questions/82639/how-to-become-a-better-programmer

http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer/

http://www.codinghorror.com/blog/2007/01/how-to-become-a-better-programmer-by-not-programming.html

четверг, 15 декабря 2011 г.

The Secret to Super Productivity

Секрет успеха по ссылке

Unit-Testing SICP

Recently while reading SICP I got an idea of ​​using unit-testing techniques to perform the exercises. This is a excellent way to practice both SICP and unit-testing. Because of using MIT Scheme, my choice fell on the library "test-manager" by Alexey Radul. It is really easy to use and contains all required features)

So, let's try to use it for the exercise 1.16.
Design a procedure that evolves an iterative exponentiation process that uses successive squaring and uses a logarithmic number of steps, as does fast-expt.



; code
(define (fast-expt b n)
(define (iter a b n)
(cond
((= n 1) (* a b))
((even? n) (iter a (* b b) (/ n 2)))
(else (iter (* a b) b (- n 1)))))
(iter 1 b n))

; tests
(load "test-manager/load.scm")
(define-each-test
(assert= 1 (fast-expt 2 0))
(assert= 2 (fast-expt 2 1))
(assert= (expt 2 8) (fast-expt 2 8))
(assert= (expt 2 6) (fast-expt 2 6)))

(run-registered-tests)


Run:

mit-scheme < ex1_16.scm

1 ]=> (run-registered-tests)


Oops! I completely forgot about condition when the exponent n is zero.
Fix it:


(define (fast-expt b n)
(define (iter a b n)
(cond
((= n 0) a)
((even? n) (iter a (* b b) (/ n 2)))
(else (iter (* a b) b (- n 1)))))
(iter 1 b n))



Run it again:

1 ]=> (run-registered-tests)....

4 tests, 0 failures, 0 errors.


That's it!

среда, 14 декабря 2011 г.

Список книг по Computer Science и IT

Появилось свободное время и огромное желание чего-нибудь такого почитать, чтобы стать чуть умнее) Пока остановил свой выбор на SICP (когда-то давно смотрел видео лекции, но уже почти ничего не помню), а остальные книжки взял на заметку.

Список:
  • Don Knuth. The Art of Computer Programming
  • Structure and Interpretation of Computer Programs
  • Compilers: Principles, Techniques and Tools
  • Cormen. Introduction to algorithms
  • "Gang of Four" Design Patterns book
  • The Mythical Man-Month
  • Concepts, Techniques and Models of Computer Programming
  • Douglas Hofstadter. Gödel, Escher, Bach
  • Martin Fowler. Patterns of Enterprise Application Architecture
  • Martin Fowler. Domain Specific Languages
  • Artificial Intelligence: A Modern Approach
  • Code Complete (2nd Ed) by Steve McConnell
  • Pragmatic Programmer

Functional Programming:
  • Learn You a Haskell for Great Good
  • Types and Programming Languages by Pierce.
  • Purely Functional Data Structures by Chris Okasaki
  • The Haskell Road to Logic, Maths and Programming. Kees Doeats & Jan van Eick
  • Real World Haskell
Tanenbaum:
  • Tanenbaum. Structured Computer Organization.
  • Tanenbaum. Operating Systems: Operating System Design and Implementation
  • Tanenbaum and Wetherall. Computer Networks
  • Tanenbaum. Operating Systems
C++, C#:
  • Herb Sutter. Guru Of the Week
  • Jeffrey Richter. CLR via C#
  • Jeffrey Richter. Windows via C/C++
  • Stroustrup: The Design and Evolution of C++
  • Modern C++ Design
Ссылки