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


Forgot your password?
Compare cell phone plans using Wirefly's innovative plan comparison tool ×

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

Lambda notation has no place in an imperative language; mixing paradigms is confusing for the vast majority of Java programmers

Really? Common Lisp had it for 30 years now.

And lambdas do not necessarily correspond to a "functional" paradigm. For that matter, paradigms themselves are blurry - they are a rather arbitrary, and very coarse, human classification of much more complicated patterns. If you have ever passed a function pointer to another function in C, one could argue that you're "mixing paradigms".

The Optional class. Instead of checking directly for a null result, you have to unpack every result out of this idiotic wrapper.

It's a good thing, because it forces you to check when you use, while allowing pass-through to be zero-overhead.

Null pointer, which you have to check, but can use without checking, is a flawed concept in that regard due to decoupling of these two operations - which is why NRE or equivalent is one of the most common unintended exception type in Java (and other languages that share the concept, which is most mainstream ones). Even the guy who invented the concept 50 years ago considers it his worst mistake.

What Java could use is a better syntax for making those checks/uses - some kind of syntactic sugar that's more concise than lambdas. Something like "match" from ML would be nice, but probably too unfamiliar to most Java users. Kotlin does the next best thing by making regular null comparisons change the type of the compared variable within one of the branches, i.e.:

var x: String?; // ? means nullable
y = x.length; // won't compile, since String? can be null, and member access is not valid on null.
if (x != null) {
// x is of type String inside here, cannot be null
  y = x.length; // compiles, no NRE possible here
y = x.length; // still illegal

which is really the same thing, but wrapped in a way that's more familiar to someone coming from a C-style language.

Comment Re:Major features are complementary (Score 1) 380

Think of Optional as a collection that has either one or zero elements. Then it all makes much more sense.

But what he was really trying to show is that you can treat optionals as a monad, same way as in e.g. Haskell. Although not quite, because in Haskell you get some nice syntactic sugar that makes it all much smoother.

Comment Re:Decimal Numbers? (Score 1) 380

Operator overloading per se is not good or bad. Or rather it's inherently good, because it lets you implement various number-like data types as libraries, and there's no way any language is going to implement everything that someone might need in the base language itself (think rational numbers, complex numbers and quaternions, ranges, sets, vectors and matrices etc).

What can be bad is a particular use of operator overloading where it's not supposed to be used. This is not specific to operators - method overloading can be similarly misused, as can inheritance and many other features.

C++ iostreams are an unquestionable example of bad design in that regard, but it's rather telling that this example, which dates back to, what, late 1980s, is still the one cited - because there aren't really any other examples of prominence. C# also has operator overloading, for example, and that makes it possible to define Decimal, Complex etc as library types - but it doesn't use it for streams (or any other weird stuff where the behavior is non-obvious).

Comment Re:Decimal Numbers? (Score 1) 380

.NET had "decimal" since the very first release in 2001. The actual type predates .NET even - Decimal in VB6 is the same exact thing, and it corresponded to DECIMAL structure (and the corresponding VT_DECIMAL variant subtype) in OLE Automation, which is still usable from regular Win32 apps. If I remember correctly, that, in turn, was an implementation of some early IEEE spec for decimal floating point.

Comment Re: Row row row your boat (Score 1) 380

Streams took easy to read and understand for loops used by every language on earth and replaced it with gibberish that you need to work through to understand

If you have been writing simple maps and folds as explicit for-loops for 20 years, I can see that being a problem. But for someone whose mind is not so conditioned, streams are clearer because they describe what is done, not how it's done - and more concise at that.

is far more difficult top debug as there's no damn place to put a break point or print statement.

You can put it inside the lambda, you know. Which is exactly equivalent to putting it inside the for-loop body.

They're banned everywhere I've heard of

Yeah, we passed that stage in C# land, too, after they've added lambdas and LINQ back in 2008. Took about 3-4 years for the old guard to give up and embrace the future.

Comment Re:Could you gush a little more? (Score 1) 380

Every other tech that is somehow competing has server drawbacks. I don't see anyone doing enterprise software in Python, C++ or C#/.Net ...

If you don't see anyone doing enterprise software in C++ or C#, you haven't looked hard enough. There are thousands of companies doing exactly that. Heck, go check out any job search site.

One particular trap that you may be falling into is assuming that your local market is representative of other places. Some geographic regions can become locally locked in to some tech that dominates the market in that region - Java, Delphi, VB, you name it. These come and go, though, and of course, being local, they don't necessarily correspond to the bigger trend.

An no other 'ecosystem' is as dynamic and moving quickly as Java is

I have no idea what your definitions of "dynamic" and "moving quickly" are, except that they clearly aren't mainstream.

In terms of moving quickly, Java is the laughing stock - they took several years to implement lambdas, for example, and they were overtaken even by C++ in the process, being pretty much the last mainstream language to get them. Even then, the result is a crapshoot due to the lack of reified generics, requiring tons of interface definitions to cover a very basic subset of functions taking/returning primitive values while avoiding boxing and the associated perf issues.

In terms of dynamic, obviously, Java can't really compete with a true dynamic language like Python. But even C# leaves it far behind in that regard, with opt-in duck typing.

thanx to ByteCode and ByteCode morphing technologies.

Bytecode is an implementation technique predating Java by 30 years or so, and is used by most VMs out there. Including C# and Python. C# ramps it up a notch by providing AST-like expression trees as a first-class data type, which can be inspected and changed at runtime before they get compiled to bytecode.

Stuff like Annotation processing, Byte Code Weaving, Hibernate, AspectJ etc. simply don't exist in such abundance outside of the JVM ecosystem.

Every single thing that you've listed exists in other ecosystems. In some cases it's direct ports of the same projects even. As for abundance, who needs that in the enterprise? What people want is a single stable implementation that everyone can standardize on.

Standards, like servlets etc. only Java has that.

Care to list a single ISO or ANSI standard that defines Java language or VM?

C++, for example, is standardized by ISO, both the language and the standard library. An older version of C# the language (sans standard library) is also an ISO standard.

And who uses servlets in 2016, anyway?

People who don't grassp that Java (the platform) is the most solid and most flexible and most avangard platform for anything around software, simply should not work in the software business.

People who don't grasp that creating a religious cult around a piece of software is a bad idea shouldn't work in the software business.

Comment Re:Could you gush a little more? (Score 1) 380

In what sense is C# the language designed for Windows environments?

The original .NET standard library (what's now known as "desktop profile"), you could say that in places (though not for 90% of it - a linked list is a linked list on any platform, for example). But the new .NET Core is designed to be cross-platform from the very beginning.

Comment Re:Could you gush a little more? (Score 1) 380

Do you still have to use that horrible Mono implementation on Linux?

You don't. However, .NET Core has a more limited standard library - in particular, it doesn't include anything GUI-wise out of the box. I would imagine that existing libraries like Gtk# will be ported to it soon enough, but from Microsoft's perspective, its primary purpose is to run server-side code - web apps and services - and various associated command-line infrastructure tooling.

Comment Re:Could you gush a little more? (Score 1) 380

I don't know C#, other than it is a sort of almost C++, but not quite.

This would imply that you don't know it at all.

C# was sort of almost Java, except with a bunch of different syntax of C++ and Delphi heritage. But that was back in 2001.

These days, it's still closer to Java than it is to C++, but I'd say it's pretty far ahead of Java in terms of high-level language features.

Comment Re:a very large planet, 15 times the Earth (Score 1) 151

And something basically to that effect was for a period at the IAU conference the definition being haggled over. A lot of people went home at that point thinking that either that would get voted in as the definition, or there would be no definition, and were fine with either outcome. The committee however changed the proposal before the vote came up.

Comment Re:The universe. (Score 1) 151

These are what the IAU came up with, in a vote that was very controversial among its membership. An association dominated by astronomers, not planetary scientists, who were by and large against the decision. And a set of terminology that you can often find flatly ignored in scientific papers. Example. In short, the only group that the IAU is able to bludgeon into using their term is the general public (using the "We're scientists, if you don't use our term you're wrong and ignorant" gambit), not the scientific community itself.

Slashdot Top Deals

The trouble with being punctual is that people think you have nothing more important to do.