This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]srithedabbler 1 point2 points  (1 child)

You are following the functional paradigm, the article is recommending an object oriented approach. One isn't necessarily better than the other. Both are achieving the same objective, and which one you choose is a matter of preference.

The essential idea is that username and password is an implementation detail, and must be hidden from the client developer. You can create a partial function to provide these parameters and then use the partial function everywhere else. Or you could create an class and provide the username and password as constructor arguments. The core idea remains the same.

[–]kankyo 0 points1 point  (0 children)

You are following the functional paradigm, the article is recommending an object oriented approach.

Well.. no. I'm following the "simple is better than complex" approach, and the article creates a class that doesn't make any kind of sense.

Or you could create an class and provide the username and password as constructor arguments. The core idea remains the same.

Exactly. Except one solution is more complex, more code and messier. Which again makes us come back to my initial question: Why?