Hacker Newsnew | past | comments | ask | show | jobs | submit | doliveira's commentslogin

Only half-joking: maybe Java was a mistake. I feel like so much was lost in programming language development because of OOP...


Java is most of why we have a proliferation of VM-based languages and a big part of why WASM looks the way it does (though as I understand it, WASM is the shape it is in some measure because it rejects JVM design-for-the-language quirks).

I would also not blame Java for the worst of OO, all of that would have happened without it. There were so many OO culture languages pretending to that throne. Java got there first because of the aforementioned VM advantage, but the core concepts are things academia was offering and the industry wanted in non-Ada languages.

I would say Java also had a materially strong impact on the desire for server, database and client hardware agnosticism.

Some of this is positive reinforcement: Java demonstrates that it's better if you don't have to worry about what brand your server is, and JDBC arguably perfected ODBC.

Some of it is negative: a lot of the move to richer client experiences in the browser has to do with trying to remove client-side Java as a dependency, because it failed. It's not the only bridged dependency we removed, of course: Flash is equally important as a negative.


> I would also not blame Java for the worst of OO, all of that would have happened without it. There were so many OO culture languages pretending to that throne. Java got there first because of the aforementioned VM advantage, but the core concepts are things academia was offering and the industry wanted in non-Ada languages.

Really? Were there other major contenders that went as far as the public class MyApp { public static void main( nonsense?


OOP is very useful/powerful, don't throw the good parts out. Java messed up by deciding everything must be an object when there are many other useful way to program. (you can also argue that smalltalk had a better object model, but even then all objects isn't a good thing). Functional programing is very powerful and a good solution to some problems. Procedural programing is very powerful and a good solution to some problems. You can do both in Java - but you have to wrap everything in an object anyway despite the object not adding any value.


> everything must be an object when there are many other useful way to program.

Perhaps you would prefer a multi-paradigm programming language?

http://mozart2.org/mozart-v1/doc-1.4.0/tutorial/index.html


Java was derived from C++, Smalltalk, and arguably Cedar, and one of its biggest differences from C++ and Smalltalk is that in Java things like integers, characters, and booleans aren't objects, as they are in C++ and Smalltalk. (Cedar didn't have objects.)


Right. Everything a user can do is object, but there are a few non-object built ins. (they are not objects in C++ either, but C++ doesn't make everything you write be an object)


In C++ integers and characters are objects. See https://en.cppreference.com/w/cpp/language/objects.html, for example, which explicitly mentions "unsigned char objects", "a bit-field object", "objects of type char", etc.


I feel this is a case of using the same word to mean something different. C++ “object” here seems to mean something more akin to “can be allocated and stuffed into an array” than a Smalltalk-type object.

i.e. C++ primitive types are defined to be objects but do not fit into a traditional object-oriented definition of “object”.


Yes, many people believe that C++ isn't really "object-oriented", including famously Alan Kay, the inventor of the term. Nevertheless, that is the definition of "object" in C++, and Java is based on C++, Smalltalk, and Cedar, and makes an "object"/"primitive" distinction that C++, Smalltalk, and Cedar do not, so "Java [did something] by deciding everything must be an object" is exactly backwards.


I'm not sure who invented "object oriented", but objects were invented by Simula in 1967 (or before, but first released then?) and that is where C++ takes the term from. Smalltalk-80 did some interesting things on top of objects that allow for object oriented programming.

In any case, Alan Kay is constantly clear that object oriented programming is about messages, which you can do in C++ in a number of ways. (I'm not sure exactly what Alan Kay means here, but it appears to exclude function calls, but would allow QT signal/slots)


The specific thing you can do in Smalltalk (or Ruby, Python, Objective-C, Erights E, or JS) that you can't do in C++ (even Qt C++, and not Simula either) is define a proxy class you can call arbitrary methods on, so that it can, for example, forward the method call to another object across the network, or deserialize an object stored on disk, or simply log all the methods called on a given object.

This is because, conceptually, the object has total freedom to handle the message it was sent however it sees fit. Even if it's never heard of the method name before.


You can do that in C++ too - it is just a lot of manual work. Those other languages just hide (or make easy) all the work needed to do that. There are trade offs though - just because you can in C++ doesn't mean you should: C++ is best where the performance cost of that is unacceptable.


No, in C++ it's literally impossible. The language provides no way to define a proxy class you can call arbitrary methods on. You have to generate a fresh proxy class every time you have a new abstract base class you want to interpose, either by hand, with a macro processor, or with run-time code generation. There's no language mechanism to compile code that calls .fhqwhgads() successfully on a class that doesn't have a .fhqwhgads() method declared.


you don't call fhqwhgads() on your proxy class though. You call runFunction("fhqwhgads") and it all compiles - the proxy class then string matches on the arguments. Of course depending on what you want to do it can be a lot more complex. That is do manually what other languages do for you automatically under the hood.

Again, this is not something you should do, but you can.


That doesn't provide the same functionality, because it requires a global transformation of your program, changing every caller of .fhqwhgads() (possibly including code written by users of your class that they aren't willing to show you, example code in the docs on your website, code in Stack Overflow answers, code in printed books, etc.). By contrast, in OO languages, you typically just define a single method that's a few lines of code.

You're sinking into the Turing Tarpit where everything is possible but nothing of interest is easy. By morning, you'll be programming in Brainfuck.


C++ standard gets the definition of object from the C standard, i.e. a bunch of memory with a type.

Nothing to do with the objects of OOP.


To be clear, I’m not trying to pick at whether or not C++ is “really object oriented”.

What I’m saying is that the discrepancy between primitives in C++ and Java is entirely one of definition. Java didn’t actually change this. Java just admitted that “objects” that don’t behave like objects aren’t.


On the contrary, Java objects are very different from C++ objects, precisely because they lack a lot of the "primitive-like" features of C++ objects such as copying, embedding as fields, and embedding in arrays. (I'm tempted to mention operator overloading, but that's just syntactic sugar.)


Java differs from C++ in an endless number of ways.

What I’m saying is that in both C++ and Java, there are a set of primitive types that do not participate in the “object-orientedness”. C++ primitives do not have class definitions and cannot be the base of any class. This is very much like Java where primitives exist outside the object system.

If the C++ standard used the term “entities” instead of “objects” I don’t think this would even be a point of discussion.


It's not some minor point of terminology.

The entire design of C++ is built around eliminating all distinctions between primitive "entities" and user-defined "entities" in a way that Java just isn't. It's true that you can't inherit from integers, but that's one of very few differences. User-defined "entities" don't (necessarily) have vtables, don't have to be heap-allocated, can overload operators, can prevent subclassing, don't necessarily inherit from a common base class, etc.

C++'s strange definition of "object" is a natural result of this pervasive design objective, but changing the terminology to "entity" wouldn't change it.


> The entire design of C++ is built around eliminating all distinctions between primitive "entities" and user-defined "entities"

If the intent was to erase all distinction between built-in and user-defined entities then making the primitive types unable to participate in object hierarchies was a pretty big oversight.

But at this point I think we’re talking past each other. Yes, in Java objects are more distinct from primitives than in C++. But also yes, in C++ there is a special group of “objects” that are special and are notably distinct from the rest of the object system, very much like Java.


You can read Stroustrup's books and interviews, if the language design itself doesn't convey that message clearly enough; you don't have to guess what his intentions and motivations were. And, while I strongly disagree with you on how "special and notably distinct" primitive types are in C++, neither of us is claiming that C++ is less adherent to the principle that "everything is an object" than Java. You think it's a little more, and I think it's a lot more.

But we agree on the direction, and that direction is not "Java [did something] by deciding everything must be an object," but its opposite.


I don’t actually think it’s any more adherent to that notion. This is exactly why I tried to point out the discrepancies in definitions. You have to define what an “object” is or the discussion is meaningless.

If the definition of object is something like “an instance of a class that has state, operations, and identity” then C++ primitives are fundamentally not objects. They have no identity and they are not defined by a class. If “participates in a class hierarchy” is part of the definition, then C++ is way less OO than Java.

I don’t quite understand what your definition is, but you seem to be arguing that user-defined entities are more like primitives in C++, so it’s more object-oriented. So maybe “consistency across types == object orientedness”? Except C++ isn’t really more consistent. Yes, you can create a user-defined type without a vtable, but this is really a statement that user defined types a far more flexible than primitives. But also if “consistency across types” is what makes a language OO then C seems to be more OO than C++.


I don't think C++ is object-oriented, and it is certainly way less OO than Java in most ways. Its "classes" aren't the same kind of thing as classes in OO languages and its "objects" aren't OO objects.

In part this is because by default even C++ class instances don't have identity, or anyway they only have identity in the sense that ints do, that every (non-const) int has an address and mutable state. You have to define a destructor, a copy constructor, and an assignment operator to give identity to the instances of a class in C++.

With respect to "participates in a class hierarchy", that has not been part of the definition of OO since the Treaty of Orlando. But, in Java, all objects do participate in a class hierarchy, while no primitives do, while, in C++, you can also create class instances (or "class" "instances") that do not participate in a class hierarchy (without ever using inheritance, even implicitly). So, regardless of how OO or non-OO it may be, it's another distinction that Java draws between primitives and class instances ("objects" in Java) that C++ doesn't.


I think we are in agreement.

In C++, everything is an object as defined by the C++ spec, but a lot of things are not objects in an OO sense.

In Java, almost everything is an object in an OO sense, but some stuff is definitely not.


Just like Java, you cannot inherit from integers or characters. Depending on what you want to do with them that might or might not matter.


That's true, and in Smalltalk it's not true. In Cedar there is no inheritance. At any rate it's not a case of Java making more things objects than its forebears.


> At any rate it's not a case of Java making more things objects than its forebears.

There are other cases though. E.g. in C++ you could always have function pointers which were not objects and functions which were not methods. In Java you had to use instances of anonymous classes in place of function pointers, and all of your functions had to be (possibly static) methods.


Function pointers in C++ are "objects", and the difference between static methods and C-style functions which are not methods seems purely syntactic to me, or at best a question of namespacing. Regardless, static methods are not objects either in Java or in C++, so that is also not a case of something being an "object" in Java and not in C++.


> Function pointers in C++ are "objects"

In the C++ sense, but they don't have classes and don't participate in inheritance. Whereas the early-Java equivalents do.


Yes, I agree.


As long as you don't keep switching the DC current on and off, which is what computers are all about


Honestly I don't think I've ever used a precompiled package in Python. Every single C stuff seems to take ages and requires all that fun stuff of installing native system dependencies.

Edit: skimming through this page, precompiling seems like an afterthought, and the linked packages don't even seem to mention how to integrate third-party libraries. So I guess I can see why it doesn't deliver on its promises.


Probably a function of the specific set of packages you use, or the pip options you specify. Pretty much all the major C packages come as wheels these days.


They all come as wheels, they just aren't precompiled.


I honestly can't remember the last time I had to compile anything, and I am on Windows.


Can you link one that comes as a wheel but is really a source distribution?


You can try pip install pillow for a good example of how it works. I suspect there's a strong survivorship bias here, as you'd only notice the packages that don't ship with wheels.


Yeah, perhaps. One I remember from last year is the cryptography and numpy package, for instance. Now they do seem to ship with binary wheels, at least for my current Python and Linux version.

Kerberos and Hadoop stuff obviously still doesn't, though. I guess the joke's on me for being stuck in this stack...


In order for a wheel to be used instead of a source distribution there needs to be one that matches your environment. For numpy you can take a look at the wheels for their latest release[1]. The filename of a wheel specifies where it can be used. Let's take an example:

numpy-1.25.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

This specifies cpython 3.9, linux, glibc 2.17 or higher, and x86_64 cpu. Looking through the list you will see that the oldest cpython supported is 3.9. So if you are running with an older version of python you will have to build from source.

I just learned a bit more about this recently because I could not figure out why PyQt6 would not install on my computer. It turned out my glibc was too old. Finally upgraded from Ubuntu 18.04.

[1] https://pypi.org/project/numpy/1.25.2/#files


Try `--only-binary :all:` to force pip to ignore sdist packages, might help avoid those slow compilations.


I thought so too until I got to interact with databases and Big Data tools written in Java. God, what a mess that requires so much upkeeping, more dependency problems than I remember from C++ and probably some orders of magnitude more resources than they should.


Doing code review for C++ code delivered by most well know offshoring companies, versus what they deliver in Java, will help get another point of view.


Thankfully LLMs are becoming a viable, cost-effective, option for stuffing your favorite offshored codebase with even more unmaintainable spaghetti. What a time to be alive.


Is that an advantage? At the very least, what it entails is that losing your private key is game over.


I mean, that sucks, but honestly she's not a ~digital influencer~. So I don't think her views matter that much.


I was watching a video about nesting in CSS and how it's just in Chrome and comments were all about how cool it is and how they can't wait to use it, and so on, and so forth. I think it's quite a representative example: we can do that much better with SASS today, but I guess Google needs to keep features pushing at full speed so no one else can keep up.

We developers are so gullible. Just give us some shiny things and we don't even realize they're heating up the pan.


> I was watching a video about nesting in CSS and how it's just in Chrome

Nested CSS is supported in the latest version of all major browsers.

https://caniuse.com/css-nesting


It will be supported in Firefox 117, the latest release is 115 and needs you to manually enable a feature flag.

The center row of versions with the gold border is how caniuse indicates the current release.


Thanks for the correction!

I hovered over the green box for Firefox 117 and it said “Released”. I see now that for browser versions that have actually been released, it says “Released <release date>” and it’s just a very misleading bug because all unreleased browser versions will just say “Released”.


That's not the point...


Yeah, financial and social pressure is basically the only weapons we have against corporations when regulations don't exist. And honestly, financial pressure doesn't work at this scale or in this case.


Yes, but this will be an uphill battle. Every campaign must be financed, so every politician must effectively be vetted by monied interests. The same monied interests that we see here on a strategic offensive against the rest of us. Regulators will tend to be sympathetic to them, not us, until things get really bad.

Is EFF still the place to send money?


I think so. I don't know of any better.


Are they actively pursuing WEI? Is there anyone who is?


> when regulations don't exist

It’s very likely governments will make this mandatory if they have the chance to regulate over this.


[flagged]


Which executive orders, federal appointments, and other executive branch actions, would you attribute to Eric Schmidt?


From this article:

"At the same time, Schmidt has been appointed to numerous White House advisory positions, giving him privileged insight into the administration’s policies in technology, science and military defense, as well as unusual access to top policymakers."

https://www.techtransparencyproject.org/articles/eric-schmid...

A quick Google of "eric schmidt obama" brings up a lot of articles discussing their close political relationship.


I appreciate the link - but "Schmidt has been appointed to numerous White House advisory positions" != "basically a shadow president".

There have been many questionable advisor appointments by previous presidents. Including the last president.


Very good, but that doesn't answer the question.


And that makes him “shadow president” how? Was he the one with the most access as opposed to, says, David Axelrod?


I don't want to put words into the OP's mouth with regards to his assertion about Schmidt, but given the loose wording: "basically shadow president", it's fair to say it isn't meant literally, and it usually comes with a negative connotation and to imply that Schmidt was so deeply involved, from a standpoint of strong biases in favor of Google and the obvious potential for corruption in participating as an advisor to someone (Obama) who doesn't have the same grasp on technology — and the extent and length of Schmidt's involvement throughout Obama's terms.

It could be said that Schmidt disproportionately influenced important decisions in the tech realm, to a degree nearly equal to executive authority, because it presumably (and greatly) outweighs the opinions of the other heads of Big Tech, so long as Obama was naive enough to agree with him on key issues he didn't fully understand.

This is especially damning in light of the NSA / Prism scandal during Obama's term, and Big Tech's involvement and compliance with that.

Of course, anyone could assert this about an advisor to a President depending on the President's level of knowledge and outright willingness to apply their advice, even if in spite of fairness (competition), rights, laws, or precedents.


If you live in a representative democracy, and Google has a presence there, contact the offices of those representatives. These things don't always seem like they matter, but sometimes they do. Big tech generally (and Google specifically) is a pretty popular target right now -- seemingly worldwide and across most ideological divisions.


This is true, but I think the main issue is whether people are quick enough to call for congressional hearings and decisive actions / lawmaking that would have any impact before it's too late. It's a race to the finish, and big tech companies always have the advantage. Of course, that doesn't mean regulation couldn't call for a reversal on what's been implemented.

The other side to this issue is despite the scrutiny towards big tech, they can still lobby and make any regulatory actions seem effective, when in practice, they've already gotten their fingers into influencing policy in such a way that doesn't ultimately address the consumers' concerns.


Financial pressure won't work because you are not Google's customer. Google's customers are its advertisers.


And you are the customers of those companies advertising. That's leverage, too.


Financial and social pressure are the only ways you convince anybody to do anything that isn't biological.


Speaking of regulations, I think an angle that can help spread awareness to the general public is casting this as essentially being the equivalent of SOPA/PIPA but being pushed by Big Tech rather than Big Gov.


Regulation is just social pressure enforced by guns.


They literally already store the whole conversation...


I have 4 banking apps and about 8 government apps in my phone. All of them require device attestation. I have no doubt they will use the Web Integrity API as well.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: