Live data from Hacker News

I still love PHP and JavaScript

the.scapegoat.dev

291–300 of 402 posts

Re: I still love PHP and JavaScript

#291
post #52

In 2022 there is no reason to prefer these dynamically typed languages over statically typed ones for production code. When languages like PHP, Ruby, JS blew up the knock against statically typed languages was the verbosity of the resulting code, slow development cycle and general cruft, these languages solved a real problem at that time. That is no longer true today- TypeScript, Go, C# code feels as fluid as a dynam…

PHP in 2022 is statically typed, if you want it to be. The only thing afaik it's currently missing is generics.

Re: I still love PHP and JavaScript

#292
post #4

PHP has so many hidden benefits: - it's stateless by design (much easier to scale) - it was "serverless" before Serverless - surprisingly performant - no "unknown unknowns". it's so tried-and-true, there's no surprises - deployment is so simple, just drop a file on a web server. No middleware needed. - No long compile times because there is no compiling needed. EDIT: why the downvotes? If you don't agree, just reply…

> - No long compile times because there is no compiling needed.

I respect that some people accept dynamic typing as a better tradeoff for various reasons (I've worked with Ruby for many years before I discovered my love for type systems), but to me that statement reads similar to:

"No long CI builds because we skip all the tests."

:)

Re: I still love PHP and JavaScript

#294
post #57

Your definition of "legacy code" seems to be the exact opposite of what it is generally understood by the term (in the Michael Feathers sense).

thanks for reading! I use legacy code as in "code that was written yesterday or earlier", or in a less jokey fashion as "code that noone really feels ownership for", usually a codebase that shows the sign of many developers, repeated cycles of outside pressure. What I mean by "product performing well" is that the legacy codebase is still alive for a reason: it is doing its job and the job has value. Otherwise it can…

Yes, I got that. I didn't feel that the "alternative definition" was offered disingenuously, but it's still a problem when you want to have a discussion and you use certain commonly accepted terms, but with a different definition in mind. Imagine if I talked about "democracy" and in my mind I meant "The Athenian model that only allowed men over the age of 30 to vote", when everybody else was talking about, well, democracy.

In case you're not familiar with the book (i.e. "M. Feathers, 2004. Working effectively with legacy code."), it is a classic and widely regarded as "The" book on how to approach legacy codebases (even if a bit dated by now). A highly recommended read. It was also very enjoyable to read, which is remarkable for an otherwise technically-oriented book. Here is the relevant except from the introduction, defining what legacy code is and why it's a problem:

  > In a strict sense,  Legacy code is simply code you've gotten from someone else. However, clean, easy to work-with code is rarely referred to as 'legacy' code; the term usually implies a tangled, unintelligible structure, difficult-to-change code that is difficult to really understand. Therefore, a more pertinent description is:
  >
  > Legacy code is where any of the following questions fail to apply:
  >
  >  - Is your code easy to change?
  >  - Can you get nearly instantaneous feedback when you do change it?
  >  - Do you understand it?
  >
  > If the answer to any of these questions is no, you have legacy code, and it is draining time and money away from your development efforts.
Further down, he offers this simpler, provocative definition, which introduces the main theme of the book:

  > Legacy code is code without tests: Code without tests is bad code. It doesn’t matter how well written it is; it doesn’t matter how pretty or object-oriented or well-encapsulated it is. With tests, we can change the behavior of our code quickly and verifiably. Without them, we really don’t know if our code is getting better or worse.
In a more modern setting, presumably 'tests' would be extended to include other good software engineering practices, like version control, CI, etc. But the book's theme still applies in the more general since, so it's still relevant today. If you've not read it, then pick a copy up, you're in for a treat :)

Re: I still love PHP and JavaScript

#295
post #149

Earlier quoted context omitted.

Python covers many of the same use cases and is much more consistent/predictable. TCL if you want to go back a bit further.

I've never experienced the same kind of out-of-the-box problems with PHP as I have Python. I seem to suffer constantly from python/python3, pip inconsistencies and stuff just breaking constantly.

Python build/package management tooling is a joke, but Python the language is very consistent and usable.

Re: I still love PHP and JavaScript

#296

I think that php has some weird disk usage behaviour that makes running Wordpress in a docker environment slow. I don’t know exactly what it is but I would say it is a weird behaviour of php anyway.

Wordpress is just bad. PHP is leader in CMSes but the old ones Wordpress, Drupal have to support so much legacy stuff. Including wierd patterns hand hacks from the past. Modern CMSes like Craft, Kirby, Twill, Bolt, October… it is very different story.

Wordpress is elegant with its hook system. It is easily customisable. Virtually in each and every step you can modify the wordpress software via plugins.

Re: I still love PHP and JavaScript

#297

> I love legacy codebases. > A legacy codebase means that the product is performing well. It means that I can often make immediate and impactful improvements. Wow. This person must have worked on very different legacy codebases than me. Legacy Javascript code, to me, is something that I do not want to touch with a 10 foot pole, because every little piece of it can be intertwined with and used by many other hidden pla…

The code you're writing right now, is a legacy codebase soon enough, if it's good and valuable enough and to survive a few years.

Re: I still love PHP and JavaScript

#298
post #33
post #4

PHP has so many hidden benefits: - it's stateless by design (much easier to scale) - it was "serverless" before Serverless - surprisingly performant - no "unknown unknowns". it's so tried-and-true, there's no surprises - deployment is so simple, just drop a file on a web server. No middleware needed. - No long compile times because there is no compiling needed. EDIT: why the downvotes? If you don't agree, just reply…

> - no "unknown unknowns". it's so tried-and-true, there's no surprises This part is laughable. People who have been programming PHP for 20 years (several of them at my company) still routinely discover hidden bugs, quirks or general behavior that is totally unintuitive and nowhere found in the documentation.

Examples?

Re: I still love PHP and JavaScript

#299
post #4

PHP has so many hidden benefits: - it's stateless by design (much easier to scale) - it was "serverless" before Serverless - surprisingly performant - no "unknown unknowns". it's so tried-and-true, there's no surprises - deployment is so simple, just drop a file on a web server. No middleware needed. - No long compile times because there is no compiling needed. EDIT: why the downvotes? If you don't agree, just reply…

Have you tried a more "modern" language recently? By trying I mean using it for more than 6-10 months. I've been one of the PHP "supporters" until I've found Go and Rust. PHP was really nice to get into programming and make a spaghetti website but the language itself and the ecosystem always felt like a hacking project. The killer feature of PHP has always been the hosting ecosystem. A simple FTP upload would do the…

> JavaScript even its inventor said it's time to move on.

I hadn't seen that quote, do you have a link?

Re: I still love PHP and JavaScript

#300

> They are used by people who get shit done. pretty much says it all. let me finish building this shitty app by deadline, while you guys continue argue about which static type checking system is better.

And then run off for the next job after a year or two and leave the rest of the dev team with your badly written code, so that they have to clean up the mess behind you?

I think that is more of a symptom of leading edge technologies. Old school platforms the churn rate for employees is much lower.
Post reply on HN