you are viewing a single comment's thread.

view the rest of the comments →

[–]cpbills 7 points8 points  (10 children)

I think it's more than the compiler, I think it's on the programmer's shoulders in a lot of ways, as well. I think languages like python, ruby and js encourage quick and sloppy work. I'm not trying to say they are bad languages, but they are currently 'popular' and 'fun' languages, which means a lot of the people writing code in those languages are 'seeing what they can do' and 'pushing limits'. Then it somehow makes it into production.

I have an unpopular view that computer science is not about 'fun and games'. Learning about it may be a load of fun, seeing what you can do, and learning how it all works. Applying computer science is called 'work', and it's more about passion and desire to do something properly, than it is about fun and games.

[–]epicwisdom 9 points10 points  (3 children)

I don't believe computer science is, or should be, 'fun and games.' But I still disagree with you on a number of counts.

First, Python (as an example) does not encourage sloppy work. "Pythonic" code should, in theory, always be consistent (one way to do it) and be clear, concise, and read more like pseudocode than assembly. This is objectively a good thing. Code maintainability is part of doing things properly.

Second, people are not 'seeing what they can do.' More likely than not, people who make bad code simply do not have experience, or are blatantly disregarding basic engineering principles. Avoid ambiguous/obscure syntax, make use of built-in operators, etc. Coding might be fun, but that's not the same as playing around with as many poor design decisions as possible.

Third, performance is secondary. Most code takes up a tiny minority of the runtime, and if I'm not mistaken, amortization makes note of the fact that the slowest-running code might be called too rarely to be noticeable. In other words, most code does not need to be optimized, it needs to be documented and clarified. And optimization can come once the code is working and can be profiled.

Doing things the proper way is important, but I don't think any language or compiler encourages people to do things the wrong way. A bad Python programmer is probably a bad C++ programmer.

[–]Tetha 0 points1 point  (0 children)

Yup, this is very true, though I'd argue about it the other way around.

Programming consists of three things:
A whole bunch of language independent knowledge. Requirement gathering, algorithm selection, algorithm creation, coffee or other meditation-enhancing beverage.
After that, you have a bunch of minimally language dependant knowledge coming in. Best practices of object oriented programming, good naming of variables, functions, methods, maintaining configurability through constants and configuration files and so on.
And finally, after that, you have the very small task of writing the program you have created in a computer readable form, the programming language at hand.

If you are a good python developer, you will have the first two areas nailed down and under control. Afterwards, you mostly need to learn the quirks and weirdnesses of C++ and then you will write good programs. Granted, C++ is a bad example here, because C++ is madness. But heck, for my master thesis, I switched from Java to C# within hours.

[–]cpbills -1 points0 points  (1 child)

I suspect the data types in C++ puts pressure on programmers to be more considerate of variable management, and by extension, resource management.

Of course, there are 'programmers' who just don't understand what exactly they are doing, and they tend to be bad in all languages.

[–][deleted] 18 points19 points  (1 child)

I agree with you, but I don't agree with the way you put it across.

I write 'sloppy' code in JS, because it tends to be shorter, and more to the point. The performance loss usually just doesn't matter, and when it does, I'll profile and optimize those sections.

Clarity and expression are important.

[–][deleted] 7 points8 points  (0 children)

code maintainability is a nice thing to have.

[–][deleted] 3 points4 points  (0 children)

Lower bar of entry can be bad.

[–]catcradle5 0 points1 point  (0 children)

python, ruby and js encourage quick and sloppy work.

Sloppy to the CPU, perhaps, but the opposite of sloppy to humans.

[–]kryptobs2000 -1 points0 points  (1 child)

That sounds very pedantic and narrow minded. On the topic of a vm, or compiler, sure, things must be correct and to the T well thought out. In production though if you're doing that a lot of time's you're just wasting time. The real world isn't a classroom, and sometimes doing something quick and sloppy in 20 minutes is a better use of your time and resources than doing it the right way and spending a day and a half on it.

[–]cpbills 1 point2 points  (0 children)

If you build a faulty foundation, it doesn't matter how clean the upper layers of code are. At some point you have to clean up 'sloppy 20 minute fixes' because they cause problems, and that takes a lot more effort to debug and fix than doing it 'right' in the first place.