Better HN
topnewbestaskshowjobs
Log inSign up

vectorpush

2,683 karma · joined Jun 23, 2011 (15y ago) · 778 submissions

Submissions

comment 12y ago · link · parent

The http server's job is to translate URLs into http requests for consumption by the application. The http server should generally be agnostic regarding the semantic meaning of your URLs, which take the form of business rules, the proper place for which is the application layer (whenever possible).

comment 12y ago · link · parent

I won't stoop to insults the way you did

How noble of you. You're right though. I apologize for disparaging your faculties of logic, it was tongue in cheek but wholly unnecessary.

though it might be, if the effect size is large enough. How large was the rest of your sample, and how big was the difference?

How can effect size be determined when we don't even know what is being measured? What is the criteria for determining the quality of a programmer? How is that criteria applied? Are there controls for education? exposure to programming as a child? years of experience? quality of experience? quality of tools available to the programmer? quality of the work environment in which we seek to evaluate the programmer's quality? It's reasonable for one to leverage professional experience in judging the skill level of colleagues, but it'd be foolish to think that those observations can be generalized across an arbitrary dimension of the programmer population (such as gender, or race, or political leaning).

are you really not even curious about these kind of differences?

I guess? I'm always eager to learn more, but I don't really find the question of programmer aptitude as a function of gender very interesting since I can't identify anything unique about programming that would suggest either gender would be qualitatively predisposed to the craft.

comment 12y ago · link · parent

Separation of concerns? Why would I ever want to implement business logic in an http server configuration file?

comment 12y ago · link · parent

No, more like weak inferences

Indeed, quite weak; weak to the point of being useless. In ten years of programming, I've only worked with two developers who were comfortable with the use of regular expressions, both were women... what does that tell me about women?

Nothing.

Similarly, whatever experiences you've had with female programmers who are "worse than the average male" programmer is pretty clearly worthless (for the purpose of drawing conclusions about female programmers), especially when one considers that your definition of average is, at best, a nebulous amalgamation of your own subjective impressions.

comment 12y ago · link · parent

Because thinking back over all the people I've programmed with or inherited a codebase from

So basically, when considering a minuscule, poorly defined and poorly measured data-set, you've decided to draw broad conclusions about half the human population.

I'm not sure how great a programmer you are, but I'll tell you right now that your logic skills need some work.

comment 12y ago · link · parent

>its a easy fix.

Famous last words. The day when it's not an easy fix, you're stuck with bad code live in production affecting all users until someone can fix the bug. Worse, the only way to verify that the fix works is to check your assumptions against the live system aka a nightmare. Of course, none of this matters if your site is a personal blog or something that doesn't affect anybody's business, but nothing really matters in that case.

comment 12y ago · link · parent

Editing code, live on the production server... what could possibly go wrong?

comment 12y ago · link · parent

Awesome. This is the best game of life I've seen on the web. It has every feature you could ever want for someone who enjoys creating patterns incrementally.

comment 12y ago · link · parent

What would be the selective advantage of pain resistance in the context of a lab environment? It seems to me like the rodent's chance of passing on it's genes would have no correlation with resistance to pain.

comment 12y ago · link · parent

I literally cringe whenever someone posts this hackneyed response.

comment 12y ago · link · parent

Why?

comment 12y ago · link · parent

Rest assured, children are still being bullied quite regularly.

comment 12y ago · link · parent

Uh yes, probably a factory is never going to be an optimal solution.

Never? That seems a little extreme, no? It's a tool like any other and IMO, it's a sometimes useful idiom that works pretty much identically in Go as it does in other imperative languages. However, I'd be interested in any links you could provide which might elaborate on why a factory is never an optimal solution.

If you know what type you need, why would you need a factory to create it for you? Just create it.

I already explained why. The Factory abstracts away instantiation and configuration details for a complex or dynamic initialization process. I understand you don't agree with that approach, but it's fairly common.

(see page 5) http://www.cs.colorado.edu/~kena/classes/6448/f07/lectures/2...

(see accept answer) http://programmers.stackexchange.com/questions/81838/what-is...

but there's pretty much never a reason to have a function create a variety of types for you.

The capability to define a function's return type to as an interface type would suggest otherwise, but we'll have to agree to disagree in that regard. :)

comment 12y ago · link · parent

This isn't a Go problem, it's programmer problem.

Thanks, but just to be clear, this is not a sample from a real application, it's just a contrived demo designed to illustrate the pattern.

Why does the ProviderFactory hold the knowledge about the query interval for each provider?...Let the query interval be defined on the type, not in the factory.

As previously stated, the example is contrived. If this were a real application it could probably make sense to define the query interval on the specific type, but lets just say, for the sake of illustrating the idea, that the desired interval for a specific provider could depend not only on the type but also the total number of providers already allocated for a given type.

For example, perhaps the ProviderFactory might calculate the total number of WeatherProviders already defined, and reset the query_interval for all WeatherProviders to be (some_weather_provider_specific_constant * total_number_of_allocated_weather_providers). Whenever a new WeatherProvider is requested from the factory, the factory increases the query_interval for all WeatherProviders. In this way, the ProviderFactory acts as an automatic rate limiter for each provider by keeping track of each instance.

With the data structure you have, any time you add a new provider, you'd need to add a new case to that switch statement.

Well yeah, that's pretty critical to the "factory" role of the ProviderFactory, how else could the factory return a variety of types if it didn't have a case/branch for each signal that represents each type? Additionally, if individual logic is required for preparing a certain type of provider, the switch statement is there to accommodate the needs of the specific type before returning it.

That's like the polar opposite of separation of concerns.

How do you figure? In this example, the factory is concerned with all logic related to instantiating and appropriately configuring each instance depending on the type of instance, the state of the app or the state of other instances. I'm not sure what concerns are mixed here. Alternatively, I could export all that logic into a NewFooProvider function for each of the various FooProviders, but the idea is to encapsulate all that custodial work within the factory so that a Provider user only has to request their specific provider and that's it.

What do the types even do in your example?

Nothing. It's just an example.

The same for the host they connect to. Shouldn't that be defined in the type? Like make WeatherProvider.Connect() call ProviderFactory.WeatherHost() to get the host to connect to.

I think you're missing the point. Yes, yes, that design would work fine, but all you're really telling me here is "you don't need to use a factory in this example". What I'm saying is, when I want to use a factory (lets just assume that it makes sense in the design of my app, unless your argument is that a factory is never useful), I have to indicate which type of instance I want the factory to produce by using a zeroed struct or an arbitrary data type, what's going on within my factory is actually irreverent; any example factory snippet could be refactored into something less complex when your only context is 100 lines in a scratch pad.

You're doing everything inside out.

I'll seriously take that opinion into consideration.

comment 12y ago · link · parent

I was in a rush and didn't create the most illustrative example.

you already know which provider you want to use, so why not just initialize the struct from there and skip the factory method altogether.

The reason that I want ProviderFactory to generate instances is because I also want it to act as a manager for those instances. ProviderFactory can keep track of all ServiceProviders and perform various operations or broker data between instances.

Here is my previous example slightly improved. http://play.golang.org/p/XoXu9x9r8f

Now, ProviderFactory injects configuration information into ServiceProvider instances based on their concrete type, before establishing a connection. A more complicated app might wrap the NewProvider function into a gorotune/callback that blocks each provider instantiation until a successful connection has been established. This is all beside the point though; all I want is something akin to a special "type" type that the compiler recognizes as a symbol for that type that the factory can use to evaluate which concrete type to produce.

comment 12y ago · link · parent

I am not a Java programmer but the Java class literal seems like a perfect example. The class literal provides a language mechanism for representing a type of class (in Go's case it would be a type of struct) without the need for an actual instance of the class or another arbitrary data type (like a string or const) that the application is programmed to recognize as a signal for that class.

comment 12y ago · link · parent

Right, and this is what happens in Go. I can use a string or struct as a signal for what type to produce, but I wish I could communicate that type in a "first class" way, rather than using another data type as a proxy signal. Check my reply to melvinmt for a more clear example of what I mean.

comment 12y ago · link · parent

I created this contrived example to illustrate the basic idea behind the pattern I want to emulate.

http://play.golang.org/p/7T2s8Dn0Sr

Ideally, on line 57 I'd pass in some kind of "first class" type representation that the switch statement could use to branch into the correct type, rather than a zeroed (or not, Go doesn't care) struct or a string. Admittedly, this could definitely be abuse of Go semantics, so I'm also interested in how I could refactor this into a more canonical Go pattern.

comment 12y ago · link · parent

I love go, and I concur with almost everything the author wrote here. A small pain point in my experience though is that Go lacks an elegant way to pass type information around without using a zero valued (or fully populated, it makes no difference) instance. For example, I have a factory struct with a New 'method' that returns interface{MySignatures()}, but I cannot inform the factory of the concrete type I want it to produce without passing in something like new(ConcreteStructWithMySignatures). Some have suggested I pass in a string, but what is the point of a type system if I have to use strings to reason about my types?

comment 12y ago · link · parent

Look out homakov. :)

comment 12y ago · link · parent

Apparently this was too embarrasing to remember?

I remember it just fine. The people exercised their right to boycott, Phil Robertson exercised his right to stand by his beliefs, A&E exercised their right to capitulate to the outrage, and then they exercised their right to reverse their own decision. I don't see the problem. The same thing played out in this case except that as of yet, Mozilla hasn't reversed their decision.

This is unashamedly wrong. Federal law in the US currently delegates this decision to the States.

And? My point is that the law is morally indefensible. What practical purpose does prohibiting gay marriage serve except to arbitrarily stigmatize a class of people? Nobody materially benefits by prohibiting gay marriage, it doesn't free up more marriage slots for the rest of society, it just unnecessarily complicates the private lives of gay couples who want to be married.

Because the rights of single old and young people woudl be irreversibly harmed by their existence.

How? Heterosexual single people can get married whenever it suits them, but for some reason gay couples shouldn't be allowed the same freedom, because... why?

comment 12y ago · link · parent

The problem starts when people start rallying active boycott on a person because his opinion is different.

Why is that a problem? People have the right to boycott whatever they want, it's really one of the only peaceful and effective forms of dissent available to ordinary citizens. That "difference of opinion" manifested itself as a financial contribution to an anti-gay cause, what kind of reaction would you expect from those who were exclusively targeted by said law?

a prop that passed in California, by the way, so maybe it's not just a bunch of wackos

And then it was overturned by the supreme court as unconstitutional, so maybe it is "just a bunch of wackos". Either way, I don't think the fact that a law passes lends any credibility to the substance of the law. To quote the court:

DOMA’s unusual deviation from the usual tradition of recognizing and accepting state definitions of marriage here operates to deprive same-sex couples of the benefits and responsibilities that come with the federal recognition of their marriages. This is strong evidence of a law having the purpose and effect of disapproval of that class. The avowed purpose and practical effect of the law here in question are to impose a disadvantage, a separate status, and so a stigma upon all who enter into same-sex marriages made lawful by the unquestioned authority of the States.

In other words, the only practical effect of the law is to disparage and stigmatize homosexuals.

comment 12y ago · link · parent

Never had the gay community been casted so intolerant before, or not that I know of, at least.

Why would the gay community ever be tolerant of someone who supports anti-gay legislature? I mean, come on, it seems pretty rational for LGBT supporters to be intolerant of individuals who want to prevent them from having the same legal rights as heterosexuals. It's not as if there is some reasonable excuse to oppose gay marriage, this whole thing exploded because the position is unambiguously indefensible. That doesn't mean it's the worst thing in the world, you just come off as a petty asshole when you try to prevent people from living their lives in a way that has absolutely no affect on your own life whatsoever.

comment 12y ago · link · parent

Eich had the freedom to donate his hard earned money to an anti-gay cause. LGBT supporters had the freedom to make blog posts and tweets about their opinions on the matter. Eich had the freedom to stand by his position. Mozilla had the freedom to designate its CEO.

Why the outrage? The system worked. The only group that had it's freedom threatened was the group of individuals targeted by the prop 8 law. Denizens of the internet could have spared Eich their ire if they were so inclined. Eich could have apologized if he were so inclined. Mozilla could have stuck by Eich if they were so inclined. Everybody acted in their own interest and Eich's resignation is a consequence of that fact.

comment 12y ago · link · parent

You're me almost a decade ago. A couple semesters into college, I picked up a part time role as a junior developer. Since, like you, I had already been programming for years, I exceeded expectations and became highly valued by my employer. Part time became full time, and I started to make a lot of money for a college kid. At the same time, I was learning so much from my work that school seemed to wane in utility, really only complicating my work schedule where I was being paid well to enrich the exact skill-set I wanted from the beginning. Finally, I decided to quit school.

I continued in that position for a total of four years. Another five years and several positions later, I am doing quite well for myself, especially compared to my peers, graduates and non-graduates alike.

With all that stated, my only regret is that I didn't finish that damn degree. Get your degree. What I omitted from the above is the unending doubt and disrespect you will face as a professional without a degree. It was only after I was making tons of money that my peers stopped endearingly regarding me as a lazy drop out. Despite the wealth of prospects available to me as an experienced developer, I have faced numerous professional rejections simply because I did not have a degree to show.

Returning to school never gets easier for anyone, but you're facing a double whammy in that not only is the cost of tuition going up, but so is the cost of the hours you'll spend at school instead of working.

comment 12y ago · link · parent

I bought the S4 last year, there were a few close options but the removable battery and flash memory slot made the difference for me among the premium android phones. I am also a big fan of the galaxy's screen, which I know is a deal breaker for some. After a year, I am definitely happy I could easily remove my battery the few times I needed to. The 64gb of flash memory has also been useful, not only for storing audobooks and podcasts (i have a 20 mile commute), but also for use as a portable drive utility for moving large files in unusual circumstances (for example, I wanted to grab a 10gb file from my father's desktop, he has a 1Mbit internet connection, so having 40gb of free space on my phone was quite handy).

comment 12y ago · link · parent

Take that one step farther and you wind up with silliness such as an unwillingness to discuss obvious gender mental differences such as the differential performance under the Piaget water level test

So what? The veracity of scientific studies is not at issue here. My point is that unlike the abortion debate, there are no muddy waters in play here. It's unequivocally wrong to deny homosexual couples the same legal rights as heterosexual couples, there is just no other reason beyond bigotry to deny them the freedom to be married. I'm not saying that we should hunt down all the bigots, I'm saying that bigotry alone is not a satisfactory justification for any position and is easily rejected as such.

But wait, what can of worms did I just open? I suggested a connection between widespread homophobia and an innate phenomena that causes the vast majority of humans to feel revulsion under the right circumstances. And it is a pretty strong revulsion

Ok... Perhaps that's a possible explanation, it's also a completely irreverent one. I am revolted by the sight of individuals who put 4 inch gauges in their ears, but that personal disgust doesn't justify an attack on their right to start a consensual legal relationship with another consenting adult. My disgust doesn't matter. Their relationship is none of my business. Laws against gay marriage are in a similar vein to sodomy laws, namely, a bunch of hateful, entitled, "revolted" traditionalists who want to leverage the force of the government to prevent consenting adults from living their lives in a way that affects nobody but themselves. It's simply wrong. There are no two ways about it, nobody gains anything by keeping homosexuals away from marriage, it's only purpose is to deliberately deny homosexual couples the satisfaction of inclusion in a legally recognized institution.

1
131415
26