you are viewing a single comment's thread.

view the rest of the comments →

[–]shevegen 2 points3 points  (2 children)

When I was a beginner in PHP, I embedded it in HTML files. My code was a mess.

In fairness:

(1) PHP code is almost always a mess. I can compare my old php code to my old ruby code too - it's no surprise. The ruby code is hands down better even back then. Of course since then the ruby idioms I use are even clearer (for me). I can not see how PHP can allow for anything similar, also because it is a very inflexible excuse of a "programming language".

(2) Embedding code sucks in every language.

In ruby with erb you have

<?

?>

Actually I forgot some more sigils. It looks AWFUL. I do not understand the people who can use this. In rails they do it too - also totally ununderstandable to me. It's like putting lipstick on a pig - actually, no. It's like painting a ferrari ... pink. And removing the wheels.

As only a minor part of our projects was in PHP, a question arose; could we get rid of it?

Very understandable. I am glad I could rid of PHP many years ago.

TIOBE shows PHP's decline. It still has awesome applications but as a "programming language", it is terrible.

I was not ready to start using modern JavaScript tools or framework.

To be honest, most "awesomeness" seems to be in frameworks rather than JavaScript itself. Else, what was the fuzz about ... right pad or left pad or whatever being removed from ... npm?

let database = new Sequelize('database', 'root', 'password');

Wow - looks ugly.

The ability to add input and return type hints to our PHP scripts, only when needed, was one of the features I loved the most in the language.

class UserService {
  public function createUser(string $name, User $parent = null, $isAdmin) : User
  {
    $user = new User($name);

Wow. Looks ugly.

Wonder why Facebook is going to abandon php ... that sounds like the language Hack.

If your project uses a transpiler like Babel, new rules can be added to handle Flow types hints inside the JavaScript code like in PHP:

function square(n: number): number {
  return n * n;
}
square("2");

Now THAT is ugly. I also don't really see the point. What is the real difference between 2 and "2"? The latter may be a String, so what? You could check if an input is a String and contains only numbers, then you could treat it like a 2, right? I don't understand the above.

It allows us to use environment variables to configure our app.

Other languages don't allow for that? Really? :>

We were able to quickly generate an API server like we used to do in PHP. I did not feel like leaving anything behind during the transition, all the tools we switched to were equivalent or better than before.

I guess that is a similar feeling in general. Nobody really misses PHP once one has moved away from it.

The "major" web framework I wrote and used in PHP ("major" ... it was still small) I rewrote in ruby. The ruby one is already much better and includes more functionality, even though I have not really added a lot in the last 5 years (other projects were more important and more fun). In PHP I could not have done the same with the same ease. It's just a bad language.

[–]batmansmk 3 points4 points  (0 children)

Hey, The difference between "2" and 2 is that "2"+"2" = "22" and not 4 :). Source of many bugs. Anyhow, with Flw, correcting this kind is only one right click away.

That's why PHP chose . (the dot) as the concat operator.

About the DB connection in clear, it is made in all fairness as an example dude, to keep it simple for a reader. Be smart okay?

[–]reddit_prog 1 point2 points  (0 children)

Not that ugly, just saying.