Академический Документы
Профессиональный Документы
Культура Документы
: programming
http://www.reddit.com/r/programming/comments...
MY SUBREDDITS
FRONT - ALL - RANDOM | PICS - FUNNY - POLITICS - GAMING - ASKREDDIT - WORLDNEWS - VIDEOS - IAMA - TODAYILEARNED MORE
PROGRAMMING
comments
related
1076
search reddit
this post was submitted on 18 Nov 2010
show 500
I like to call it the software clover EDIT: Wow, way more interest than I'd anticipated. Several people have suggested cafepress t-shirts, so I'm going to look into it. Stay tuned.... and thanks for all the compliments! WHOA DOUBLE EDIT!: It should be rotated 90 degrees clockwise. (like a clover!) I have no idea why imgur did that.
permalink [] ggggbabybabybaby 47 points 2 years ago
username
remember me
password
reset password
login
programming
subscribe
430,810 readers
really? Thanks! It just popped into my head and jotted it onto a piece of scrap paper I had nearby
permalink parent [] sophacles 12 points 2 years ago
I second the notion. I'm getting a tattoo sunday, I may add this to it :)
permalink parent [] Scalawag 5 points 2 years ago*
I've always wanted to get this as a tattoo (ignoring the parentheses). edit: parenthetic material, not parentheses.
permalink parent [] keeperofkeys 2 points 2 years ago
Hmm it doesn't seem very profound - if you add up all the little omegas you get a big omega. Surely anyone could have told you that?
permalink parent [] AndNowMrSerling 11 points 2
1 of 25
03/27/2013 09:47 PM
http://www.reddit.com/r/programming/comments...
Check out our faq. It could use some updating. If you're an all-star hacker (or even just beginning), why not join the discussion at /r/redditdev and steal our reddit code! Related reddits /r/technology /r/learnprogramming /r/coding /r/compsci /r/netsec /r/webdev /r/web_design /r/gamedev /r/cscareerquestions /r/reverseengineering /r/startups /r/techsupport Specific languages
created by spez a community for 7 years
message the moderators
No, it's actually saying something a lot cooler than that. It's more understandable if you look at the vector field version which says that integrating the curl of a vector field over a surface is equivalent to integrating the vector field on the boundary. There's also the divergence version that says that the total divergence in a volume is equal to the flux at the boundary. Anyway, it basically covers all Calculus and is very important for electromagnetism calculations. I'm not a fan of tattoos, but I think this is a worthy choice.
permalink parent load more comments (1 reply) [] Scalawag 2 points 2 years ago
MODERATORS ketralnis spez Poromenos tryx dons masta kylev chromakode a_redditor
...and 1 more
What is it?
permalink parent [] Scalawag 2 points 2 years ago
My first thought was definitely of a tattoo when I saw this image. I'm reeeeeally tempted now...
permalink parent [] judgej2 5 points 2 years ago
Well, get that paper safely stored away in a safe now, oh great one, as it will be priceless one day, just like L. Ron Hubbard's original sketches of a volcano.
permalink parent [] Kimano 5 points 2 years ago
That is actually a really fucking boss symbol. If I were ever to get a tattoo or something I might consider that.
2 of 25
03/27/2013 09:47 PM
http://www.reddit.com/r/programming/comments...
load more comments (1 reply) load more comments (1 reply) [] rikAtee 69 points 2 years ago
as you ahve made the logo for your super secret organisation, can I join your super secret organisation?
permalink parent [] redgamut 201 points 2 years ago
No, because then there would be two in the organization. And if he let you in, then he would have to allow an infinite number of members to join which would defeat the "super secret" declaration of his organization.
permalink parent [] Ubeta 49 points 2 years ago
okay. you find out his mailing address. i'll go get some plastic bags, rope, two shovels, and lime.
permalink parent [] bobindashadows 24 points 2 years ago
I'm not a doctor, but call me in the morning and let me know how that goes.
permalink parent [] rikAtee 17 points 2 years ago
you put the lime in the cocanut and called the doctor woke him up DOCTAH!
permalink parent [] [deleted] 9 points 2 years ago
3 of 25
03/27/2013 09:47 PM
http://www.reddit.com/r/programming/comments...
No, it would just mean he can't place a cap on membership - he can still have all sorts of bizarre requirements to join, or even just make that decision arbitrarily.
permalink parent [] SilasTalbot 2 points 2 years ago
No Homers Club
permalink parent [] FunnyMan3595 11 points 2 years ago
No, the restriction is on the limits imposed by the underlying system, not the actual number. That an organization may contain an infinite number of members does not imply that it must contain an infinite number of members. Being able to store any number of files in a directory doesn't mean you can't store 2, 4, 8, or 2,506,342 files if you choose. Precisely the opposite, in fact. If you were forced to store an infinite number, you would never be able to store any!
permalink parent [] judgej2 14 points 2 years ago
Nice try. The 0/1/ figure refers to limits, so two people are most certainly allowed under the limit of "infinity". Three would be a crowd though.
permalink parent [] redgamut 4 points 2 years ago*
You're forgetting the given condition, "super secret," which eliminates infinity as a possible limit. Edit: Exactly! Limits. So if you allow a limit of infinity, you have to assume and account for the largest possible number. And since this is under r/programming, if you permit infinity as the limit and assume that an arbitrary limit will never be met (eg. "Oh, we can't call the organization super secret after 1.3 million members, but we'll probably never get that many"), then you've failed at error handling and broke the 0/1/infinity rule. You set a higher limit than should have been set.
permalink parent [] OmicronNine 3 points 2 years ago
In order for the "super secret" condition to be satisfied, I would suggest that really one would need only one individual to not be in on the secret. As long as at least one person is utterly clueless, it is still "super secret" from them. This would mean that the actual limit is infinity-1 which is equal to infinity (infinity is funny like that), and therefore all conditions are satisfied.
permalink parent [] redgamut 2 points 2 years ago
Given your correct on the definition of a super secret organization (that it only takes one person to be in the dark), your logic still fails when every person in existence is a member. Saying, "that will probably never happen" is good judgment, but not good programming. Your guessing that in imposed limit will never be reached. int numMembers;
4 of 25
03/27/2013 09:47 PM
http://www.reddit.com/r/programming/comments...
int numPeopleInExistence; for (x = 0; x < count(numPeopleInExistence); x++ ) { if (numMembers < count(numPeopleInExistence)) { //organization is super secret (not really) } else { //numPeopleInExistence == numMembers //You find this unlikely, but it is possible } } You're missing this else clause and your error handling (err... logic) has failed.
permalink parent [] esotericguy 4 points 2 years ago
Your int num PeopleInExistence; can't handle how many people are currently alive. max int = 2,147,483,647 is less than 6,882,390,298.
permalink parent [] netcrusher88 2 points 2 years ago
ulonglong then
permalink parent load more comments (14 replies) [] spaghettifier 2 points 2 years ago
any directory has natural limits to its size based on the hard drive, the zero, one, infinity rule is about artificial limits. Having a requirement to enter can make it super secret without hard-coding a cap in.
permalink parent [] [deleted] 2 points 2 years ago
You can say that the organization must not include more than 1% of the current population. Current population is an input variable, just like the number of files that user wants to put on the HDD. So your codex doesn't impose any finite bound on the number of members.
permalink parent load more comments (6 replies) [] helm 5 points 2 years ago
You can always construct arbitrarily strict rules for membership that doesn't limit it to a finite number. Problem solved.
permalink parent [] KaptenKrause 2 points 2 years ago
5 of 25
03/27/2013 09:47 PM
http://www.reddit.com/r/programming/comments...
Also chiming in for T-shirts, but note that Cafepress is kind of a ripoff and if you expect to sell more than a dozen you'll make a hell of a lot money through a different technique. Also have you considered rotating it so it's vertical? I think it might look better that way :D
permalink parent [] the8thbit 3 points 2 years ago
I support the vertical move, that way all of the numbers can be read correctly.
permalink parent [] sophacles 6 points 2 years ago
This is the first time I've ever seen a tattoo that I might get.
permalink parent [] cybercobra 4 points 2 years ago
Anyone has some of those movie-style image enhancers? I DEMAND to know what that faint-looking text in the background says!!! :-P Nice logo, BTW.
permalink parent [] CipherSeed 6 points 2 years ago*
I was curious how far my photoshop experience could take me. I determined it is most likely handwriting though it appears serifed. The lines of text do not seem completely straight. I could read one word from all the faint letters. The word context is underneath the infinity symbol (with the one "flag" pointed in the opposite direction). I can make out many of the letters but I cannot form the words. They seem slightly "german." This is now a competition.
permalink parent [] jetpacktuxedo 7 points 2 years ago
This is all I can get. http://imgur.com/Azj4L The only word I can read is "context" below the infinity. "carefully" appears to be immediately above the infinity, but I counld be wrong. Also, it is DEFINITELY not handwritten. The two ts in context are too identical. The lines don't look straight probably because the picture was taken at an angle. I will agree that it is Germanic, and I think the font used is pretty ornate.
permalink parent [] Gonzopolis 2 points 2 years ago
6 of 25
03/27/2013 09:47 PM
http://www.reddit.com/r/programming/comments...
I think it is now fair to say that it is NOT German. Ideologic, carefully, and context. Anyone have any other ideas?
permalink parent load more comments (1 reply) [] oaksterdam420 6 points 2 years ago
The software clover looks like zero, one or eight. I suggest you rotate it 90 to the right.
permalink parent [] sophacles 3 points 2 years ago
It looks like 0, 8 or tipped over flag. You can't decide to read the one sideways but the infinity not sideways.
permalink parent [] Cyphierre 4 points 2 years ago
As it is, all three are tipped to the left. So tip the whole thing to the right and it's good: 0 1
permalink parent load more comments (1 reply) [] Zambini 2 points 2 years ago
keep me informed :)
permalink parent load more comments (13 replies) [] mcdonc 40 points 2 years ago
"-and I think I even saw a two!" "Don't worry Bender, there's no such thing as two."
permalink [] manole100 107 points 2 years ago
Fry: So, there's an infinite number of parallel universes? Professor: No, just the two.
permalink parent [] Ziggamorph 19 points 2 years ago
7 of 25
03/27/2013 09:47 PM
http://www.reddit.com/r/programming/comments...
At the time, there was only two. It was only after that they started making more boxes.
permalink parent [] jim258kelly 7 points 2 years ago
But the possibility for more had always existed, hence infinity applies.
permalink parent [] Ziggamorph 5 points 2 years ago
No, the line: Fry: So, there's an infinite number of parallel universes? Professor: No, just the two. comes from I Dated a Robot, when Fry wanted to do things from the future. They visit the edge of the universe, and from there you can see the parallel cowboy universe. It was in The Farnsworth Parabox that the professor proved himself wrong. To say that he created the other universes is a bit of a stretch, given that the professor in Universe 1 believed he created Universe A.
permalink parent [] unbibium 27 points 2 years ago
That has absolutely no relevance to this other than both are related to computers, but still a fun one to hear! :)
permalink parent [] New_Insanity 5 points 2 years ago
Glad to hear :)
permalink parent [] vanhellion 28 points 2 years ago
Hmm. Upvote zero times, once, or infinitely? I've been at this since 1982 and I can't believe I've never run across this terminology. In practice it comes up all the time, of course, but to see it put so succinctly, well ... I just love learning and hearing about stuff like this :) Thanks OP.
permalink [] hacksoncode 12 points 2 years ago
"Infinite" doesn't mean "infinite", it means "without an arbitrary and/or unchangeable bound". The number of upvotes isn't limited arbitrarily, it's limited by a hardware constraint (if at all... I suspect that actually you could change the database field to a bigint or numeric without changing the code very much).
permalink parent
8 of 25
03/27/2013 09:47 PM
http://www.reddit.com/r/programming/comments...
The example in the article is pretty bad as that limit was probably imposed by hardware.
permalink parent [] YourAnMoran 2 points 2 years ago*
No it isn't. Take FAT for example. The point is that the designer of the file system is not supposed to set arbitrary limits because it's hardware's own damn business to set the limits. When that limit is reached, creating any entities in the file system fails, but it's not a limit what the FS is imposing, it's the HW instead.
permalink parent [] Thud 2 points 2 years ago
OK, so I tried implementing a database connection pool using this new philosophy. Here are my results so far: 0 connections --> Unable to query the database 1 connection --> Worked, but was slow when multiple users were accessing the system Infinite connections --> My app is still initializing, I'll get back to you...
permalink parent [] hacksoncode 2 points 2 years ago
That's why you make it dynamic (and not fixed to some particular number). Or at least you code it in such a way that you can configure the number easily if circumstances require. What you don't do is create your pool by cutting and pasting 10 copies of a chunk of code and spreading them throughout your initialization function.
permalink parent [] mitc0185 8 points 2 years ago
Zero One Infinity is also the name of a classic album by the band Barcelona. Studio Hair Gel is a great song.
permalink [] [deleted] 11 points 2 years ago
In Popular Culture
permalink parent [] [deleted] 4 points 2 years ago
that's the second time today I've heard that ....wait a minute..
permalink [] buckX 10 points 2 years ago
It's also a good set of choices if you're BSing calculus problems, though negative 1 makes its way in pretty often.
permalink [] rainabee 8 points 2 years ago
9 of 25
03/27/2013 09:47 PM
http://www.reddit.com/r/programming/comments...
Close enough.
permalink parent [] RedSpikeyThing 10 points 2 years ago
Creating arbitrary upper bounds is bad practice, but there are cases where it's kind of inconvenient to have infinite objects in one place. Think of AWS' structured directory system, where there are never more than 1000 files in any folder.
permalink [] larholm 7 points 2 years ago
Nothing forces you to actually have infinite objects in one place. Your code should just be written to handle 10 objects the same way it handles 1,000 or 100,000 objects. That is, there is no arbitrary upper limit, just a generalized approach. The actual upper limit naturally depends on your storage.
permalink parent [] Kowzorz 2 points 2 years ago
The only thing I can think of that would justify an arbitrary upper limit would be how the data is stored (ie, if you're compressing it to several bits to represent an index instead of larger bits of data) since you can only store x many anyway.
permalink parent [] dnew 9 points 2 years ago
You mean, like how the data is stored in a two-byte number, leading to a limit of 65,000 or so files per directory? That kind of limit?
permalink parent [] Kowzorz 6 points 2 years ago
Yes.
permalink parent [] frezik 4 points 2 years ago
There are security reasons to put in arbitrary limits, too. For instance, you can configure web servers to put a limit on the size of an uploaded file so that you can't upload a huge file and take up all the hard drive space. Though in this case, it's usually a configurable option rather than hard coded in the software. Then there are encryption block ciphers that specify that they only work with a standard size of data at a time, usually 32 bits. This makes it easier to mathematically prove the algorithm's security. If your data doesn't meet at a 32-bit boundary, you have to pad it.
permalink parent [] washort 51 points 2 years ago
10 of 25
03/27/2013 09:47 PM
http://www.reddit.com/r/programming/comments...
No Child Left Behind. One Child Left Behind. All Children Left Behind.
permalink parent [] [deleted] 5 points 2 years ago
I smirked at the picture in my head of Congress picking one child to be left behind, so the others can be competent.
permalink parent load more comments (2 replies) [] [deleted] 17 points 2 years ago
Are the left child and right child usually implemented differently?
permalink parent [] mahlzeit 36 points 2 years ago
Yes. Otherwise it wouldn't be a binary tree, it'd just be a tree limited to two child nodes per node.
permalink parent [] covidiu 34 points 2 years ago
Actually, a binary tree IS just a tree limited to two child nodes per node. You're probably thinking of a binary search tree.
permalink parent [] Serei 36 points 2 years ago
No, a binary search tree is a binary tree with a condition that the left node is always less than the right node (or greater than, if you swing that way). Binary trees still define the left node and the right node, they just don't necessarily have any conditions about their relationship.
permalink parent [] J3ff0 17 points 2 years ago
Yes, the left and right nodes are defined, but no, they aren't implemented differently.
permalink parent [] [deleted] 7 points 2 years ago
The point is that with a binary tree you can distinguish between a node having only left child and a node having only right child.
permalink parent [] [deleted] 6 points 2 years ago
You can even go into different forms of B trees that have more than 2 children. I don't think this violates the Zero/One/Infinity rule. A tree can contain zero nodes (null tree), one node (only root), or any additional number of children nodes (over multiple levels). So long as there is no restriction on the depth of the tree, you can have an infinite number of child nodes.
permalink parent load more comments (1 reply) load more comments (1 reply) [] AisoRed 3 points 2 years ago
11 of 25
03/27/2013 09:47 PM
http://www.reddit.com/r/programming/comments...
The aren't implemented differently, but they behave differently (during traversal).
permalink parent [] dsfox 4 points 2 years ago
They don't behave, they are treated differently - one is treated as the first, one as the second.
permalink parent [] dsfox 4 points 2 years ago
My proof - if you replaced every reference to the first branch in the code with a reference to the second, and replaced every reference to the second branch with a reference to the first, you would never notice a difference in operation.
permalink parent load more comments (2 replies) load more comments (1 reply) load more comments (8 replies) [] [deleted] 10 points 2 years ago
Just a special case of an N-ary tree. You two-partisans and your obsessive love of 'two'.
permalink parent [] bonzinip 13 points 2 years ago
is isomorphic to
struct Node { Node * first_child; Node * next_sibling; void * data; }; permalink parent
Ok, an argument could be made here. But don't you think it's just a tiny bit ironic to use as your counterexample to ZOI a data structure that is intentionally and specifically designed around the principles of zero (empty), one (head), or an unlimited number of entries (the recursive elements, each of which represents 0 (null), 1 (leaf), or many (tree) elements in the same structure as the parent tree)? There's nothing inherent in tree structures that is limited to 2, either... that's just the minimum number of leaves per node that is capable of resulting in log n performance, which is why it is a common fan out. Trees in general can have arbitrary numbers of children per node.
12 of 25
03/27/2013 09:47 PM
http://www.reddit.com/r/programming/comments...
OK, now everyone is arguing whether a binary tree fits the rule our not, but the correct answer is that it's apples and oranges. This rule is specifically for entities that are directly exposed to the user, it doesn't have anything to do with implementation details. It is, as the article says, a rule in software design, not software implementation. Almost every bit of memory in the computer is divided up in one way or another into fixed sized chunks. File systems store files in small chunks, memory is divided up into pages and cached in different sized lines, b-trees are common, networks split large transfers into packets. Programmers deal with limits all the time, and that's the way it should be - anything else would be too far up the abstraction layer. What the rule says is that when the user sits down and wants to transfer x mb over the internet or store y many files on a disk, the only limit is the speed of the transfer or the size of the disk. This is as it should be.
permalink parent [] [deleted] 14 points 2 years ago
With binary trees you usually make a difference between 'right' child and 'left' child. So every node has at most one right child, and at most one left child. Thus the rule holds.
permalink parent [] StackedCrooked 7 points 2 years ago
defines a binary tree, and is different to a tree which simply happens to have a maximum of two children at each node.
permalink parent [] hacksoncode 3 points 2 years ago
True, and if you actually implemented a tree using that data structure and explicitly hard-coded children[0] and children[1] in your traversal functions rather than simply iterating over the array, you'd be violating the rule and there's a pretty strong argument that this would be a poor coding style. If you're going to do it explicitly, and for a good and persistent reason, then you'd name them "left" and "right", and again you'd be back to having only 0 or 1 of each of these
13 of 25
03/27/2013 09:47 PM
http://www.reddit.com/r/programming/comments...
It's worth considering that the code for the array version is more concise and conceptually simpler from an object oriented perspective (in my opinion, anyway)... consider pseudocode for a tree traversal function that does nothing else:
Traverse(head) foreach(i in head.children) Traverse(i);
The latter formulation requires an explicit termination condition, because there's no list of children that can itself contain the notion of "emptyness"... it therefore has to be a characteristic of the object itself.
permalink parent [] walter_heisenberg 4 points 2 years ago
Having a .left and .right field is more readable than having a 2-long array and accessing [0] and [1]. In my experience, the only time I find myself comfortable with fixed-size arrays is in a limited context where the functionality never needs to be extended. For example, a Bridge hand can be represented with a 13-long array of card options because you know that it will never need more than 13.
permalink parent [] TheMG 2 points 2 years ago
I wasn't saying its better, I was just giving an example of an implementation of a binary tree with a "two" in it.
permalink parent load more comments (2 replies) [] unbibium 2 points 2 years ago
Perhaps, but I'm wonky enough about theory that I wonder if I could design a scalable Bridge that works with variable suits and ranks. I never finished a Python Rubik's Cube utility I started on, because I wanted to design it to work not only on different-sized cubes, but on Megaminxes (12-sided puzzles). I don't have a math degree, so naturally I got stuck quickly. Likewise, I wondered if it could be possible to design a 2d game such that you can make it into a 3d game by changing one value from "2" to "3".
permalink parent [] walter_heisenberg 3 points 2 years ago
I would argue that user interfaces are an obvious counterexample to the 0-1-many rule. A Google search, for example, returns the top 10 results by default, not all of them. Games are a subcategory of this. People are used to playing bridge with a standard 13x4 deck, and changing the size of the deck would change the game considerably. (You'd have to rewrite the game, and this takes hundreds of person-hours of play testing, for the new parameters.) If MySQL had a constraint that a result set had to be less than 1024 (or 65536, or 37) records, though, people would be really pissed off and would not use it.
permalink parent
14 of 25
03/27/2013 09:47 PM
http://www.reddit.com/r/programming/comments...
The underlying types shouldn't be constrained, though. Google is likely designed so that the base type that eventually defines how many results show up is agnostic to the number of results -- it doesn't care. It could be infinity. Then, the number of results is defined later in a specific implementation or a specific setting, possibly set by the user at runtime, meaning that it still has an upper bound of infinity. For instance, you want to make a "scrollbar" UI control able to be infinitely long, and then set its length in its implementation, or even better, at runtime. I also disagree when it comes to games. If I were designing a card game, the root type of the card deck would be a "Deck" class that didn't know or care which kinds or cards or even how many cards it had. It just knows it contains cards. It knows how to select a card. It knows how to shuffle its cards. The cards, being of a base "Card" class and a specific "PokerCard" class, would know what kind of card they are. The deck would be configured at implementation to contain 52 Card instances of the specific type, PokerCard, and each card would be configured to know its own suit and value. This could then be extended to any kind of card deck from Tarot to ESP flash cards. The "0, 1, Infinity" rule isn't talking about the instances. Its talking about the type definition. It's cool to have a "poker deck" implementation of the Deck type that takes a deck size in its constructor and is implemented as a 52 card deck. That's fine. The important part is that you can make an implementation of "Deck" that is any size.
permalink load more comments (6 replies) load more comments (3 replies) load more comments (12 replies) load more comments (4 replies) [] tscharf 20 points 2 years ago parent
You're wrong, two can be as bad as one. It's the lonliest number since the number one.
permalink parent [] tscharf 9 points 2 years ago
systems of linear equations have exactly one of those three kinds of solutions.
permalink [] [deleted] 10 points 2 years ago
15 of 25
03/27/2013 09:47 PM
http://www.reddit.com/r/programming/comments...
I fight clients over this concept constantly. When they ask for a requirement that needs some kind of collection as opposed to a single entity all sorts of technical needs must be covered as in software development this rule is very true. If I have to get into the weeds with a client over it (rare but it happens) they often assert "well we only need two of these instead of one isn't that easier". No because software development dictates this rule therefore your collection of two needs to be treated as if it could be a collection of indeterminate size. Nine times out of ten at some point later in the project that collection of only two will end up being a collection of much more simply because the client is short sighted.
permalink [] bluGill 4 points 2 years ago
The biggest issue, is the code to deal with one case is simple. The code to add a second case is almost as complex as the code for infinite case. If you have 2 cases now, but I could give you infinite cases for just 1 dollar more, wouldn't you go for infinite just in case you need it?
permalink parent [] Manitcor 3 points 2 years ago
It tends to be worse than that in many languages IMO. Pretty much every development platform works on the null, 1, infinity concept. All collections are infinite by design in nearly every case. To create and enforce a 2 item collection you are actually writing more code than you would to deal with the collection as a possible infinite set.
permalink parent load more comments (1 reply) [] BraveSirRobin 40 points 2 years ago
Surely written by an idealistic graduate, real life has limits. The code to manage a list of 10 items is vastly different from that to manage a list designed for 100,000 items. The latter will need lookup maps etc if you are to pull out items at a performant rate. Adding the same things to the list of 10 will actually slow it down in most situations and be a complete waste of your development time, needlessly over-complicating the code base, providing an ongoing maintenance cost and additional risk vectors.
permalink [] soberirishman 14 points 2 years ago
I would argue that you should implement it in a structure that could hold 100,000 items, but with the logic optimized for 10. The performance will decrease as your data set gets larger but it will still function. This allows for some level of variability without needing a change while still making implementation easy. If the data set grows to a huge size you can always go back and optimize.
permalink parent [] BraveSirRobin 4 points 2 years ago
as your data set gets larger Some datasets inherently don't grow larger or have arbitrary upper limits. A list of human sexes will never grow above 10 for example.
permalink parent [] soberirishman 12 points 2 years ago
Until you add hermaphrodites or transgender. Then what if we encounter aliens some day with their own sexual classifications? Yes, you're probably safe setting the limit to two, but those kind of assumptions and potential
16 of 25
03/27/2013 09:47 PM
http://www.reddit.com/r/programming/comments...
oversights lead to massive software rewrites at times (I'm looking at you Y2K). I wonder how many systems would need to be rewritten if the U.S. ever adds a 51st state? I'm just saying, in most cases there is a way of doing it just as easily without setting a limit, so why not use that instead?
permalink parent [] BraveSirRobin 12 points 2 years ago
Until you add hermaphrodites or transgender. That's why I said "10". I wasn't using binary. :-p I'm looking at you Y2K I've seen both sides of that coin, hell I'm guilty of both. Over-engineering things is just as bad not doing enough. Had the cobol devs used 4-digit numbers they would not have been able to do as much with the limited memory they had. People forget that this was a legitimate design compromise at the time. No one expected the same code to be running 40 years later. I wonder how many systems would need to be rewritten if the U.S. ever adds a 51st state? Most likely it would be Puerto Rico, being a non-contiguous state it will be a nightmare for online sales portals!
permalink parent [] soberirishman 2 points 2 years ago
I think you understand the concept perfectly fine. I just know there are people that will read this and write it off as stupid and continue on making the same mistakes and eventually somebody will have to go behind them and clean up the mess because they lacked foresight. If it's a necessary compromise for performance, then that's fine. But one should always hesitate long and hard before doing so...
permalink parent load more comments (1 reply) [] dnew 6 points 2 years ago
I'm looking at you Y2K Yeah, just wait until 2038. I'm already running into 2038 bugs.
permalink parent load more comments (3 replies) [] rhedrum 2 points 2 years ago
There is a difference between optimizing for a specific range of items and having an arbitrary hard limit.
permalink parent [] Gimli_The_Dwarf 66 points 2 years ago
How long have you been a software developer? I'm guessing around 3-4 years? Because if you'd been doing this long enough, you would have been burned often enough by asshole users who insist that "No, I'm positive there are only three possible options for that field. No way could there ever be four - it's all based on a fifty year old system that has the options hard-coded with tubes"
17 of 25
03/27/2013 09:47 PM
http://www.reddit.com/r/programming/comments...
only to come to you the day after release and say "oh, wait - I need a fourth option." Get hit with that a few too many times and you realize that the fucking rule is about fucking arbitrary limits in the handfuls or dozens, and it isn't talking about rules made necessary by natural restrictions of the hardware or software and you wouldn't be making your stupid pedantic whiny ass complaints about "but you can never offer infinite options because the server only has a terabyte of hard drive space" Yes, BraveSirRobin - we know there are structural limits on memory and frameworks and hard drive space. "Infinite" doesn't really mean "infinite" - it means "more than three, or eight, or twenty." <FanService> Now get out of my face before I get my axe. </FanService>
permalink parent [] [deleted] 33 points 2 years ago
In other words, this rule applies to functional requirements of software. Nonfunctional requirements, like performance constraints, introduce additional complexities not addressed here.
permalink parent [] vtmeta 23 points 2 years ago
I like how you turned a complete flame novel into a clear and concise two sentences. I enjoyed this version much more.
permalink parent load more comments (5 replies) [] BraveSirRobin 5 points 2 years ago
Oh, I've been in that situation. I had to completely redo the in-memory data model of an inherited application to cope with the largest datasets the customer had. Took a 20-minute load time down to about 10 seconds (ya srsly) simply with the use of lookup tables. Problem was that it was walking the object lists for every insert, classic exponential situation. There are two issues here regarding limits: arbitrary numbers plucked from a hat and scalability issues. The first is obvious and I guess I never picked up on that aspect of the problem. I've always had an professional interest in the performance side of things so I automatically considered the scalability side. In that respect the linked article is very wrong.
permalink parent [] Gimli_The_Dwarf 7 points 2 years ago
If you consider the fact that I'm not aware of a mainstream development language that has a data type which ranges from - to +, then you can pretty quickly extrapolate that the article is using "infinity" as shorthand for "unbounded value within reasonable limits" And again - you're being paid to sit in the chair and deal with the idea of a number that's both "unbounded" and "limited." And my axe.
permalink parent [] walter_heisenberg 14 points 2 years ago
I think "zero, one, many" is a better statement of the principle than "zero, one, infinity". "Many" means "we don't know how many there are, and we want to be prepared for it to go as high as the user needs".
permalink parent [] Gimli_The_Dwarf 17 points 2 years ago
nice try... I am not getting into a discussion about many vs. infinity with Heisenberg. That way lies madness.
permalink parent
18 of 25
03/27/2013 09:47 PM
http://www.reddit.com/r/programming/comments...
Well that and the fact that it's a false dichotomy. He says that you have a choice between a list that contain 10-100 items, say, and one that holds 100,000 items. However, there's no reason why the internal representation can't handle both through the same interface. When dealing with 10-100 items, represent it one way, when you get above the slowness threshold represent it the other faster way. One of the most annoying warts on some languages is the fact that an int is 32-bit or 64-bit. That is not an integer; it defines a relatively small range of integers and the set of integers is much larger than that. In any modern language, the int type should be +infinity to -infinity. I should be able to add until I run out of memory. The runtime can store the small integers as 32-bit words and then convert to a multi-word integer when the integer grows above that size.
permalink parent [] likely-to-reoffend 3 points 2 years ago
"No, I'm positive there are only three possible options for that field. No way could there ever be four - it's all based on a fifty year old system that has the options hard-coded with tubes" Reminded me of one of my favorite Feynman moments on generalizing vs. the specific case.
permalink parent load more comments (1 reply) load more comments (6 replies) [] osiris99 10 points 2 years ago
nah, an idealistic graduate would prefer zero or infinity. also don't get me started with the single parent rule in directory structure.
permalink parent load more comments (7 replies) [] mollymoo 11 points 2 years ago
It's only a rule of thumb, and a good one. You should have a good reason for not allowing arbitrarily large numbers of things.
permalink parent [] BraveSirRobin 20 points 2 years ago
You should have a good reason for not allowing arbitrarily large numbers of things. Memory Performance Code readability Complexity Testing KISS: Keep it simple, stupid.
permalink parent [] MihaiC 22 points 2 years ago
19 of 25
03/27/2013 09:47 PM
http://www.reddit.com/r/programming/comments...
Sure, but make sure the limits are resource-based and reasonable as in your examples and not arbitrary as in 'your password length can not exceed 8 characters'.
permalink parent [] Tiver 2 points 2 years ago
I get particularly worried when a bank reports that. They of all places should be storing a hash of your password and not the password itself, in which case the length of the password does not matter.
permalink parent [] kraemahz 2 points 2 years ago
The reason they are requiring short passwords is the most often method a password is stolen is a keylogger. Keyloggers use information entropy (deviations from common key sequences) to detect passwords and long, complicated passwords have very high entropy.
permalink parent load more comments (3 replies) [] bluGill 2 points 2 years ago
In general though, pretending that your limit is infinite make all of the above easier than enforcing an arbitrary limit. Memory management just as easy, in one case you check for max, in the other you check for out of memory. Performance is a wash, the same Big-O numbers apply so long as n is the same (if you expect n to be small you can choose a n! algorithm with low constants for n algorithm with big constants), the code is more readable because there isn't checks for size all over the place, and likewise it is simpler. Testing is easier as well because you don't have to test the max and over max cases. The above is in general, but there is rarely an exception.
permalink parent load more comments (23 replies) [] harlows_monkeys 5 points 2 years ago
The code to manage a list of 10 items is vastly different from that to manage a list designed for 100,000 items. No it isn't. That's the whole point.
permalink parent [] BraveSirRobin 4 points 2 years ago
Yes it is. 100,000 items belong in a database, 10 items belong in an array. Building a DB schema for the 10 scenario is a complete waste of development resources.
permalink parent load more comments (8 replies) [] psway 3 points 2 years ago
What about semaphores, reader-writer locks, etc. There are certainly times when you need to put a non-binary restriction on instances of something.
permalink [] jimktrains 3 points 2 years ago
I always have to defend this. "We don't need to support many, just a few, don't spend the time making it handle more than a few"
20 of 25
03/27/2013 09:47 PM
http://www.reddit.com/r/programming/comments...
I fail to see how this would be a good model to follow for database pool connections.
permalink load more comments (3 replies) [] RedGreendit 3 points 2 years ago
Someone tell this to Blizzard. The 200 unit limit in SC2 is a violation.
permalink [] doodle77 14 points 2 years ago
No, it's definitely for gameplay reasons (though performance is probably an intended side effect.) Otherwise the ideal strategy would be to race ahead in macro, then never stop building your army. It'd get ridiculous.
permalink parent [] davvblack 5 points 2 years ago
Uh... no, there's a finite number of resources on the map, and many, many games end before maxed armies. There are always windows where your army is bigger, and where investing in economy gives you a temporary disadvantage militarily.
permalink parent [] Kimano 2 points 2 years ago
Sure, my point is just that if you can get above max, you're better off virtually always stacking up military units and just rolling over the other person once you have a huge advantage. When you get into armies of that huge size, it becomes less about control and more about macroing up until you're way way bigger than the other person.
permalink parent load more comments (2 replies) [] doodle77 2 points 2 years ago
perhaps. Regardless, in custom maps you can remove the 200 supply limit.
permalink parent
21 of 25
03/27/2013 09:47 PM
http://www.reddit.com/r/programming/comments...
I think this particular case is somewhat interesting because it was probably initially implemented because of a performance limitation (in Brood War), but because it ended up being a significant factor in gameplay it was preserved as such.
permalink parent load more comments (2 replies) [] Recoil42 11 points 2 years ago
SC2 has a 200 unit limit? Ooh, oooh, oooh, can I be the TA fanboy that steps in for a second and points out that TA has had a 500-unit limit since at least 1999? (And unofficially a 5000-unit limit?)
permalink parent [] TOAO_Cyrus 7 points 2 years ago
actually SC2 has a 200 supply limit and different units take different supply. Zerglings take 1/2 supply so the max number of units is actually 400. EDIT: forgot overlords take zero supply as mentioned below.
permalink parent [] [deleted] 4 points 2 years ago
Fuck Core.
permalink parent [] lukeatron 2 points 2 years ago
Oh the hours of my life that that game gobbled up. I regret nothing.
permalink parent [] nexes300 2 points 2 years ago
Why does it matter? I doubt the limit is enforced in custom game modes, for example.
permalink parent load more comments (1 reply) [] [deleted] 5 points 2 years ago
The 200 unit limit is at least partly tactical. The idea is to prevent just creating huge masses of units and trying to overrun the other side.
permalink parent [] doodle77 4 points 2 years ago
The limit is 200 supply, which means you can get 400 zerglings. You can make an infinite number of overlords since they cost no supply.
permalink parent [] NegativeK 8 points 2 years ago
Why shouldn't that be a valid tactic? It would take more game balance, but devising counter strategies to that should be possible.
permalink parent load more comments (3 replies) load more comments (3 replies) [] [deleted] 3 points 2 years ago
This applies more to software principles than gaming principles (the fact games CAN BE software doesn't change this fact)
permalink parent
22 of 25
03/27/2013 09:47 PM
http://www.reddit.com/r/programming/comments...
load more comments (3 replies) load more comments (4 replies) [] barcodez 5 points 2 years ago
Frequently two also makes sense as a separate case. Double buffering and duophonic synthesizers are what immediately comes to my mind.
permalink load more comments (1 reply) [] ac3raven 2 points 2 years ago
fascinating concept.
permalink [] vombert 2 points 2 years ago
"What's this strange '2' constant all over your program?" "Ah, that's dimension of the screen", topologist replied.
permalink [] doubtingthomas 2 points 2 years ago
There will of course always be exceptions in practice, but they are just variations of this rule. For instance an octree by design always has up to 8 children. But not because it's an arbitrary restriction, but because each of these 8 children have different behaviours (they specify their spatial position).
permalink load more comments (1 reply) [] Confucius_says 2 points 2 years ago*
While the concept sounds good. In practice it does not work well. There are times that "arbitrary" limits are needed. (of course there are also times where this "arbitrary" limit is implemented without a need.
permalink [] [deleted] 2 points 2 years ago*
Around 20 years ago, during a particular design exercise we found one and one case where exactly 'two' was required. In all the thousands of cases I've ever dealt with it was the only exception to 0/1/N rule. I remember the huge discussions before we finally drew the line (ER) and wrote a 2 on it instead of a dash(1). From memory, it was a complex database which at multiple levels stored nodes and links. Nodes could have 0..n links attached, however links had exactly 2 nodes attached.
permalink load more comments (2 replies)
23 of 25
03/27/2013 09:47 PM
http://www.reddit.com/r/programming/comments...
It's the way things should be, PROVIDED the developer handles the situation properly when the constraints of the machine are reached. Things slowing down to an unusable state is not acceptable.
permalink [] unionrodent 2 points 2 years ago
"There is only the number one. All else is mere repetition." Vladimir Nabokov
permalink [] Tron-Gorf 2 points 2 years ago
I don't mind hardware limits, if they make sense. I become furious when it is some arbitrary number some numbnuts thought should be enough and that normal business would never surpass. Even worse when that number is hard-coded and not in an observable config file or table. I FUCKING KEEL U!!
permalink [] kashyap 3 points 2 years ago
Until I was 12, I had never seen a pornographic video on the internet. Then I saw my first. Then I saw one more...
permalink [] Jasper1984 3 points 2 years ago*
The idea of generalizing is 1) great, 2) terrible mission creep. Quadtrees. Two dimensions. I actually did try make an n-dimensional one, and i think i did get close, it is very doable. (Edit: i mean i wrote it, but i didn't test it. I do get that sometimes a few minor issues fixed and it works, but it probably would take a little more than that in this case. Btw, it would in principle not run much slower than a quadtree, especially if you specialize a 2-dimensional function for getting 'the index' of a sub-node) Image processing. Why only two dimensions there? Why only 3/4 colors (including alpha) Can't we use relaxation methods and do simulations of fields on that too, hey, it is a field of values? Oh dear, maybe we are a bit restricted there with the fixed grid.. Types; hey if you can make it work multiple types, why not. You could say 'lets generalize this to this or that', hey that is how we could do the image processing 'pixel'. Compilers: Why focus on a single language? Unfortunately don't see any easy-to-use parsers that convert the stuff into something more easily used as data.(s-expressions) (Parsing is harder than people admit) Of course, gcc actually does this. (Edit: because it is perfectly reasonable) Really, you can go on and on with generalization. Stop at the appropriate time, especially since the current languages are wholly inadiquate. Even CL seems to be not completely strong enough in it's handling of types. If you think you can make something very general that is still cpu-time-, space- and use- effective, neat; but make a library of it!
permalink [] arnedh 3 points 2 years ago
You know that quadtrees and voxels could be expressed as binary trees, using the A4 principle? Instead of cutting a square into 4, you cut a 1 by sqrt(2) rectangle into 2 pieces vertically, and then you cut these pieces horizontally etc. Voxels: Start with a prism of dimension 1, cuberoot(2), cuberoot(4). Cut athwart the longest axis. You now have 2 new prisms of the same shape - but the longest axis oriented in a different direction. Image: 2 dimensions, because that is the dimensionality of the neuronal array. (2 1/2 if you add the depth given by stereopsis). 3/4 colours, because those are the types of receptor cells we have.
24 of 25
03/27/2013 09:47 PM
http://www.reddit.com/r/programming/comments...
Tbh i don't even understand what you mean exactly. Guessing you mean by A4-principle that you can cut it in half with two same-ratio bits, what purpose of quadtrees are you speaking of? I wouldn't know how what you're speaking of is useful for drawing terrains or such. And i don't think it ratios are relevant at all for 'spatial sort' use. I don't even know for sure if quadtrees are good for spatial sort use, i do know that plain grids can be much better sometimes. (And there is stuff like z-hashes that don't seem all too effective for stuff like simulations at all) So probably you meant the drawing use?
permalink parent [] arnedh 2 points 2 years ago
If you use a quadtree to represent nodes that are either completely full, or completely empty, or has nodes representing subtrees - then you could make the boxes A4-shaped, and subdive alternately vertically and horizontally. The octree example (voxels) would be similar: cut along the longest axis, first vertically, then north/south, then east/west, repeat. These trees would be good to represent shapes in 2 or 3-d, fractals, landscapes, but also blobs of various kinds.
permalink parent load more comments (3 replies) load more comments (167 replies)
about
blog about team source code advertise
help
wiki FAQ reddiquette rules contact us
tools
mobile firefox extension chrome extension buttons widget
<3
reddit gold store redditgifts reddit.tv radio reddit
Use of this site constitutes acceptance of our User Agreement and Privacy Policy. 2013 reddit inc. All rights reserved. REDDIT and the ALIEN Logo are registered trademarks of reddit inc.
25 of 25
03/27/2013 09:47 PM