Catch up on stories from the past week (and beyond) at the Slashdot story archive


Forgot your password?
Check out the new SourceForge HTML5 internet speed test! No Flash necessary and runs on all devices. ×

Comment Re: This is stupid (Score 1) 89

I should clarify that I was trying to talk about the Option<A> It tends to give more type information. Some functional programmers believe that the output of the function should only be returned in the return value and not through things like output parameters. But it's still just a style difference. Even throwing exceptions is no different than having a Either<Exception,Value> foo(int parameter) defined. I would agree that the non-generic Option monad returns no useful information, but the Option<A> tells you what potentially the output of the function is in one place.

Comment Re: This is stupid (Score 1) 89

Option.None is useful to indicate that the value is optional in type signatures or that the return value is optional in type signatures. An API documentation that has public Option foo(B b) indicates that the B is a pure value (is not optional/not null) and that the return value has the potential to not be set. public A foo(B b) would indicate that the return value is not optional and that a meaningful value will always be returned. Option also handles primitives because null can't be assigned to primitive types, likes integers or doubles. An example would be searching a list of primitives. public Option find(List primitives, Func predicateWhereCondition) means that the item in the list matching the where condition may not be found. The classic method of searching usually defaults the value to return value to -1 in public int find(List primitives, Func predicateWhereCondition) when the item isn't found, which is nonsensical when the list can contain negative integers.

If you don't want to unwrap the value, then why aren't you returning the Option type in the return type signature? When you litter your code with foo.unwrap(default), you're being forced to handle the missing foo values. Developers forget to write code on every foo return because they assume that the value is pure, meaning that public List foo() will always return an empty list rather than a null value.

Java has checked exceptions. C# has unchecked exceptions. Option types are similar to Java's checked exceptions (except checked exceptions are more like the semantics of the Either monad). You're not forced to catch the exception. You can throw the exception further up the stack if it doesn't make sense to catch the error. You're not forced to unwrap the Option type. You can throw it up the chain. Why shouldn't your function have the return signature of Option.None if you don't want to deal with unwrapping at the level you're unwrapping your Option types at?

Comment Re: This is stupid (Score 1) 89

It's actually not. None can considered a subclass of the class Option. It gets the methods defined on Option and one is forced to handle unwrapping the value and placing a default when unwrapping the value. Null have no extra behaviour on them. They can appear at any time and programmers can occasionally forget to check if the value is null. The compiler can help with the Option monad. It can't help catch missing null checks.

Comment Re:Some good, some bad (Score 1) 427

I'm sorry, but unwrapping the Optional class is simply better than directly checking for null result. People forget to null check and not null checking will cause the program to crash. It is more difficult to forget to None check on a Optional class. The Optional class is a type that's caught by the compiler at compile time. Null checking can only be caught at runtime. Missing if (variable != null) statements don't get noticed by the compiler. Being forced to unpack the result is what you need to do everytime you deal with nullable values and most developers are going to forget null checking once in a while. The Optional class also gives a better meaning to element searching as both primitives and objects can be wrapped in the optional class. Searching an array of primitives for a found result previous to Optional would require a default value to be passed when nothing is found matching the search predicate It's nonsensical. Searching an array of primitives with an Optional construct defined let's the API return None, which has better meaning for elements not found.

San Francisco Bay Area In Superbowl Surveillance Mode ( 95

An anonymous reader links to Wired's description of a surveillance society in miniature assembling right now in San Francisco: Super Bowl 50 will be big in every way. A hundred million people will watch the game on TV. Over the next ten days, 1 million people are expected to descend on the San Francisco Bay Area for the festivities. And, according to the FBI, 60 federal, state, and local agencies are working together to coordinate surveillance and security at what is the biggest national security event of the year.
Previous year's Superbowl security measures have included WMD sensors, database-backed facial recognition, and gamma-ray vehicle scanners. Given the fears and cautions in the air about this year's contest, it's easy to guess that the scanning and sensing will be even more prevalent this time.

Comment Re:Scrum Was Never Alive (Score 2) 371

I want to also add that even though scrum says that the scrum leader should be rotated, the project manager always tends to insert himself into the scrum leadership role (because, they wouldn't have a role otherwise). So rather than the scrum team being a team of purely developers leading developers, we have the programmers leadership abilities suppressed just so that the project manager can be visible as a leader/

Comment Re: basic health insurance for all is needed maybe (Score 1) 177

Please have some evidence citing your claims. As is, the socialist health care systems save their citizens more money than American's private health insurance system. The bureaucracy for payment collection is eliminated under the socialized health care systems. And a nation's military funding has no bearing on their health care funding. American's still pay more of their GDP in health care costs compared to Canadians and Europeans.

Comment Re:Wait, what? (Score 1) 361

Monsanto goes after farmers who use Round Up Ready on their farm fields, not farmers who grow the Monsanto seed. Farmers are free to use any other pesticide on their crops and Round Up Ready would work against non-Monsanto crops. Only when both Monsanto seed and Round Up Ready are used is there a clear case of willful patent violation.

Comment Re:Because no one else does (Score 1) 260

With lambda functions, my lines of code is shorter. I'm write now having to debug my predecessor's code and he wasn't aware of lambdas in C#. Everything becomes a jump point into another awkward function with the intent obfuscated. Rather than just using Linq and Expression trees, he made his own collection classes with tailored search functions on each function. Not every function needs a name and the intent can be inferred by just reading the function definition from the body of the function.

Comment Re:The learning new trends is big (Score 1) 370

I can understand that too. I'm delegating tasks to a person 20 years older than me (I'm 31) and with 16 years more experience than my 4 years of experience. I asked him to write a program that connects to a database directly and he's never had that experience. He said he had several years of experience in VB.NET and he could adapt to other programming languages, but he's struggling with C# and I know he didn't try learning the modern features of VB.NET, like using generics. He has difficulty using search engines to solve common program mistakes, and I've suggested that Google should be his first resort to solving problems rather than I being his first resort. He was fired from his previous job and he's already asking for training on programming. My supervisor is aware of the situation and is growing concerned about his performance. It's basically the end of the line for him in the programming world if he gets fired from my current employer.

Slashdot Top Deals

"Confound these ancestors.... They've stolen our best ideas!" - Ben Jonson