skysight-inc/HackerNews huggingface dataset:
That says nothing about the guard itself, only about code organization. Ifs in some of his refactored functions can be as well guards.
I think this is much better: http://radex.io/swift/guard/
Lots of short functions are usually worse than a single long function. When you go to figure out what the code is doing, instead of reading through each statement of a single function and understanding it as you go, you keep being interrupted by new functions you have to read and understand. What does "reduceDepositedCoinsBy" do? Yes, I'm sure it subtracts its argument from the deposit amount, but what else does it do? Could it be causing the bug I'm trying to fix? No, it just does the obvious thing, OK, now what does "removeFromInventory" do? And so on…
I feel like somewhere between the two would pass. Keep the validation as distinct functions but inline validatedItemNamed, reduceDepositedCoinsBy.
Not clear from the article or linked press release how wildlife isn't caught up in the cleanup. Would also be interesting to know how small an item it will clean.
I feel the same. When I'm new to a code base its a pain to keep jumping around functions to see what they actually do. I agree functions should be short but this is a step too far for me.
Not only 0 and 1 are Schelling points - default options you can assume pretty much everyone would chose - they're also special in the way that they define a (positive) range where numbers always stay inside that range under multiplication. Two numbers between 0 and 1 multiplied together will always give a number that's also between 0 and 1. That's why a lot of places in math like to transform domains into the 0...1 range.
Yes. And if all your code is composed of three-lines methods, then ok. Otherwise guard is extremely usefull, because unlike 'if' it leaves your constant/variable accessible outside the guard scope.
The Power of Writing [pdf]
All too often, in every stack, the language is blamed for design deficiencies which lie with the programmer.
23andMe Data transparency
It makes them think.
Try your very best.

Read that comment until understanding gives way.

You should realize that the comment whiffs of a lack of religion.

Unless of course you delight in dissension for the sake of its inanity.
A so-called “expert witness” fails to perform middle school math
I'm not sure it was a big part of his rise to power, but it definitely helped him in the popular memory. Along with the famous radio speeches. "We shall fight them on the beaches" is his great legacy and memorial.

Remember, Churchill was a member of the hereditary aristocracy with inherited wealth, which he seems to have spent or misinvented to a great extent - that's the point of the book being reviewed here. That was a big key to power.
A look inside the successful life of billionaire Uber CEO Travis Kalanick
Yes it's more cognitive overhead but it's a more functional than imperative style which usually has many advantages. If the functions are named well (naming being the hardest problem) then it should be easy to read without knowing exactly what the implementation of the function does.
There are also extensions with names like "Google search link fix".....

Also uses JavaScript so you can't turn that off.
USDCHF+Rallied+On+Bullish+Offensive+With+Eyes+On+1.0100
Dirt Bag is a bag filled with real dirt. It is custom designed with decorations and comes in multiple colours. It is meant to be given as a gift, joke, or to someone that is actually a dirt bag.
I don't think it's useful to extract every guard statement into a separate function. Consider importing a json file where each field could potentially contain invalid or missing data. Sure, you could create functions like parseTitle, parseSubtitle, parseAuthorName etc. but these functions will probably only be called from one place and I don't think they improve readability.

On the other hand, I do think that larger functions should be broken up into smaller parts where it makes sense, e.g. a separate function for parsing each object in the json example.
In Germany, the max. allowed speed for trucks this large is 80 km/h. Therefore, no need to overtake, if she drove 80 km/h.

Or, try to honor the speed limit in construction areas, which are at least 80 km/h, sometimes 60 km/h. Especially in the latter situation, it is guaranteed that a truck WILL tailgate you, sometimes honking. Around here it is pretty dangerous to honor such speed limits even if they are justified.

And not to talk about bad weather conditions. Just a few days ago I needed to drive though heavy mist with pretty bad visual conditions. Trucks where overtaking all the time despite seeing nothing. If there had been a traffic jam it would have been impossible to stop quickly enough.
Has anyone seen production code with <=10 lines of code per function before? I've honestly never seen it, and I think at that point the code becomes harder to read because you're tracing through function definitions to decipher what a single function should do.

I usually notice functions get hard to read when they hit 80 lines or so long (generalization, of course), and try to keep mine under say 50 unless it's one of a few core functions in an application.

Interested in hearing others' experiences.
> The larger image previews displayed when clicking a specific image result are actually hotlinked from the original source

So the website pays the cost without getting the benefit of a visit?
I really hope you are successful ! I have been stalking your work for a while :D

Have you tried talking to local schools ? They seem really good target audience - with a lot of money actually.

I am also interested OS dev but I had nightmarish experience with C# while working at BRL.

I too am from UoB ( Eng Maths ) - graduated recently.

Its funny how much CS people are always browsing HN lol
I like how you differentiate from Sails such as ES6, and also the fact that you are much more community oriented.
Although I am not a JS fan for backend, I will give it a try next time instead of using Sails.
Take a look at the refactorings available in CLion: https://www.jetbrains.com/clion/features/code-generation-and...

Refactoring tools are incredibly powerful. For example, renaming a class method "foo". You can rename it yourself with a text editor, but now you have to manually update all the callers. You could try using search/replace, but what if several unrelated classes have a "foo" method? How do you only change the correct method calls? The IDE refactoring tool does this automatically.
Location: Rome, Italy

Remote: yes

Willing to relocate: depending on the location

Technologies: iOS, Java, Bitcoin, web, databases

Email: keeshux at gmail dot com

https://github.com/keeshux

https://www.linkedin.com/in/davidederosa

https://twitter.com/keeshux

~~~

Mostly an iOS engineer for the last 5 years but in my life I've worked in very diverse environments, my preference being anything backend-related. As a Bitcoin enthusiast I wrote a blog series about Bitcoin programming:

http://davidederosa.com/basic-blockchain-programming/

and an SPV client library for iOS:

https://github.com/keeshux/BitcoinSPV
Who is then? What is then?
To me the general idea of splitting a complex problem into a series of less complex problems is good. However the example used seems trivial and the solution is worse than the problem:

> 1. It is pretty long, sixteen lines, multiple parts separated by empty lines.

I wouldn't call 16 lines "long".

It contains empty lines for easier reading. Well done, not actually a problem.

But it lacks any comments on why the assertions have to be made.

> 2. It does several things. It gets an item by name, validates parameters, and it implements the logic of vending an item.

These are the things that naturally belong together. Separating validation from logic is not a very good idea. The logic requires the specific assertions in the validation part. They belong together.

> 3. It has several abstraction levels. The high-level vending process is hidden among the finer-level details like Boolean checks, usage of specific constants, math operations, etc.

In the single function implementation it's actually not hidden because it's all in one function. Use some comments to structure your function.

---

In my opinion separating this function into multiple functions would only make sense if these parts are used multiple times AND if they are commented well on why they need to act this way.
Comparing scalability of message queue system: ZeroMQ vs. RabbitMQ
The beach near us over the last 20 years or so has gone from having a bit of plastic and wood washed up, to having more plastic than seaweed. It's amazing how much of it is rope and net. There is so much broken tiny bits of rope that it almost looks like a light dusting of snow some days. It's crazy.

Last week there were a whole bunch of milk bottles washed up and the crows were pecking holes in them and drinking the milk.

We also get plastic pallets washing up, they are about 1.5m sq.

But so many nets and rope.
I agree. Obviously 'god functions' and 'god classes' are bad, but splitting up tightly coupled, related logic into piles of <10 line functions seems ludicrous. Not only does it hurt readability (and debugging) like you mentioned, but it also promotes false sharing of functionality. By splitting things up into very small functions many things may start to appear reusable. The moment it turns out one or two instances of the code that calls all these small functions need to have subtly different behavior you'll be hunting down each and every piece of code that calls the function, to be sure that changing it won't break completely unrelated parts of the code.
Cyclone (programming language)
Related discussion by John Carmack:

http://number-none.com/blow/john_carmack_on_inlined_code.htm...

https://news.ycombinator.com/item?id=8374345

Cached:

http://webcache.googleusercontent.com/search?q=cache:LQgMUMT...
http://www.theoceancleanup.com/technology.html gives more information.
Another article in this line is "The Unbearable Accuracy of Stereotypes".

http://www.rci.rutgers.edu/~jussim/unbearable%20accuracy%20o...

Basically social scientists like to treat the usage of ethnic and gender stereotypes as evidence of stupidity and bad decisionmaking, but they never bothered to check whether stereotypes were actually incorrect.
What the world will be like in 2014 – By Isaac Asimov
My problem with putting the validation in an own function is that this should only be done if the validation itself is generic like "check checksum" but not if it relates to the actual logic like "A must be smaller than B".

At first I wouldn't expect a function "validatedItemNamed" to check the price. While it checks the price it doesn't check the inventory number.
On a smaller scale this Indigogo campaign, the SeaBin project, is trying to do something similar:

https://www.indiegogo.com/projects/cleaning-the-oceans-one-m...

http://www.seabinproject.com/
I can't speak for other people, but I guess being a person and considering switching from Clojure because the development workflow has a long feedback cycle that the answer to your question is a yes?

I have Ring reloading code for me as it changes, however if there is a syntax error or exception in a thread, code doesn't get reloaded and strangeness ensues, requiring me to kill the jvm instance and start it up again. Stuart Sierra talks about this problem in his reloaded workflow, and how it's still a problem for him, but he at least now has a faster way of refreshing his app instances.
Likewise, agreed. Very weird to see this article score high on HN.
Advanced SystemCare Free Download
Singularity was later extended by the joint MS-MSR project Midori, which sadly was discontinued last year. Apparently some features are being incorporated into C#.

Joe Duffy is blogging about his experience: http://joeduffyblog.com/2015/11/03/blogging-about-midori/
There's some tangentially relevant ideas in a book called "The Spell of the Sensuous," and also in various works by McLuhan. I think the basic idea is attributed to Eric Havelock. This essay seems to be relevant though I just started skimming it:

http://journal.oraltradition.org/files/articles/1i/6_haveloc...

But basically the idea is that alphabetic literacy creates a whole new style of abstraction and detachment. Before the alphabet there were pictorial glyphs which are still not very abstract, but after the alphabetic revolution in Greece, Havelock traces a new style of philosophy and thinking in general, starting around the time of Plato.

Maybe you could compare it to something like the development of algebraic geometry, which allows you to say all kinds of new things in an abstract way, because you move to a level of abstraction that's not limited to what you can represent diagrammatically.

Oh, it's called the "alphabet effect": https://en.wikipedia.org/wiki/Alphabet_effect

It's at least something to consider when thinking about an alternate history where we didn't use written words. We would probably still have "external memory," but maybe in a more symbolic/pictorial/diagrammatic/geometric way. Perhaps we would even have symbolic algebra and math, taught by oral instruction... It is pretty hard to imagine!

Abram who wrote "The Spell of the Sensuous" has a different argument than Plato. He also critiques writing and the alphabet, not because it ruins memory but because it allows us to retreat from our sensuous embedding in nature, which ultimately helps create a modern world in which we mostly live in a kind of isolation where we are always surrounded by things of human making.

> Today we participate almost exclusively with other humans and with our own human-made technologies. It is a precarious situation, given our age-old reciprocity with the many-voiced landscape. We still need that which is other than ourselves and our own creations. The simple premise of this book is that we are human only in contact, and conviviality, with what is not human.

To try to steer back towards the original conversation... I'm thinking of things like alarm clocks, which are also technological assistants for doing stuff that we used to do ourselves. They also help maintain a kind of abstraction from our surroundings and "natural" premises: they make us independent of sunrise, circadian rhythms, and so on. And maybe they erode a capacity for waking up at the appropriate time without help. Personally I do avoid using them unless I risk missing a flight or something. If I need to wake up early, I prefer to go to bed early enough to give me a reasonable margin. If I tended to oversleep by hours, I'd consider that a symptom of sleep deprivation or something.
This only collects the visible pollution. I don't have any numbers, but I can imagine that the invisible pollution is much worse. This is a noble project, but I hope it will not end up just washing away our guilt.
I love the fact that you don't need to add another app to your startup stack.
Maybe we could call it RSS?
I don't think it's so much an anti-feature as something that's just not used in the dominate ecosystems so today it is superfluous complexity. Not in IBM 360, not used as such by MS-DOS for the 8088 and Windows, which were originally designed for the 8088 and the 286, since their segments were too small, not for UNIX(TM) and its derivatives including NeXTSTEP -> OS X and other originally 680x0 based operating systems, not for anything ARM based.
I/O Content – An API Centric SaaS CMS
I/O Content is an API centric Content Management System (CMS) designed for use with any platform or device type. I/O Content makes managing and retrieving content and media simple, featuring custom content types, API queryable content fields, CDN and on the fly image manipulation.

Take a look at https://www.iocontent.com for more information.
Challenges of Digital OilField Technologies
How do I get this to work on a shared webserver? I don't have root and need a cert I can upload on their backend system, so more than 90 days would be a requirement.
Yes. Seen and written. Maybe it's easier with a small team, and it's certainly easier with a good language (Scala in my case) but it's absolutely possible.
Works fine on my nvidia 620m
Visual interface for amazon store
As someone who used to practice law, I find it frustrating that there was no apparent objection to the questioning.

Really while it may be "simple arithmetic" often expert witnesses are caught up in trying to explain a lot of technical material, and when it comes down to something simple they are unable to do it without prior preparation.

Ideally, the only true way that you could discredit an expert like this is to ask them to explain the process by which they would convert the scale. If they can't do that, in all likelihood they're stuffed. The witness in this case should have simply asked for a calculator, or the lawyer who introduced him should have claimed that he was not an expert in mental arithmetic, but in complex computer assisted mathematical analysis.
A great example of how you can write spaghetti code without using goto: Just split a simple function into a dozen functions with generic names like "validate", and you've made sure no-one ever will comprehend your code.
Why don't GPUs have some hardware in them to make rendering text simpler? It seems like a pretty common function that every game has. Have you ever seen a game without any text in it?
The seabin is just a pump and filter. Sure, it's great that some one is cleaning the ocean, but it's not exactly a revolutionary idea.
It doesn't make a difference for your results, but it's

E = 0.5 mv^2
One of my favorite RPG games is Space Station 13; in that part of the game is to ACTUALLY role play your job, instead of just being a wizard and having certain abilities and thats as far as you go. That's one of the best things about getting together with a bunch of friends in a D&D match; coming up with entertaining quests. But it's rare to find a game that actually encourages the role playing aspect, and a large part of SS13 is the stuff that other players / admins will do to spice up the gameplay for others.

For the unfamiliar, here's an example of some of the gameplay of a janitor: https://www.youtube.com/watch?v=KpBxqZYgem8
Pgbouncer-rr: Adds query routing and rewriting extensions to pgbouncer
Currently we are doing nothing to clean the oceans. Floating plastic is very very bad, it get churned up against rocks and cliffs to become tiny bits that end up in the food chain.

Go to any beach and look along the shoreline to see tonnes of broken plastic.

There was a TV programme they showed last month where a scientist said that they had not found a single fish that didn't have plastic in its gut. They had examined thousands.
Show HN: Particle-based Cloth-Simulation (with pictures)
Maybe people just don't handle errors? Most of my functions are less than 10 lines, but then you add the error handling code, and it becomes 30 lines.

Also, it strongly depends on the code you are writing. Things like reading/writing data often end up as pretty long functions, while glue code between model and view is usually just a couple of lines.
This is just nuts. If you disregard the curly braces each of these guards are just two lines of code. When you place them into a function definition they each become 3 lines of code. Just so you can replace them with single lines in the original code.

That isn't software engineering. That is religious fanaticism.

E.g.

guard item.count > 0 else {
throw VendingMachineError.OutOfStock
}

Is a very low complexity statement. One comparison is made and an enum value is thrown. You are gaining no clarity by placing this inside a separate function.
My general rule of thumb is that a function should be small enough to be entirely visible on screen without having to scroll. It's dependent on screen resolution & font size of course, but I find that having to scroll down adds some cognitive overhead to understanding the whole of a function.

Following this line of thought I've become a lot more precious about vertical whitespace & I've adopted BSD style curly braces.
Not to speak of the fact that if you take out the cash, the p/e is 8.something.
Hey,

I wanted to share some cloth-simulation I implemented some months ago :)

It is pretty straight forward Euler-integration with some simple collision handled for each particle within the cloth (consisting of connected, textured particles).

I would love to get any kind of feedback.

Otherwise - happy new year and happy hacking :)

Best regards - Maurice
I've been thinking about teaching myself low level development and FlingOS is just what I've been looking for. If these resources work out well, I'd be willing to pay you for them :)
It's 2016. Cameras are a thing. Why are blindspots still legal?
Fixed-function hardware on GPUs is really on the way out.
My impression is that it is somewhat influence by the programming language. Code I've written have often needed so many variables to do its job that it is very hard to split out small functions. But when you can use closures and higher order function easily, I find it easier to keep the size of functions down.

But I prefer Linux take on function size:

> The maximum length of a function is inversely proportional to the
complexity and indentation level of that function. So, if you have a
conceptually simple function that is just one long (but simple)
case-statement, where you have to do lots of small things for a lot of
different cases, it's OK to have a longer function.
> Has anyone seen production code with <=10 lines of code per function before?

I have seen code where a function was shorter than 10 lines. ;-) In that same code base, I have seen a function that was ~750 lines. And for that particular function, it actually made sense. It involved a lot of local state, and breaking it up would have involved passing lots of parameters to the new, shorter functions. (The average function in that code base was around 50-60 lines, I guess.)

Using a fixed number, like "10 lines" seems arbitrary to me. Sometimes it makes sense, sometimes it does not. It also ignores other factors, such as comments. Or readability. Sometimes, I 100+-line function can be marvelously clear, other times, a 5-liner can be so dense it makes my eyes bleed.

I have grown wary of "Always do this"/"Never do that"-advice.

"Try to keep your functions short. If they grow long, look if it makes sense to break them up into multiple shorter functions" is sound advice. But to do so without questioning or thinking is problematic.