HN Theater @HNTheaterMonth

The best talks and videos of Hacker News.

Hacker News Comments on
Google Developers Day US - Python Design Patterns

GoogleDeveloperDay · Youtube · 19 HN points · 6 HN comments
HN Theater has aggregated all Hacker News stories and comments that mention GoogleDeveloperDay's video "Google Developers Day US - Python Design Patterns".
Youtube Summary
Python Design Patterns
Alex Martelli
Design Patterns must be studied in the context on the language in which they'll get implemented -- the Gang of Four made that point strongly in their book, though almost everybody else seems not to have noticed. This talk explores some "classic" DPs in all the various categories -- Creational, Structural, and Behavioral -- studying how they show up in Python programs and how they interact with Python's special strengths.

Speaker Bio:Alex Martelli is Uber Tech Lead (Production Systems) at Google. Alex is the author of "Python in a Nutshell", co-editor of the "Python Cookbook", a Member of the Python Software Foundation, and winner of the 2002 Activators' Choice Award and 2006 Frank Willison award for outstanding contributions to the Python community. (more)
HN Theater Rankings

Hacker News Stories and Comments

All the comments and stories posted to Hacker News that reference this video.
Cool. I'll take a look at the book. I was specifically interested in Python design patterns. I still remember the talk from Alex Martinelli at Google: https://www.youtube.com/watch?v=0vJJlVBVTFg, and I just saw there is an updated version: https://www.youtube.com/watch?v=LeuChRCByZc
In a similar vein, I found Alex Martinelli's talk on design patterns very level-headed and instructive: https://youtu.be/0vJJlVBVTFg
Feb 03, 2015 · 2 points, 0 comments · submitted by rbanffy
>> I use lists and strings and arrays with no concern about how many elements they contain or where the memory comes from.

> You should worry. If you don't want your server or your app to run slow, you should worry about these things.

I am pretty sure he is saying he doesn't have to manually allocate and free memory and worry about off by one errors when iterating. He is comparing equivalents; he isn't saying since I am using Python I can shove 1 billion numbers in a list.

> Can you imagine going into a programming interview and saying something like this?

The only occasion when programming interviews have any significance is when you are seeking a job. Using them as a benchmark for anything else is flawed.

> It's pretty difficult to implement reliable, readable and proven design patterns if you're just passing around dictionaries of dictionaries and lists.

Translating proven, classical design patterns to Python or Ruby will result in shitty code. The proven design patterns don't have to be the same for all languages. It's idiomatic to use dictionaries/list in place of classes where applicable.

http://norvig.com/design-patterns/

https://www.youtube.com/watch?v=0vJJlVBVTFg

http://designpatternsinruby.com/

Among the books "programmers have read", I have read K&R, Programming Pearls and bits and pieces of Effective Java and C++. I thoroughly enjoyed these books.

The other books on the "have read" list are on my "don't bother reading" list. Code Complete, Pragmatic Programmer, Mythical Man Month et al aren't my kind of books. As far as design patterns go, I believe if you code in Python/Ruby/Perl etc, books covering them in Java/C++ are needlessly verbose and boring. I recommend Alex Martelli's talks

http://www.youtube.com/watch?v=0vJJlVBVTFg

http://www.youtube.com/watch?v=1Sbzmz1Nxvo

And this book which covers design patterns using Ruby.

http://www.amazon.com/Design-Patterns-Ruby-Russ-Olsen/dp/032...

Both approaches actually show you practical examples of design patterns in the standard library or real world problems, and shuns patterns which aren't applicable to the language or are too trivial. These talks aren't the end-all, but they will give you a good overall knowledge, and will make further exploration easy.

And from the "haven't read" list, CLRS is a good book and isn't as dense as it is generally taken to be. It does have sections on proofs, but you can skip it and jump directly to the data structure/algorithm. The pseudo code used in the book is extremely clear, and will convert to simple python in most of the cases. Use it as a reference, or read first few hundred pages. If the book isn't for you, you will know it after you have read the first 100 pages.

Another book I recommend is Sedgewick's book on Algorithms. I have read the C version. It mostly covers basic data structures and some accompanying algorithms. The code is succinct(sometimes needlessly so) and more importantly, it works. It doesn't sit well with everyone, but I liked it - it helps me see the whole picture without bombarding me with a lot of code.

Skiena is another obvious favorite.

Dragon book is decent, but you need guidance and discipline to make anything out of it. Consult your peers or teachers while using the book, or use another book.

I haven't read TAOCP and it's low on my list for now. I have read bits and pieces and I didn't find it as fascinating as I had hoped. It's dense and extensive, and can be used as reference.

"Effective C++" will be a better alternative to "The C++ programming language". But I must say, when I first read "The C++ programming language", I found it fascinating - lengthy, but fascinating. That would be mainly because I was beginning programming when I first read it.

I looked at couple of them. Some of the patterns has a note mentioning it is a port of C#/Java/C++ implementation in the Wikipedia article.

Python is drastically different from C#/Java/C++, and a direct port of classical patterns won't make much sense. It will work, but it will the equivalent of Fortran programmers writing Frotran in Python.

If anyone is interested, this talk by Alex Martelli is a good starting point:

    http://www.youtube.com/watch?v=0vJJlVBVTFg
I think Bruce Eckel was writing a book on "Design Patterns" in Python, but that's not completed. However, there is a book using Ruby, which shows the classical approach for implementing design patters, then shows how it is done in Ruby:

http://designpatternsinruby.com/

Also, there are some good google tech talk videos:

http://video.google.com/videoplay?docid=7760178035196894549

Python Design Patterns: http://www.youtube.com/watch?v=0vJJlVBVTFg

May 27, 2008 · 17 points, 0 comments · submitted by nickb
HN Theater is an independent project and is not operated by Y Combinator or any of the video hosting platforms linked to on this site.
~ yaj@
;laksdfhjdhksalkfj more things
yahnd.com ~ Privacy Policy ~
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.