this post was submitted on 20 Jul 2024
115 points (96.7% liked)

Programming

17651 readers
327 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] Anticorp 8 points 5 months ago (4 children)

HEY! Is PHP ugly? Yes. Does it use stupid naming conventions? Also yes! But it's an awesome language when you want to get shit done. There's no other languages out there where you can just write some code in VIM directly on the server through SSH and immediately see your results without any further setup. No frameworks required, no packages, no imports, no buzzwords and hubub, just pure unadulterated utility.

[–] [email protected] 20 points 5 months ago (2 children)

Incorrect. Perl does the same just as well, and it's a language that actually makes sense while also being uglier.

[–] [email protected] 6 points 5 months ago (2 children)

In my experience Perl is a write-only language. Coming in behind someone else and fixing or writing their code is often slower than just rewriting it

[–] felbane 4 points 5 months ago

Perl is definitely a WORN language.

Write Once, Read Never

[–] [email protected] 2 points 5 months ago

Perl is partially readable, provided that it's your own code. The one thing perl coders hate the most, is other people's code.

Source: Am a perl coder

[–] Anticorp 2 points 5 months ago

I'll admit, I have zero experience with Pearl. I do like the uglier point you made though. 50+ DKP

[–] [email protected] 7 points 5 months ago (1 children)

Nonsense, there are tons of systems like that now. I've been playing with Deno & Fresh, it's great. Trivial to install, a pretty great language, Fresh doesn't force everything to be client side - you can easily write old school completely server side rendered sites if you want but you get to use TSX which is waaaaay superior to the old text based templating systems we used to use (Handlebars, Jinja, etc.).

It also has built in hot reloading by default so even faster than PHP. Literally hit save and you see the results.

[–] Anticorp 3 points 5 months ago (2 children)

What's this install nonsense? I just looked up Deno and it's part of an NPM stack. With PHP you just

  1. Open an Apache server

  2. Write code

  3. ???

  4. Profit!

[–] [email protected] 6 points 5 months ago* (last edited 5 months ago)

Write code

???

Profit!

Accurate PHP mindset on so many levels

[–] [email protected] 5 points 5 months ago (1 children)

I just looked up Deno and it’s part of an NPM stack.

It's not. It supports NPM modules for backwards compatibility, but the whole point is that it doesn't inherit the NPM tooling mess. You can go from a new Linux install to a running Fresh project in 3 commands.

[–] Anticorp 1 points 5 months ago (1 children)

Okay, I'm interested. What stack is it part of? What kind of servers does it use?

[–] [email protected] 3 points 5 months ago (1 children)

There's two things:

Deno: this is a replacement for Node and NPM and prettier and some other tools. So one aspect is that it's a more modern Node, using standard web APIs instead of Node specific stuff. And the other aspect is it is more streamlined modern tooling - no node_modules, no complicated build steps, built in Typescript support, etc. In fact you can use a single file as a script, similar to Python.. but unlike Python you can use third party dependencies, which makes it fantastic for stuff like CI scripts, etc. where you might have suffered with Bash or Python before.

Fresh: this is just a web framework targeting Deno. Honestly I haven't used it much but I really like what I've seen so far. I always found React to be confusing and overkill for most sites, which should really be rendered server side, but also I really like the way you can compose components with JSX/TSX in a real language with full type checking. Fresh gives you both!

[–] [email protected] 2 points 5 months ago (1 children)

but unlike Python you can use third party dependencies,

In what sense does python not have third party dependencies?

[–] [email protected] 2 points 5 months ago (1 children)

It has them, but you can't use them from a single-file script. You have to set up a pyptoject.toml, create a venv and then pip install . in it. Quite a lot of faff. It also makes some things like linting in CI way harder than they should be because the linters have to do all that too.

With Deno a single .ts file can import third party dependencies (you can use any URL) and Deno itself will take care of downloading them and making them available to the script.

Some other languages have this feature to certain degrees. E.g. I think F# can do it, and people are working on it for Rust, but Deno is at the forefront.

[–] [email protected] 1 points 5 months ago (1 children)

Oh I see what you mean. Interesting.

As you allude to there are tools in python to help (I tried pex briefly once, for example). It hasn't really been a pain point for me but I can see why people would spend time on it. I imagine this strategy has its share of tradeoffs and gremlins.

[–] [email protected] 1 points 5 months ago (1 children)

there are tools in python to help

I haven't actually used pex but it doesn't look like it solves this - it's more of a way of distributing full programs. The .pex files aren't editable, which is something you need for this use case.

I imagine this strategy has its share of tradeoffs and gremlins.

As far as I know there are no downsides. It's basically win-win.

[–] [email protected] 1 points 5 months ago (1 children)

I found it in the docs https://docs.deno.com/runtime/manual/basics/modules/#importing-by-url

Not sure if that generates like a lockfile or how it handles peer deps. Intersting nonetheless.

[–] [email protected] 1 points 4 months ago

It can optionally use a lock file. Not sure about peer dependencies tbh.

[–] [email protected] 1 points 4 months ago

no other languages out there where you can just write some code in VIM directly on the server through SSH and immediately see your results without any further setup

laughs in coldfusion

[–] [email protected] 1 points 4 months ago (1 children)

PHP is native in Linux then?

How is that different to something like powershell?

[–] Anticorp 2 points 4 months ago

You can't run a website off powershell. PHP can render HTML to the browser, so it's perfect for website development. 99% of the web was PHP back in the wild West days.