4

I'm a self-taught intermediate Python programmer; I frequently come across popular books on software development and programming written in other languages (often Java).

Typical examples:

  • Refactoring: Improving the Design of Existing Code
  • Design Patterns, Gang of Four
  • Test Driven Development: By Example
  • The Art of Unit Testing: With Examples in .NET

Generally speaking, how useful is it to read a book written for another language? Specifically, what about Python? Should one stick to language specific books?

For example, a lot of people praise Design Patterns by the GOF, I've never read it because the model applies to other languages (after all Python is about anti-patterns, right?) yet I feel the urge to because of it's place in the CS literature cannon.

Likewise, would The Art of Unit Testing: With Examples in .NET help a Python programmer learn unit testing even though the examples are in .Net?

Jason Wirth
  • 199
  • 4
  • 1
    The GoF contains some patterns that aren't useful in python(because they are built-in) but other patterns are worth reading. The same probably is true for most other books out there. – Bakuriu Apr 21 '13 at 17:32
  • If you are fluent in both Python and the language the book is written in, yes. – user16764 Apr 21 '13 at 17:39
  • 1
    Python certainly isn't about anti-patterns. Your link is about avoiding anti-patterns. – Winston Ewert Apr 21 '13 at 18:36
  • Review this question first: http://programmers.stackexchange.com/questions/157943/are-there-any-design-patterns-that-are-unnecessary-in-dynamic-languages-like-pyt?rq=1 – JeffO Apr 22 '13 at 12:54

2 Answers2

12

Absolutely! It's actually very helpful to break away from your primary language occasionally because this lets you see programming concepts through a different lens which will allow you to gain new perspectives.

What makes any software good, or high quality is never about the syntax or language of choice. It's how that language is applied. Steve McConnell calls this programming into a language instead of programming in a language.

McConnell wrote Code Complete, a book I highly recommend. He makes a specific note why the examples are in many different languages. One of the reasons is he wants the reader to focus on the concepts he is illustrating and not on the syntax.

The books in your list describes general concepts that would certainly be useful to any programmer, regardless of their language of choice.

Starting out you do want to focus on just being able to write code that compiles. It doesn't take very long to learn the syntax of a given language and with documentation and intellisense this takes even more away from how much you have to actually remember. Most languages can be learned within a few months. However, writing high quality software is a discipline and craftsmanship that takes years of practice and experience and even then there will always be room for improvement. Learning about design concepts such as how to make your software more testable, modular, loosely coupled etc. will open your eyes on how you look at code in general.

When you stop caring about syntax and can see code through a neutral lens then this will truly benefit you as a programmer.

Despertar
  • 603
  • 5
  • 7
  • I agree, many concepts transcend languages and that it can be helpful to see how things are done in other languages. I recently started learning C/C++. While it added to my depth of general programming, I can't say it made me a better Python programmer. Even though there's value learning something else one might make the "jack of all trades, master of none" argument, I'm better off skipping the C and focusing on Python in order to write higher quality code. As you say, one can learn syntax in months, but it takes years to master. At what point should one branch out into other languages? – Jason Wirth Apr 21 '13 at 23:02
  • I don't think you have to worry about when to branch into other languages, this will come naturally as you look for new challenges or just something fun to try. The point is to be open-minded and not put up a language barrier because that will only limit your abilitity to grow as a developer. There are a lot of great books out there with invaluable knowledge whose author has been writing software for 30+ years. There's a good chance many of these books will not be demonstrated using Python, but to not read them only for this reason would be missing out on a huge opportunity. – Despertar Apr 22 '13 at 17:39
3

First of all, some of the books you mentioned are written with examples in multiple programming languages. For example, GOF's DP is written with C++ and, if fewer, Smalltalk examples, and TDD is written with Java and Python examples.

If you are well trained in picking up what's useful, dropping what's not, and translating what you've picked up, you'll benefit from reading most of generally recommended books for programmers. However, if you have little experience in doing this, you could start from "near-transfer" books. Otherwise, you will learn very little, or even you will learn bad ideas and habits -- some of the practices are language-paradigm dependent. I have seen a good deal of Python programmers with all the hassles for implementing GOF's DP in C++.

Transfer is psychological and educational term for applying what you have learned in a different context. They differentiate between near and far transfer. Usually near-transfer is easier and more effective, which means you need to put more effort for far-transfer.

For near-transfer learning, I highly recommend learning from similar languages, in terms of its paradigm, to your target language -- siblings in the language typology. For Python, that would be something like Smalltalk -- or nowadays Ruby but Smalltalk's legacy is greater.

For instance, you will learn a lot more from reading DPSC than from solely reading GOF's DP. (BTW, reading both DPSC and GOF's DP at the same time with careful contrasting and comparing is a very rewarding learning experience)

From my near-transfer experiences, I remember leaps of improvement in my Python programming from reading books(articles, papers, and etc) for Smalltalk, APL, Io, and ICON, all of which are dynamic in nature.

June Kim
  • 131
  • 2