skysight-inc/HackerNews huggingface dataset:
I'll give a proposal now: every chair of every developer shall from now on give them electric shock whenever they use the term "business logic". Ouch.

Seriously, "CreatesContact" is not really a class. It's a procedure, function with side effects, whatever you call it. Just with a class wrapper that boosts the developer ego almost as much as an AbstractFactoryManagerFactory.

No, modules are actually great. If you have billions of tiny modules all over the place, you probably (note the "probably") optimized way too early by splitting things out into them without a clear reason.

And guess what, if a new developer comes into a project and investigate stuff, they will see the model class start with all sorts of metadata, including callbacks, including those fancy ones called "before_save". If they can't guess what "before_save" means, you might want to either pay for an English class, or switch the framework to something that speaks in German.

And as for using rails as a web delivery mechanism, can you please, please, please investigate things like Sinatra and plain old rack, because those are delivery mechanisms. Rails is a framework, and it's entire point is being opinionated. If you disagree with the opinions, you probably should investigate other frameworks, or just use the libraries that you like (including those that are parts of Rails). Or maybe whack Rails into whatever shape you would like you to be in.

(Also, monolithic applications happen to the best of us, but the problems in them actually often come from the fact that they're monolithic. Stop looking for other developers to blame).
I tried to pick a very contrived example. The architecture rails forces you to have is great if all of your business logic is simply CRUD. Once your app starts doing other things though, that's where careful consideration is needed as to where that logic should live.

You could imagine callbacks or observers that do all sorts of things:

ping an external service
touch another model or models
send an internal email
or does a combination of a bunch of stuff.

Things get even tougher when you start having flags that turn logic on or off. It has the potential to really become a mess, very fast.
An oft-quoted phrase that applies here is "the enemy of good is 'better'".

Clearly RMS wanted his idea of perfection, and almost 30 years on, perfection remains out of reach while "good enough" rules the world on Linux.

An important lesson to learn.
The tricky part is that what some users think of as a must-have trivial-feature, others won't care about at all. Thus getting every trivial-feature for every user becomes a herculean task. (The standard "each user only needs 10% of a program's features... but they all need a /different/ 10%".)

For instance: I don't care about seeing my current cursor coordinates when using an image editor. I probably have some other must-have tiny feature that the author here wouldn't even notice.
I made a simple app to find music based off your mood and a genre. Thoughts?
The title is extremely misleading. It makes it sound as if Mumford & Sons have been interviewed saying they don't want people to lend their CDs to each other. What has actually happened is their label included some small print on their CD saying 'Unauthorized Lending' is not okay. This is clearly an issue with the label rather than the artist, and as amadeus says, is probably meaning Lending in terms of public rentals like from a library.

I just had a look at about 10 of my CDs and 2 of them had exactly the same warning, both from UK labels, so perhaps it is fairly UK specific boiler-plate legal notice. Can't help but feel this is terrible reporting from Wired.
It's okay if that's the only case where the email should be sent, and other means of user creations should never, ever do that. It might be an issue if, for example, the email should be sent always, no matter how the user was created.

Edit: basically, the question is "which process involves sending the email". It might be "creating a user," or it might be "using the 'create user' form". At some point you might need a more abstract solution, of course — see things like Listeners, DHH's Concerns, AOP or whatever you like. But the thing is, if you don't delay too long, you can retrofit your codebase with it, so don't worry too much.

Unless you're coding up a nuclear plant or storm barrier or the moon-carving laser. Please don't use webappy principles to code drivers for the moon-carving laser.
I made this to help me find new music. Most of the time I don't really know what artists/bands I want to listen to, so I made it dead simple. All you need to do is choose a mood and genre from a couple drop downs and it generates a playlist. Just wanted to put it out there in case anyone else would find it useful, and possibly get some feedback. Thanks!
Or it could be the type of person who enjoys Big Bang Theory or Game of Thrones is more likely to know how to torrent or stream videos. I imagine that they have a slightly more technical audience than, say, The Voice.
I like the idea of one-class-one-responsibility but have a number of questions:

1) Isn't the whole idea of ActiveRecord that persistence is hidden from the model programmer? Surely the model doesn't actually have 'triple duty' because it doesn't contain any persistence code?

"Imagine you are a brand new developer on the team that supports this app. You see the @contact.save call but now, the fact that it performs business logic is even harder to see, since the logic is placed in another module, somewhere in some other directory." - I will imagine I am a new developer on the project:

2) My expectations have been subverted. My understanding of Rails conventions is that business logic does live inside the model which will be inside app/models. Therefore, the first question I'd ask myself would be: "What business logic happens when this an instance of this model is created?" Surely Rails supports this paradigm by virtue of the existence of after_create? Wouldn't I have to visit a third class in non-obvious location to understand the updated example(app/use_cases)?

3) Doesn't CreatesContact now have two responsibilities as well? Namely Creation and validation? And the name doesn't communicate that it performs validation as well, does it?

4) Doesn't creating this new class exacerbate the problem of code/logic being 'scattered all over the place'?

5.1) Doesn't the issue of: "[In the controller], To an outside observer, it is not entirely clear that an email will be sent." remain just as problematic as the model containing the code for sending the email? Because you'd have to mentally context switch (the single biggest obstacle to understanding code IMHO) from the controller to the CreatesContact class to see what is happening. when CreatesContact.new(@contact).create_contact! is called.

5.2) Continuing the thread of the last question, CreatesContact.new(@contact).create_contact! certainly doesn't say to the programmer: "I send an email if a certain flag was checked". Isn't this unintentionally self-defeating? The aim is a reduction of 'obfuscation', but isn't hiding what a 'single-responsibility' class actually does obfuscation itself?

I don't mean to be dismissive, but, broadly, I disagree with the way you have tried to compartmentalise this application. The purpose of my questions is to help me understand your opinion.
Can anyone tell me how computing would be different today if micro kernels had taken off? If everyone working on Linux had been working on Gnu Hurd?
I've never assumed cars will stop for me if I step into a crosswalk, nor do I ever assume they see me.

I simply wait on the edge until the cars stop. If they are stopped, it prevents cars further back from going into the crosswalk.

It works better than anything else. After all, if I get hit, I get hurt, even if I'm legally in the right. People who blithely step into a crosswalk and assume cars will see and stop are fools.
This is the sanest Rails design-advice that I've read in a long time.

It counters the misguided "implicit over explicit"-mantra that is both very prevalent in the rails-community and also the source of most problems.

I.e. when you watch any random RailsCast it is usually filled to the rim with obscure incantations and "look how we need only one LoC to perform $excessive_magic"!

The end-result are those deeply entangled "piles of rails" that we've all seen and suffered from. Hopelessly overloaded models and a dense mesh of hidden interdependencies that nobody grasps anymore because many of them are not even explicitly declared.

Personally I've largely given up hope on rails and am waiting for the successor. The rails-team just seems too fixated on digging their rabbit hole ever deeper, rather than re-visiting design mistakes that were made early on.

However, if you are stuck with a Rails-app for the time being (and who isn't..) I'd definitely recommend to follow a pattern like the one outlined in this post. The best way to use Rails nowadays is to steer clear from most of the entrenched practices and packages (e.g. devise and related trainwrecks) and to use it like a library rather than a framework - as much as that is possible.

This eases the migration to the rails-successor when it manifests, and helps preserve the sanity of your older self and his successor.
Just made a 100K offer for a domain. Am I crazy?
My partners think I am, they say no domain worth that much. What am I missing?
Creating a file by definition 'puts you on their radar.' In many cases, this may be enough to draw the ire of people in power. It doesn't have to happen to everyone. As long as enough people are made examples of, others will think twice before voicing their opinions.

Edit:

> "You are both missing the plethora of articles about
> how every breaks at least 3 federal laws a day
> (unknowingly)."
>
> Citation needed.

http://blog.themillionairenurse.com/tag/breaking-federal-law...

https://www.rutherford.org/publications_resources/john_white...

http://www.amazon.com/Three-Felonies-Day-Target-Innocent/dp/...
They don't have a lot of choice. Prime interest rates have been near zero for over ten years. It's got to give at some point. Inflation-protected bonds have been bidding at both negative rates and 10% markup for a very long time, too -- lots of people are worried about the coming hangover.

http://www.treasurydirect.gov/RI/OFNtebnd

We can only hope that it's done smoothly.
Then everyone would have ran BSD.

(J/K)

Micro kernels are very hard to debug.
There are about 30-40 million Americans who watch HBO shows legally, and we agree, a lot of them would be happy to pay us directly. If we went, as you put it, “cable-optional,” we’d be breaking our existing, mega-million-dollar contracts with our current partners, and from what we’ve seen, they wouldn’t be too happy about that.

Kodak said exactly the same thing about digital photography vs retail film sales. The then-$17B/yr company just this month sold their remaining essence for $0.5B.

Remember who your actual customers are.
Cringley's attacks always struck me as being more hyperbole than substance. If IBM was not 'delivering' as a consultancy then it's highly doubtful they would be enjoying the growth and financial success that they are since it is their Services organisations that have, year on year, been amongst the most successful.

That said, IBM has changed and will continue to change. They constantly remix their portfolio, adapt and evolve and that has been the only way they have been able to survive over 100 years and prosper at a time when their traditional competitors, such as HP, are failing. One can see how they made the transition from a hardware-led business to a services-led business as a good example of that constant transformation.

Lastly, why is 'outsourcing' necessarily perceived as a negative thing? I see IBM and other multinational's ability to move work to the most effective -- from both a cost and skills perspective -- location as a very important tool in maximising shareholder value and ensuring profitability now and in the future. It's a fact that the world is evolving and, with it, labour traditionally sourced in local markets can now be found in low cost countries and hence in order to remain competitive globally companies must take advantage of this. Unfortunately, this often leads in a rebalancing of headcount in more developed (i.e. expensive) countries and this can sometimes lead to 'layoffs' but this is a fact of life and, I think, the consequences of ignoring it would be far worse for the other employees of the company as well as shareholders and the marketplace.
This comment is a bunch of babbling that lays up a smoke screen to avoid Graham's actual point.

I don't know whether it's true or not that variations in outcome are orders of magnitude greater than variations in valuation. But (a) it does not sound like an overtly crazy insight, and (b) if that's true, then Graham's argument is mathematically obvious: get in to Youtube or Heroku at 1/10th the stake you'd get in Carsabi and you're still way ahead.

For the inevitable long reply you're going to provide to make sense, it must directly engage Graham's core point. Maybe he's wrong on the numbers, and seed-stage valuations range as widely as outcomes (you're probably going to find out you're wrong about this). Or maybe there's some signaling you can uncover that shows lower-valuation companies tend to outperform those that receive outsize seed valuations. But it will be something like that, not, respectfully, a series of allusions to careers and spouses and draft horses and whatever else it was you said.
I'm wondering how this effects corporate outsourcing. The company I work has a Chinese development and as center. This has to be behind the corporate firewall so I'm thinking we will just close that down and move to a country that wants to be part of the future.
Different people have different tastes.
Different demographics have different tastes.
Just because the taste of the torrent "pirates" is more like your own taste does not mean it is good and the others are terrible.
http://www.domaining.com/topsales/
The author was looking for a vector illustration app, not a photo editor. Vector graphics apps are often used to create diagrams and other semi-technical drawings that require some CAD-like features, the simplest of which is a usable coordinate system.
The standard example is adding checked exceptions. You can refactor nested checks for null into straight line code in the Either (or Maybe or Option) monad, that does the same thing.

Consider this pseudo/Haskell code. Functions might fail, so we have to check the return value using nested switches:

modify s f = do
ev <- get s
case ev of
Left e -> return (Left e)
Right v -> do
let u = f v
ev <- set s u
case ev of
Left e -> return (Left e)
Right __-> return (Right (v,u))

Lots of nested checks -- makes the code more unreadable, and harder to maintain. Equivalent to null checks in other languages.

The 'case' stuff however, is the monadic 'semicolon' between each statement. So we can refactor to:

modify s f = do
get s
>>= \v -> do
let u = f v
set s u
>>= \v -> do
return (v,u)

Using the error monad definition of bind / >>= - http://hackage.haskell.org/packages/archive/category-extras/...

So then, if you language supports monadic syntax, you can actually use semicolon instead of 'bind':

modify s f = do {
v <- get s ;
let u = f v ;
v <- set s u ;
return (v,u) ;
}

and if you are in a whitespace-sensitive language, the error checking disappears into the newline:

modify s f = do
v <- get s
let u = f v
v <- set s u
return (v,u)

So the above code, in the Either monad, is equivalent to the original code, however, we now have shorter, cleaner code, and a compile-time guarantee that all return values are checked.

This example is my "programmable semicolon" motivator, from http://donsbot.files.wordpress.com/2009/01/semicolon.pdf

I chose the computational environment I wanted my code to run in -- one with checked errors -- and did this by overriding my language's default 'semicolon' behavior using the monad interface to do so.

I reprogrammed my programming language, to make it possible to write better code. That's real power.
Bobble, you've hit on the core problem. While most, if not all, mass murders involved a mentally unstable perpetrator, being mentally unstable has nothing to do with being too incompetent to kill lots of people. In fact, many of the mass murderers that the US has seen over the last decade were very intelligent individuals.

Also, ex-military are (probably) statistically more unstable than the average citizen due to conditions like PTSD. Keeping dangerous weapons out of the hands of the mentally unfit is a really complex problem to solve without either trampling over rights altogether (frequent invasive psych evals that have the potential of being biased or politically charged) or banning them altogether.

Banning these weapons altogether isn't a good solution (sorry Obama) because too much of America considers them a core part of their society and have shown that they really are mostly safe, historically speaking. However, I think there's enough evidence that the trend is shifting toward guns being statistically more dangerous than they used to be. Even if that evidence doesn't exist, there is a public perception that needs to be addressed. This is a problem with politics in general - if there's a public outcry against _X_, you have to ban or regulate _X_, even if there's no statistics to validate the public outcry; politicians have a need to be reelected (or in the case of a 2nd term president, the need to maintain a legacy or to get another Democrat voted into office after his term is up).

This article tries to walk a line somewhere between "ban guns entirely" and "give everyone a gun". I admit, there's a ton of problems with almost all parts of it (and yes, I am the author). But it is an attempt to invent a compromise that could add to society (by strengthening the police/protection agencies) instead of take away (ban guns, cultural norms) while still addressing the problem.

If you've been following Congress in recent years like I have you've probably become sick at what their idea a compromise has become. It seems like the Congressional culture has shifted toward a self-serving Armageddon between Good and Evil. Obviously that's a much (much much much) bigger problem that I want to address here, but introducing constructive compromises where both parties gain is where it starts.

Yes, I think this has gains for both sides. The "Gun people" also tend to be pro-military, so we're letting both sides "win" by giving enlisted and veterans some rights that are not widely available to the general public. Honestly, I don't think it's possible to have either side "win". I can't think of a way to address public concerns without taking things away. If someone can think of a way, please tell them to write to their Congressmen immediately.
The 20 Best iOS And Android Apps Of 2012
We have been moving the complex logic out of the models into libraries. But we are not happy with this approach.

We also find it difficult to cleanly develop views where data is needed from several different models. The whole Rails REST and MVC model gets in the way.

Would love to hear about how other wiser people have deal with these situations.
There's also a strong case for deflation, and an economy oriented more towards saving than towards consuming and borrowing money:

"Deflation is actually a good thing, because in a deflation prices drop and money becomes more valuable, so deflation encourages people to save money. Deflation rewards the prudent saver and punishes the profligate borrower. The way a society, like an individual, becomes wealthy is by producing more than it consumes. In other words, by saving, not borrowing. And during a deflation, when money becomes more valuable, everybody wants money. They want to save. Whereas during an inflation, you want to get rid of the money. You want to consume. You want to spend. But you don’t become wealthy by spending and consuming; you become wealthy by producing and saving."

http://www.forbes.com/sites/jonmatonis/2012/12/23/fear-not-d...

I also think that if the middle class is not vigilant, and it does not keep demanding higher salaries from their employers, they will quickly wake up in a situation where their money are "not enough" anymore to buy the stuff they used to buy constantly, because the value of the currency has dropped much faster than their salaries have increased.

And history is telling us that the middle class isn't actually that vigilant:

http://money.usnews.com/money/blogs/flowchart/2010/10/15/how...

I understand why the central banks want to do this. They want to not be restricted by anything. They want to create as much money as they want, and assuming they always intend to do good things with the money, then they want to be able to do that so they can "fix" things. But I think in reality it gives them that much more power to screw up things even worse. Basically this means that the central banks will centralize the economy, and will be much more able to manipulate it how they see it. But centralized economies are very vulnerable, and humans are not always right, or they may be too confident in a certain strategy. I think in the end this will just create more bubbles by the Fed, and it will be the majority of the population that will suffer from rapid currency devaluation.
Note: RMS think Linux is "good enough" and Linux-libre is part of GNU, so Linux will be used for the in-development official GNU "distro".
That assumption is obviously wrong when you mix financial compensation into it.

I've worked with more than a few programmers who were in it for a paycheck, some of them were perfectly competent at creating code for their little niche (CRUD apps, whatever), but were single-language, single-framework, lots-of-maintenance types of guys.

Needless to say, them putting 10,000 hours into programming isn't the same as someone who is really passionate about it.

To paraphrase: "Some people put in 10,000 hours, some people put in 1000 hours 10 times".
I'm kidding. The short answer to why I don't set up my own site is, I'm here almost entirely because I wanted to avoid having a site tied around my own identity / personal brand. I had a reasonably popular blog before HN, and fled to HN from it.
Exactly the same way as other media. In fact sometimes worse.

I have tried to sell a few bits of software via eBay (used windows XP pro retail box) which have been uninstalled or replaced with partner action pack licenses. After a day or so, I get an email from eBay saying that the item has been withdrawn due to a complaint from the manufacturer.

This is what they want.

I'm in the UK btw and am concerned this may become an international issue.
That's the thing though, they could make it available on iTunes immediately at the same time as the air it on TV. I'd pay for it. But they take too long to get it up there.

The concept of releasing in different parts of the world at different times is outdated. Release worldwide all at once.
> From the article: "Kaptchuk . . . doesn’t argue that you can simply 'think yourself better.' 'Sham treatment won’t shrink tumors

http://www.ncbi.nlm.nih.gov/pubmed/22287549

> process by which stress may potentiate carcinogenesis and how reducing body stress may prevent cancer growth and progression. The opioid peptide β-endorphin plays a critical role in bringing the stress axis to a state of homeostasis

http://www.scienceagogo.com/news/20050725232410data_trunc_sy...

> A study from the University of Michigan (U-M) has provided the first direct evidence that endorphins - the brain's own pain-fighting chemicals - do play a role in the phenomenon known as the placebo effect

Sure throws a spanner in the works.
Make your terminal snow
- Python Version: https://gist.github.com/1508912

- Bash Version: https://gist.github.com/1505483