Live data from Hacker News

Nobody cares about your clean code

felipecsl.com

91–100 of 177 posts

Re: Nobody cares about your clean code

#91

"throw the first one away" When I'm prototyping or hacking something together, I don't write tests, I don't comment/document much, I use lots of shitty variable/type names, lots of commented out code, debugging printfs, not much organization of files (often one large file). The prototype software is write-once, read-maybe. Maybe I'll want to see what I did down the road, but more likely I'll be shortly rewriting what…

When I'm prototyping or hacking something together, it eventually becomes production. I cannot relate to people who make prototypes to throw away, I've never done it, and I don't know why I'd do it. Due to that, I write my first line of code as if it's going to be on production forever, because it will.

You do it to understand the problem you're working on before you start writing production code. If you understand the problem you're working on, there's no need for prototyping, which is probably true for most code an average programmer writes. I tend to write prototype code to learn how something new works before writing production code, or when I have multiple ideas how a system should work and need to iterate on them and pick what I should actually ship. If you know you need to build a specific feature and how it should work you don't have to prototype it.

Re: Nobody cares about your clean code

#93
post #31

I really don't get all the hate towards php, I'm about to put my old blog online and it's written in php. It's a cool language.

It’s because it makes no effort to prevent people doing insanely insecure things. Rails has a lot of safeguards for insecure things like using user input to update a record. PHP won’t even fix bugs due to backwards compatibility. They worked out their sql string escape function didn’t escape properly but instead of fixing it and telling everyone to check their code, they duplicated the function and prefixed the name…

I wrote my website (where clients could hire me as a 3d artist back in 2008) I had zero experience with php. I liked the idea of using include("page.php") to insert part of a page into a "layout". I remember my friend (who was a better programmer than me at the time) telling me to not use $_GET["page"] with include, so people could not include unexpected pages via URL. I was like, yeah, that's kinda obvious. I feel the same way about sql queries.

Re: Nobody cares about your clean code

#94

Earlier quoted context omitted.

When I'm prototyping or hacking something together, it eventually becomes production. I cannot relate to people who make prototypes to throw away, I've never done it, and I don't know why I'd do it. Due to that, I write my first line of code as if it's going to be on production forever, because it will.

Depends on the company environment. If your company does MVP's regularly to trial out stuff or features to get projects funded, they're more than likely will fund a short sprint to prove the concept or idea works and gauge if it's worth fully funding. These orgs move fast, have lots of tech talent and budget. They're usually ahead of other companies in terms of features or offerings. Other companies take ideas, consi…

I did exactly this recently at work. I had a feature set I've been wanting to add to the customer service portal but very little time approved so we built a part of it using very little dev time. The feature was very popular and well used. Everyone wanted it expanded to do more (basically a task system which saves people from ad hoc management of various tasks). Before too long, the full version was approved and was built in very short order because of lessons learned with the mvp.

Re: Nobody cares about your clean code

#95
post #28

Earlier quoted context omitted.

> I cannot relate to people who make prototypes to throw away, I've never done it, and I don't know why I'd do it. When I'm at the prototyping stage, I don't yet know how to solve the problem. That means I need to iterate quickly, which affects my choice of language (Python) and the amount of time I'm willing to spend keeping code clean (very little, because I could hit a dead-end at any point). But once I have a wor…

Is this stealth promotion for Go?

I wish there were a language that I could use for both prototyping and production, but Go isn't it.

Although I have been considering using it for production, it's not what I need in a prototyping language at all.

Re: Nobody cares about your clean code

#96
post #31

I really don't get all the hate towards php, I'm about to put my old blog online and it's written in php. It's a cool language.

It’s because it makes no effort to prevent people doing insanely insecure things. Rails has a lot of safeguards for insecure things like using user input to update a record. PHP won’t even fix bugs due to backwards compatibility. They worked out their sql string escape function didn’t escape properly but instead of fixing it and telling everyone to check their code, they duplicated the function and prefixed the name…

PHP has supported SQL parameter binding for at least 17 years now. It's the standard way to execute SQL queries and it replaces any usage of mysql_escape() or related functions.

It seems your criticism towards PHP is the use of legacy code which is kept for backwards compatibility.

No sane person in the industry writes code like that. Those who do would have had concatenated user input to SQL queries in any language anyway be it Java, C# or whatever fancies your boat.

https://phptherightway.com/#databases

In my view, PHP most glaring problem is the often outdated negative image it carries outside its industry. But that's to be expected when a technology is 25 years old while striving for backwards compatibility.

Re: Nobody cares about your clean code

#97

"throw the first one away" When I'm prototyping or hacking something together, I don't write tests, I don't comment/document much, I use lots of shitty variable/type names, lots of commented out code, debugging printfs, not much organization of files (often one large file). The prototype software is write-once, read-maybe. Maybe I'll want to see what I did down the road, but more likely I'll be shortly rewriting what…

Not a good idea. That is not a good idea of you let anybody in a management role see your prototype.

It will be the product. They will start selling it straight away. If there are any problems, you, my dear young and foolish friend, will be the one at fault. It is your wonderful self that will staying up all hours desperately trying to fix the problems.

Otherwise peachy!

Re: Nobody cares about your clean code

#99
post #97

"throw the first one away" When I'm prototyping or hacking something together, I don't write tests, I don't comment/document much, I use lots of shitty variable/type names, lots of commented out code, debugging printfs, not much organization of files (often one large file). The prototype software is write-once, read-maybe. Maybe I'll want to see what I did down the road, but more likely I'll be shortly rewriting what…

Not a good idea. That is not a good idea of you let anybody in a management role see your prototype. It will be the product. They will start selling it straight away. If there are any problems, you, my dear young and foolish friend, will be the one at fault. It is your wonderful self that will staying up all hours desperately trying to fix the problems. Otherwise peachy!

One of my interns thanked me several years later for what he said was the best advice he ever got from a mentor: learn to recognize when a project is about to collapse under its own weight and get out before it does.

Re: Nobody cares about your clean code

#100
post #31

I really don't get all the hate towards php, I'm about to put my old blog online and it's written in php. It's a cool language.

It’s because it makes no effort to prevent people doing insanely insecure things. Rails has a lot of safeguards for insecure things like using user input to update a record. PHP won’t even fix bugs due to backwards compatibility. They worked out their sql string escape function didn’t escape properly but instead of fixing it and telling everyone to check their code, they duplicated the function and prefixed the name…

[deleted]
Post reply on HN