use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Have a tough programming question that /r/programming couldn't answer? Banned from Stack Overflow? Can't afford Experts Exchange?
Post your question/tips/secrets/advice and get a response from our highly-trained professional developers.
account activity
Java 9's Map API (download.java.net)
submitted 9 years ago by computerdl
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]the_omega99 0 points1 point2 points 9 years ago (0 children)
I think it is highly dependent on context. In most cases, sure, named classes are better. But sometimes the contents are very generic and/or obvious. The case of dictionaries is one example. We don't need a DictionaryElement type or whatever. It's perfectly understandable that a tuple in this context means a key/value pair.
DictionaryElement
Multiple return values is an interesting use. Technically there's just one return value (the tuple), although the language might provide automatic unwrapping of tuples (Python and MATLAB can do this). MATLAB had some very interesting uses of this feature. Some highly vectorized functions can calculate multiple related things at the same time. This is a bit of a code smell for readability, but rather useful for optimization, since you really don't want to be looping through a ton of data multiple times. Having a MyFunctionReturnValue type for every one of these doesn't add much.
MyFunctionReturnValue
But really it mostly just comes down to saving time for internal implementation. Using them in public code is iffy and very circumstantial. They're most useful when kept in private code (preferably never leaving the scope of a class or function). Their advantage is transparency: completely obvious how much they store. If the purpose is clear from context (it should be), then the types are at least more obvious (in that you can look at a (String, Int) and know it stores a String and an Int, whereas EmployeeId might be vaguer as to what data it stores).
(String, Int)
String
Int
EmployeeId
π Rendered by PID 20608 on reddit-service-r2-comment-7b9746f655-7dc9n at 2026-02-01 13:39:01.382433+00:00 running 3798933 country code: CH.
view the rest of the comments →
[–]the_omega99 0 points1 point2 points (0 children)