Psssst. The OP of this article who criticizes Jeff is Jacob Kaplan-Moss. ie: A male.
HN user
mendicant
I look so different now, but looks can be deceiving.
There are certain languages and situations where the pattern does make sense. But as a heavy C# coder, I find that more often than not you're dealing with a class heavy codebase where it's more important that you _don'_ do foo()?.bar?.bing(). Specifically as things happen such as refactoring you often need to ask the question should something 'care' that a foo has a bar which has a bing. Perhaps if you want to know about a bing that is down the chain from Foo, perhaps Foo should provide you with the Bing somehow (which really helps with refactoring as codebases grow to years and potentially decades old).
It's not always so cut and dry, and there are situations where this is a very valuable tool. I just feel that down the road if you feel like there is a valid reason for refactoring object hierarchy that you'll potentially be doing yourself (or those that follow) a disservice in the long run.
I can understand the reason for it being there, but I also tend to fall towards following the Law of Demeter. I tend to find that most (not all) of the use cases of this are a symptom of overly intimate knowledge between objects that really shouldn't know about one another.
The question I have about this: Does making it easy to do parent?.child?.grandchild?.property help or hinder the software development process in the long term?
Okay, but the guy says he bought it in Jan of 2013 and waited over a year to try and activate the offer.
Many of these offers are time bombs and sometimes for good reason. I'm not so sure I'm ready to pick up my pitchfork if this is the case.
I will start by saying that the sentiment of this is simple and true. The value added by the "Unlock All" button in it's simplicity is valid.
But they didn't "just add a button" they also added over 3x the content to give that button value.
If they had kept their original 3 books and added the button I'm guessing they would have seen next to no difference in the bottom line.
My point being that in order for an Unlock/Buy All button to work, you need to have enough content/product/etc to make the button worthwhile. Just adding a button may not be enough.
I can agree to a point.
But my question is, what if the app doesn't, and isn't ever meant to, support a large number of users? What if even with the concurrency issues, it's fast enough?
I like the idea, but it crashes Opera.
I have to agree. Two things have happened here to make me see it:
- Taking on a role with more responsibility, leadership requirements and business knowledge
- Starting my own business where I get to make decisions (with my co-founder)
I see how many times as as developer I've either not cared about decisions that directly affect me. Or maybe I've just rolled over and accepted the things I don't like. It's the nature of (most) developers. Don't stir the pot. Don't dissent. Just get in and get my work done.
Here's the reality. Knowing more about your business makes you a better developer. Knowing how to say no and stand up for yourself makes you a better developer. Knowing how to talk and communicate with your users, your bosses, your co-workers (or anyone really), makes you a better developer (and will improve your work life). Being a strong technical person with strong Business, Marketing or Personal Communication skills makes you unstoppable. This applies to more than technical folk. The more you do - The better you are. Take this advice you might find that the skill you thought you were bad at, or hated, or avoided is actually very rewarding - Difficult, but rewarding.
And finally, to Amy: Thank you for all the work you do on showing people the power that they have. I started a business 5 years ago and have had to sit through the whole "YOU NEED TO GET FUNDED" and "YOU NEED TO GET BOUGHT" that seems so prevalent in the startup ecosystem. Me and my partner did everything ourselves. And now we own a business that makes decent money that goes DIRECTLY TO US.
But when you're overexposed to the opposite line of thinking, it's really easy to get caught up in the "am I doing this wrong?" and questioning yourself. You are one of the few people who puts an emphasis on growing and trusting YOURSELF. I'm very on board with most the things I hear you say because they are the very values that I have held in high esteem, yet was still questioning. So thank you for that.
ps. I also think that 'ahoythere' would've been an awesome username.
He's basically a step away from having several objects (let's call them handlers) which can do your handling for you. Further, they can define the set of circumstances in which they are valid.
I'm going to work with a couple of assumptions:
1) The test casts which he refactors to test*() methods are non-trivial 2) The handlers _may_ be large sets of code
Here's a way to handle one of this refactored methods:
if (!test1()) { handle_failure_1(); return false; }
if (!test2()) { handle_failure_2(); return false; }
if (!test3()) { handle_failure_3(); return false; }
handle_success(); return true;
That's a lot of potential code we're dealing with in this class.
What if:
class HandlesFailure1
def handles_this_case(params)
#code from test1()
end
def handle(params)
#code from handle_failure_1()
return false;
end
endclass HandlesFailure2
def handles_this_case(params)
#code from test2()
end
def handle(params)
#code from handle_failure_2()
return false;
end
endclass HandlesFailure3
def handles_this_case(params)
#code from test3()
end
def handle(params)
#code from handle_failure_3()
return false;
end
endclass HandlesSuccess
def handles_this_case(params)
return true
end
def handles(params)
//code from handle_success
return true
end
end#And now the original class
class DoesSomething
#There are ways to set this up fairly easily. One simple way it to just new it up here, but you could auto-wire it too
handlers = [HandlesFailure1, HandlesFailure2, HandlesFailure3, HandlesSuccess]
def do_something(params)
handlers.each do |handler|
return handler.handle(params) if handler.handles_this_case(params)
end
end
endThere. Now there's a loop and an if. Check each case and either handle or toss it out. This can also work for the case where you might want multiple handlers to handle something, just don't return on the first one.
I'm not saying it's the right way, but it's another way.
Pros: It really helps to group together the handling methods with the test methods. Very simple dispatch method
Cons: Separate classes, and harder to view all the handlers together.
Children's minds are built to soak in information. You could wait until a kid was 10 to introduce them to computers and they would still blow your mind with what they could figure out and do.
I highly doubt that holding off on video games and computers will be a detriment in the long run.
I spent nearly a year building a SaaS application for Oil and Gas companies here in Calgary. My partner had the idea after he got tired of phoning/emailing/talking to every contact in his book in order to find partners/buyers in land deals.
So after a year of weekends and evenings, my partner started to pound the pavement. We were profitable in our very first year after launch, and continue to be. Our biggest expense is advertising, which is very targeted. I think about 80-85% of our pre-tax revenue ends up being profit, which is great.
I still have my day job, and for the 30 hours/week between us that we still put in, we've been _very_ successful.
true, but they kind of go hand in hand.
The nice part about named params is that it can make your code more clear if you have a lot of parameters on a method... but you could do the same thing by introducing a parameter object and be as clear and more resistant to change.
My point is: If your class/code/file is so big that you need to hide code to be able to easily navigate (or worse, understand) it, you're doing something wrong.
I understand this is a religious argument of the code world and you're likely to disagree with me. I'm fine with that.
Yup. There's so many of these that are either irresponsible (Hiding code) or of limited usefulness (IsNullOrEmpty) or too limited to be truly useful (Named Parameters).
Hiding Code: I've got an idea. If you've got to hide code, maybe it _doesn't belong in that class_. Single responsibility people.
String.IsNullOrEmpty(): Wow! Thanks MS for saving me from writing one 4 line helper method. What would be useful is if you provided these helpers for the other 90 that I need every project. Seriously, any C# dev can provide you with their "utility" project that has them.
Named Parameters & Defaults: Awesome!..... unless you need something other than a primitive, in which case you can't set default values, since it's nothing but a fancy compiler trick.
I like C#, but really, there's not much they've added since Linq that's really crazy interesting. Not that there isn't, but most of it isn't listed in this article.
First off, I love the idea.
Secondly, I can't sign up for the weekly email. It says: Cannot POST /new
I've used it since v5. I love it, but seem to think about switching every once in a while, but no one seems to have mouse gestures which can match Opera's. Also, I love the speed dial.
Many will notice if a shortened url goes to another shortener and give a 'security notice'.
That's part of it. But the author should articulate it.
There is also certain (specific) situations where the original code (e.NewItem as Customer).Save() would fail but ((Customer)e.NewItem).Save() wouldn't. That specific case is where the type of e.NewItem has an implicit cast to Customer (as would return null, but a (Customer) cast would work).
But if you're doing implicit casting you might be facing other issues.
Yes, null refs are bad.
But so is an InvalidCastException -- Which is what your new code could throw.
I really like it. Especially that with each suggestion it tells you whether or not it is available.
The hardest thing I had with the site was when there were a lot of suggestions I had a lot of trouble reading through all of them, kind of like the words all ended up running together. It might just be me though.
My wife has been looking for a domain name for a while now, and we've already found a couple possibilities because of this.
As a future feature suggestion for the domain spinner -- At some point it would be really cool if you could find a way to choose a domain name that you kind of like, choose it and only show ones that are similar to it. This would be especially good when combining with adjectives. Some may be looking for more cheerful or positive adjectives while others may be looking for powerful or possibly negative ones.
I agree. Especially concerning industry. You can have all things equal (Title, Education, experience, etc) and one industry will still pay way more than another.
Besides, does it really make sense to be downtown and have your salary being compared to the guy working at the McDonalds in the food court of your building?
I like the idea, and with a few tweaks it could really be a big thing. There are some companies who pay a very large sum to see how they compare against others in terms of pay/benefits/long term incentives.
The money wasn't the issue. The fact that there was literally not a single company signed up was the issue. Why would a top company pay for a service that -- as of that time -- no one was using.
The fact of the matter is, it was two guys coming up to a massive company saying "Hey! We've got this site where you can advertise all these items you want to get rid of... but we've got no traffic and you will be the first person on it." There's literally no incentive for them.
Our service depends on having clients to be valuable. So there wasn't any value in our service at the time. However, as soon as you get one of the big guys signed up and putting their items on our site, we instantly add value and get the "hey, if Company X is putting their stuff up there, I want to be there too!" effect.
I'm in one now. It's nice, but I've sat in other chairs that are $250 that are also quite nice -- not as nice, but decently close.
However, those $250 dollar chairs only seem to last me ~2 years.
A side note that does make a difference: The $250 chairs are at home and my children are _quite_ hard on them.
We gave free trials. One of the most important things for us was image. We work with oil and gas companies and getting a couple of Canada's top producers on board was paramount for us.
We needed the "well if big guy X" is using it then maybe it's worth checking out.
We met with some big guys and asked what else they would need to make it work for them. A few tweaks later and a 6 month free trial (plus discounted first year) and we were off to the races.
There are some customers who love us because we love feedback and work hard to implement the really good ideas.
Providing a free trial + personalized tweaks gave us the start we needed. It worked doubly well because we targeted the companies who have respect in the industry first.
Looks like a ton of fun.... but I don't follow football, cricket or tennis.
If there was American Football, hockey and basketball I can think of at least 10 people I'd send this site to right now.
Also, kudos to including a real user signup alongside the facebook signup.
I know at least a few of you thought it... what would happen if people were tricked into clicking that link and button. Kind of an a-hole thing to do.
However, it does make me wonder how fast they might find a fix for it if it were to happen to enough people to make it a priority. Or even, how many people it would take to make it a priority.
The problem is that I want to help, but I can't. If they've added what other users have suggested, that anons or newbs can provide answers/edits that have to be approved by a more senior user that probably covers about 99% of the situations that I'm concerned with.
You're right that the system can't know my insight. But the community can. It is a community right?
I'm cool with going through some sort of approval process. If it means that it takes a few extra minutes for my changes to get in then so be it.
I don't care to participate in SO often. I don't have high rep.
I _can_ provide insight.
every once in a while I find somewhere that I can provide some value or insight, whether via editing an answer with a url that's out of date, a comment expanding on the answer, etc... and it seems like I never can.
I don't care to jump through the hurdles to get to that point. I didn't come there to ask a question. I didn't come there to sift through questions to answer.
I came looking for something. I stumbled upon something where I could provide value and was shut down because I have better things to do with my time than to jump through hoops.
It's fine for the power users who want the world to see their rep, or the people trolling for questions regarding their pet projects. It sucks for the casual user.
So, yes, in theory the rep hurdle is quite low. I've just got better things to do with my time. -- Which I already wasted trying to help someone in the first place.
I've taken a few courses suggested here and just a small bit of warning: Make sure you're going to enjoy, or at least be interested enough, to learn something.
I've taken Psych. I've taken Sociology. I've taken Philosophy (both Logic and otherwise). I've taken technical writing courses.
Other than the logic courses, I hated them all. I hated them to the point where, though I passed, I did not take anything out from them at all. It just didn't interest me.
All I'm saying is that as you read these suggestions, try to make sure that you are taking into account that there's something you want to get out of the class so that if you end up not liking it you can focus and try to get something out of it. -- I didn't, even though I could have.