Hacker News new | ask | show | jobs
by DoctorPenguin 2713 days ago
Why not teach it better? https://glot.io/snippets/f8g0wlar0d

No wonder PHP developers have a bad reputation.

2 comments

I downvoted you because your comment doesn't help anybody and is offensive. Why do you think your example is better?
Because the examples given in this "book" teach a bad coding style and explain nothing in detail. If a trainee only used this to prepare for the final exams and I was to ask a more in depth question he would propably fail.

Example: "Why do you use double quotes everywhere?" Most probable answer: "Because I can use variables and the backslash-n thingies everywhere and its more convinient than using single quotes."

Example: "Why do you use '. "\n";' instead of the PHP_EOL constant?" Most probable answer: "What is PHP_EOL?";

Example: "Why aren't you using namespaces anywhere?" Most probable answer: "What are namespaces?"

Altough this might be a german perspective but I would not hire someone that presents me this kind of code. And for anyone saying "But this is only one book to learn the basics?" why not learn it the right way from the start?

Not sure I follow. What are your criticisms, specifically?