Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

"LogUserIn" is not a class; classes are most often nouns and actions are typically verbs. A "User" class (or "UserController" class) with a "login" method is more appropriate.

See also: http://pragprog.com/articles/tell-dont-ask



You're actually wrong. This is a bastardisation of the command pattern. LogUserIn is a command. The verb/noun thing applies to a different class of object (your domain).

The article sucks pretty badly to be honest but the foundations are solid.

A much better solution is to use the command pattern over a rigid domain model. The rigid domain model encapsulates your business domain and logic and your commands describe different ways to mutate the domain.

This could be classified as CQS or if you use a bus to deliver your commands CQRS.

Unfortunately, and I'll probably get flamed for it, by rails is a stinking turd when it comes to architecture. I've never seen anything which isn't trivial CRUD done without causing uber spaghetti. Also to do proper domain modelling, you need a more powerful ORM such as sqlalchemy or hibernate.


I've never seen anything which isn't trivial CRUD done without causing uber spaghetti.

It's easy to get a lot of followers by creating a framework that lets a new user create something small very quickly. Keeping it well organized as time goes on is much harder. It has been this way for decades, and still people haven't learned.


And I'd like to clarify your point here. People haven't learned because there isn't enough teaching going on. It's only been the past 4 months that I've even begun to realize just how wrong I've been, and that's only because I found a mentor who pointed me in the right direction.

There's a huge problem of how to teach people good, responsible software development, and this article is a part of my attempt to help educate people towards even knowing about better software practices. People aren't going to just suddenly get it, they have to learn from somewhere.


There's plenty of teaching going on but people have stopped listening to people who know what they are talking about and have started listening to all the trendy marketing out there.

Two awesome places to learn shit:

http://martinfowler.com/bliki/

http://www.eaipatterns.com/

Both of those are available as books (EIP + PoEAA). Buy them, read them, weep.

Yes they are C# and Java but that's where most of the formalisms were developed (for a reason!).


Formalisms and learning materials available, but not for major languages that could benefit greatly from them.


Perhaps the wrong choice of language is made then?


No, I'm pointing out things that were wrong back in the late 1990's and early 2000's are again wrong just for different languages. It's an opportunity, in other words.


I don't understand. What in particular was wrong? We had formalised design patterns and architectures back then.

A large portion of any industry ignores established best practices and makes a mess every generation.


We had formalised design patterns and architectures back then.

Yes, and many of them described in books in particular languages. Not every language community that could have benefitted had the right book written using their language.

Like I said, a recurring condition and an opportunity.


The books describe portable concepts with examples in the languages of the time.

Much as SICP is applicable to a lot of languages that aren't scheme.




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

Search: