Puke, I am your Phava: code that works both as PHP and Java

https://cdck-file-uploads-global.s3.dualstack.us-west-2.amazonaws.com/boingboing/optimized/3X/5/b/5b1def878c70a79ef72759ddbce830f61a623a8e_1_503x500.jpg

If you have proper test coverage then you get static checking for free. If you don’t have proper test coverage then static checking won’t save you. I learned a lot while working with Java but testing in Java is actively harmful and it will break your brain. You can sometimes spot an ex-java programmer trying to come to terms with other languages, implementing dependency injection and factory patterns because they don’t realise it’s a workaround for a problem they no longer have. If you’re testing time sensitive stuff, just redefine the system clock method! That’s OK now! You don’t have to inject a DateTimeFactory any more. Then we hug and cry like that scene from Fight Club with Meatloaf.

I do a lot in ruby now. There are a hundred ways to skin cat which scares some people, but it means that I can always select the cleanest method for the cat at hand. I don’t think I realised how much of a programming language is its community and ecosystem.

I don’t miss 'em. Code is written once and read a thousand times, so making it easier to write is solving the wrong problem. Make it easy to read, or at least expressive.

Cool! It was fun to rant :smile:

5 Likes

Its just not possible in all cases. Complex systems with huge numbers of functions and degrees of freedom. Multiply the number of possible code paths by the possible permutations in input data and your tests would take thousands of years to run.

3 Likes

That’s fair, but I still think whatever you’re doing there is surely a better choice of language than Java. You can get asynchronous execution and thread messaging built right into the syntax if you want, static type checking hand in hand with a dynamic runtime, you will be able to install libraries with a single command and nobody will try to charge you money for PDF documentation. I’m convinced that half the reason every Java project tends towards such bloat is because every project is a silo and nobody’s sharing. Java legacy code will be around for a long time but I can’t imagine wanting to use it for any blank-slate project, besides android.

1 Like

I think you’re mixing application servers and client software here. The version hell with PHP is as bad as Java but users don’t see it - the stuff runs only on the server.

I agree that client-side Java should die screaming and painful but I actually prefer it over PHP running applications on servers.

4 Likes

I never managed to wrap my brain around PHP, despite many attempts. This language hurts my brain.

Yeah, you can only really appreciate PHP by imagining yourself as a person who thought they were doing pretty well for themselves just knowing HTML, and suddenly awakens into a world of procedural code via PHP.

3 Likes

If you like polyglots, here in one working in PHP, Perl, Python, Ruby, C, C++, and Objective-C

Wikipedia reference a 16 languages polyglot, but without listing them. I see ZSH, Bash, C (two variants), C++, Ruby, Perl (and Perl 6), tcl, Makefile, Haskell, Python, HTML and JavaScript.

4 Likes

A few months ago, I was showing someone some Java I had written in 1997. It still worked fine except for some hardcoded urls that hadn’t existed in over a decade. Your thing sounds very much like someone along the way was “clever”.

4 Likes

Try BF, you’ll feel better.

3 Likes

Oh, I’ve had that reaction before, but at least this time I didn’t hear a client saying “You can fix this, right? We haven’t been able to reach the previous developer in a few months …”

4 Likes

I don’t really follow most of this discussion, but I do know I never had any of these problems in AppleSoft BASIC, which is still around when you guys want to get serious about computers again.

If you ask nicely I’ll share with you some of the eldritch PEEK and POKE commands I learned in my adventures.

6 Likes

Someone did this on purpose?!?

1 Like

Now I wish I was you.

9 Likes

As someone who’s a geek, programmer, tinkerer, maker, and chronic procrastinator I look at stuff like this and think, “don’t you have something better to do with your lives?”

1 Like

Minecraft?

Farva?

Obligatory @codinghorror:

The PHP Singularity

1 Like

As a developer I hate Java…but even in 2016, it is still one of the most used computer programming languages.
Not only for android, but for enterprise applications. The only place it ever really died was the browser plugin.

This isn’t even factoring all the languages that utilize and compile to the JVM.

4 Likes

But yet its very common. Java encourages developers to be clever.

2 Likes

Oh god it’s true, I ranted too much and I said things I now regret. I’ll continue only if you all promise not to take me too seriously.

Java’s not dead. Paris is a wasteland of corporations that want programmers who know “an engineering language such as C# or Java, scripting languages (python, ruby) also helpful.” I had to go to the next country over to get a ruby job. That’s a big chunk of that 22.6%. And I’d speculate that the java corpus contains a higher than average proportion of reinvented wheels, for want of an effective sharing mechanism. But it did force developers to talk about objects that .haveProperties() and .doThingsTo(otherStuff) instead of loop unrolling and template metaprogramming and that probably did a lot to integrate them into the business world. Nowadays you can have that same business discussion at the level of your public API and maybe your schema, so a programming language that you can turn into nice UML diagrams for consumption by analysts is redundant.

I’d like to think the future lies in a lot of niche languages, so in that bubble graph I think you could lump a lot of the smaller dots into a bigger “indie” (sponsored by Alphabet Corporation) bubble including ruby, golang, rust, elixir, the javascript hipsters, even as you say some languages that are using the JVM. And maybe somebody “just dabbles” with lua, but twenty lines of code there and you have a neural network distributed onto your graphics card(s). And all of those languages bind to C/C++ like lego and duplo, so + (9.9 + 7.37)%…

Python deserves to be where it is, as far as I can tell. I don’t know if I will always love ruby, but the nice thing about a ruby job is that you know from the start they let a developer make the development decisions.

Yes but was it enterprise?

1 Like