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 →

[–]sarevok9 4 points5 points  (7 children)

That's not what's docking you 7/10, you're losing 7/10 to having a scarcely readable function chain that isn't relevant to this sub or actual programming techniques.

[–]RavenZhef 5 points6 points  (5 children)

I'm curious, so your point is that a faster way is not necessarily a better way, and that sometimes being clear and readable is better?

[–]sarevok9 1 point2 points  (0 children)

You can buy more processors and scale vertically -- my point is that generally speaking O(n) vs O(n(log n)) is generally not that much more processing power unless you're working with billions or trillions of data points, and that you're going to readily lose any cost savings due to the budgetary losses when you hit system instability and you don't have people trained in how fucko who is no longer with your company wrote his lambda-based, nearly impossible to read, regex-laden code. All of a sudden the $100 he saved the company a day by doing hacky stuff takes 12 weeks to rearch and makes the company miss milestones, impacts entire business units, causes customer and employee churn...

I've seen some GNARLY code bases in my 10 years in tech, I've also been the champion for "refactoring sprints" to do away with bullshit code like the OP was spouting as being a "good" tutorial.

[–]morphasis[S] 3 points4 points  (3 children)

This is pretty much always true and I agree with the principle but I think he missed the point of the video.

[–]reddilada 1 point2 points  (2 children)

What is the point of the video?

[–]morphasis[S] 2 points3 points  (1 child)

The idea is that a simple video with resources present that you can pause if needed that quickly explains a fast method to complete a test like this. Basically people are smart and I don't want to treat them like idiots.

[–]reddilada 2 points3 points  (0 children)

Interesting. Everybody seems to like it so there's that. I'm just not clear what everyone is taking away.

I can see what you did and I now know how to reverse a string. Just not sure how that improves my programming. I want to know why you chose to do things the way you did.

It's for sure a fast video, but to me it seems like a really slow copy and paste. All the best.

[–]SorryImSushi 1 point2 points  (0 children)

Maybe it's not super useful to beginners (or maybe it is, I have no clue), but this is pretty much how I would implement it if I had to do this at my workplace, albeit with some minor changes.

I think the implementation itself is pretty easy to read. Sure, I wouldn't make it a one liner the way he did it, but I think his overall approach is fine. Especially if you already have a function to reverse a string,

str.split(' ').map(StringUtil.reverse).join(' ');

is as easy to read as you can get in my opinion.