Hacker Newsnew | past | comments | ask | show | jobs | submit | Open-Juicer's commentslogin

Eloquent Ruby is the design book to read.

Why not import some of HtDC best ideas to the Ruby world, for those of you think HtDC is Java biased? Actually, many good ruby books are adapted from the Java land.

A side note: To many rubyists' surprise, Matz is not a language-biased guy who would like to start a language war.


This book takes a theoretical approach to OOP.

As the author said, this book is NOT about Java. Similarly, SICP is NOT about Scheme.

Interestingly, It's the same author who teaches how to design programs with Racket, a lisp dialect.

http://www.ccs.neu.edu/home/matthias/HtDP2e/index.html


> As the author said, this book is NOT about Java.

That's what it says, but the concepts covered are so java-oriented it may as well be.

It uses generic language to describe most of the concepts, but the underlying assumption seems to be that you need to understand these concepts because you need to program in Java, C#, C++, or some other closely-related language with no dynamic typing, no first-class functions, and explicit java-style semantics for abstract classes, interfaces, public vs private methods, implements vs extends, and such.

Much of that is invisible in a language like Python, and a book that laboriously covers each concept in the context of a language where you have to specify everything explicitly probably isn't going to make you much better at writing classes in python. Or if it is, it's going to be a lot of work for minimal benefit.

> Interestingly, It's the same author who teaches how to design programs with Racket, a lisp dialect.

Indeed, that's partly why I'm surprised the book takes the approach it does. However, it does seem to be a good, thorough book (ignoring the missing sections) if you need to design classes in Java or C# (which covers a lot of people).


I think this is where a lot of Rubyists/Pythonistas get lost. Just because the languages hide ideas like "interface" and "abstract base class" doesn't mean that those concepts aren't useful. Particularly in Ruby-land there's been a push to have common interfaces. They're only enforced by contract. And if you think about it, having "interface" explicitly in the language just means that the contract is enforced at compile time. Even so, you have to be careful. You could implement an interface and still just return null.


> I think this is where a lot of Rubyists/Pythonistas get lost. Just because the languages hide ideas like "interface" and "abstract base class" doesn't mean that those concepts aren't useful.

I agree, somewhat. The problem is that HtDC seems to spends so much time on vocabulary and describing how to construct classes that very little is left over for discussion of actual design. Here's an excerpt:

This first section on classes suggests that the design of a class proceeds in three steps:

1. Read the problem statement. Look for statements that mention or list the attributes of the objects in your problem space. This tells you how many fields you need for the class definition and what information they represent.

That is probably quite reasonable from a java-perspective. But in Python the best answer might be to use the built-in data structures, define a bunch of functions to operate on that data, which are automatically encapsulated in a namespace based on the name of the file. But it might not, sometimes you would want to define a class with explicit fields.

The question is, how do you know which technique to use? This book doesn't seem to help with that. We've jumped from a data-driven approach using scheme to a java-style object-oriented approach for no apparent reason and very little explanation of the benefits of this approach.

Even if the part about interfaces might help a bit with designing a Python module, in order to get that out of this book you're going to have to wade through a lot of other stuff.


The book opens with "What you'll learn: Java."


You'll learn Scheme going through SICP too.

From the author:

"It is a good idea to study the programming language that you use on a daily basis and to learn as much as possible about it. We strongly believe, however, that it is a bad idea to teach the details of any programming language in a course. Nobody can predict which programming language you will use.

Therefore, time in a course is better spent on studying the general principles of program design rather than the arcane principles of any given programming language."


It actually says "What you won't learn: Java."


In my defense, this is what shows up on my screen:

  What you will learn
  What you won't learn
  Java.
Weird!


Your defense is that you badly misquoted what shows up on your screen?

That is weird...


Honest question: Is that really what you thought? It seems obvious to me that I was implying a defense that the phrase I quoted also appears on the page, directly next to the phrase ekiru quoted, which makes the mixup a little more understandable, because it means I didn't see something that simply didn't exist. Did you get that and post your reply anyway, or did I just express myself poorly?


>(9) Haskell Eats Circular Definitions for Breakfast

It's recursive, not circular, definition. A circular definition never ends while a recursive one does.


I think sigpfe is talking about corecursive definitions, which can produce infinite data structures: http://en.wikipedia.org/wiki/Corecursion


>>>So, in an effort to boost literacy, the People's Republic of China attempted to make learning characters easier through a series of simplification rounds that took place between the 1950s and 1970s<<<

The fact is that people in Hong Kong and Taiwan have a much higher literacy rate than those in mainland China, yet they use Traditional Chinese. Mainlanders' low literacy rate is mainly a sign of lacking education, not Traditional Chinese being a barrier to literacy. Moreover, in a digital world, they make no difference in input speed.

What Hong-Kongers and Taiwanese are opposing to is not the communist simplifying Chinese Characters, but simplifying them in an ugly fashion. In most cases, it breaks the consistency in word formation as seen in Traditional Chinese. In other cases, it's not aesthetic and even absurd. There is a joke saying that the word factory(廠)in simplified Chinese (厂) explains why factories in mainland China are subject to collapse.

Speaking of economics, simplified Chinese indeed appeals to larger potential customers. However, PRC put lots of restrictions on foreign corporations. That's why even Google and Facebook failed to (and will continue to) dominate in China. On the other side, Hong Kong and Taiwan have the goodies of free markets.


> Moreover, in a digital world, they make no difference in input speed.

On the other hand, traditional Chinese on a <4 inch screen always PITA to read because every fucking single character looks like a black block, for example 龍, it's very hard to see the exact strokes which cause an obstacle for reading. (yeah, like 赢羸蠃嬴 are totally 4 different characters.) Traditional Chinese under 12px is simply un-readable on LCD screens.

The retina display on iPhone4 is good news for traditional Chinese.


Chinese words being displayed incorrectly is based on a false assumption.

On Twitter, 140 Characters mean a lot in Chinese! why? In Chinese, almost every character is a word; In English, every character is just an alphabet, not a word, with minor exceptions of course. Chinese words are square blocks whereas English ones rectangle blocks. They shouldn't be of the same height.

I would argue that Chinese words convey more meaning per cm square. The same square space occupied by 5 rectangle capital alphabets is more than enough to display any Chinese character correctly.

BTW, you don't need to recognize every stroke to be able to identify a Chinese word. You can tell by its pictorial pattern, such as negative spaces.


I've always been super jealous at how much Chinese speakers can say in Chinese on Twitter.


I've got lots of good math books to recommend. However, giving beginners too much information would make them more confused.

So, only two recommendations for you, one book, one website:

1) If I'm only allowed to recommend one math book to beginners, It'll definitely be:

What is Mathematics - by Richard Courant and Herbert Robbins

Take a look at the review by Albert Einstein. Yes, Albert Einstein!

http://www.amazon.com/Mathematics-Elementary-Approach-Ideas-...

2)BetterExplained

This site explains math intuitively unlike the traditional formal approach.

http://betterexplained.com/archives/


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: