| poeTV | Submit | Login   |

Help keep poeTV running


And please consider not blocking ads here. They help pay for the server. Pennies at a time. Literally.

Comment count is 22
chumbucket - 2015-04-15

Between Assembly and Fortran in college, I'd take anything else now.


Bort - 2015-04-15

Glad you linked Python. What in the fuck were you thinking, Guido van Rossum, using white space to indicate nesting? That's like building a car without doors, because a sufficiently careful driver doesn't need them.


Void 71 - 2015-04-15

I'm just a hobbyist who codes games and other fun things with my son, and we both like Python because the strict syntax and mandatory white space makes it easy for us to read and modify each other's code. I haven't the slightest clue what it's like to be a career programmer, but I would think that a language like Python would be really nice to work with since it doesn't leave much room for 'creativity', i.e. unreadable spaghetti code.


fluffy - 2015-04-15

No, Python is still very easy to write spaghetti code in. It's just well-formatted spaghetti.

Also Python's syntax parser makes it really easy to run into weirdness because of no-ops that look like they should do something. Like, in most modern languages, ++i and --i mean to increment or decrement i by one, respectively. In Python, they are no-ops, because there's no increment/decrement operator, unary + is a no-op (to maintain symmetry with unary -, because it's okay in Python's view to say something like +5 as a number even though it's completely useless), and unary operators are allowed to return values that have no effect.

So, ++i parses as +(+i) and --i parses as -(-i), i.e. negate negative i, both of which do nothing (although the second one takes slightly longer to get there), and if you have an lvalue assignment on either one it'll even have an effect - just not the one you expect.

THAT SAID I think Python is one of the best languages for learning with because its syntax is mostly consistent and it's incredibly easy to read. But I think TypeScript is even better these days.


Bort - 2015-04-15

The white space thing is a deal breaker for me. All it takes is a single time where you have an existing block of code that needs to get wrapped in another layer of nesting -- say, because there's a new "if" condition -- and you quickly find yourself wondering what the hell the Python people were thinking.

Leading white space in other languages is irrelevant; there are words or characters to denote the beginnings / ends of blocks. You don't have to manage the white space to maintain program structure, though you may well choose to for clarity to human eyes. And smarter code editors will indent for you based on the beginnings / ends, so the white space not only beautifies but helps you verify your code structure. But you won't run into a case where one or more lines execute unintentionally because you forgot to change an indent.


Oscar Wildcat - 2015-04-15

True that, and a very apt analogy about the doorless car.

That said, I tend to format c type code as follows

if(x)
{
blah
blah
}

Makes it easier to copy and move the blocks around, and it's much more readable. So I can see how this could evolve to just dropping the braces. As you say, you don't _need_ the doors, but they sure can save your ass when you do.


Oscar Wildcat - 2015-04-15

Well fuck me, POETV strips out leading white space. Imagine a tab before every blah....


Bort - 2015-04-15

http://en.wikipedia.org/wiki/Indent_style

Personally I go for Allman Style too. What it costs in vertical space, it makes up for by making it easy to match braces.

Of course, when you've got the braces and you need to add another level of nesting, you don't technically have to adjust the indenting since it makes no compilation difference. Though perhaps your text editor will fix the indents for you, it loves doing that sort of crap ... but without the braces to use as a guide, it can't.


fluffy - 2015-04-16

I use AStyleFormatter to autoformat my code every time I save. Which is easy with languages where the parse tree becomes the format tree (C++, Java, etc.). Not so easy where the format tree becomes the parse tree (Python).

I like tools to make my life easier, not to make it harder for me to make things that work.

That said, indenting an entire block of code isn't that hard in a modern code editor (including Emacs), but the fact you have to decide where the block is is what makes it a pain.

Oscar Wildcat's example is also a perfect case study of why Python is so fragile - posting code snippets to HTML-based forums is a perfect storm of where bullshit happens that's beyond your control (and just replacing leading spaces with   doesn't work because then the browser gives you something that isn't a 0x20 space to paste in, yay more bullshit to deal with).


fluffy - 2015-04-16

Oh, and I do a modified Kernel style, with 4-space indents. I used to prefer putting braces on their own lines but then I realized one-liners are evil and you should always brace everything. More clarity is better. (And again, autoformatting with AStyleFOrmatter et al makes brace-matching errors trivial to pick out.)


fluffy - 2015-04-16

oh I guess my style of choice is 1TBS. Well, nice to know I'm on the winning side of religion for once.


EvilHomer - 2015-04-16

GO OUTSIDE AND THROW A FOOTBALL, YOU GODDAMN NERDS


gravelstudios - 2015-04-16

I've recently gone back to school for IT, and after taking several programming courses, I just found this amusing. His complaints about php are right on the money. I think the whole thing was intended to be rather tongue-in-cheek, though.


Bort - 2015-04-16

I'm going to rush to PHP's defense just a little bit. Yes, it is more or less the retarded love child of C++ and Perl, preserving all their worst features. And PHP is genuinely inspired in introducing bad features, like a boolean type (which is actually a good thing) that in most circumstances can be mixed and matched with integers (ill-advised) and then you have functions that might return either "0" or "false" depending (WHAT IN THE HELL).

But here is the good of PHP: it was built around completing tasks that are not natively simple in other languages. Like suppose your program needs to take a Web page and copy its contents into a variable ... PHP has got a function for that. Really it's madness from the standpoint of traditional language development, and yet PHP's madness comes in handy. It's like a socket wrench kit devised by Dr. Seuss, which you wear on your head and you have to spin around to find the right-sized wrench / socket combo ... but god damn if he didn't also include both imperial and metric bamzooflers that are designed to change the tire on a car just by tapping the yukuffle assemblitoid three times.


fluffy - 2015-04-16

The only thing I like about PHP is that it's really easy to deploy and pretty much universally supported. Everything else about it is garbage, and its ease-of-deployment model is also inextricably linked with one of the major reasons why it's so goddamn insecure by default.

I would much prefer more widespread easy support of something like wsgi and a container-based runtime like Flask or Twisted, rather than all of the weird contortions you have to do to emulate the same thing in PHP (which only makes deployment more difficult without actually giving you any of the security or scalability advantages that a wsgi-hosted container provides).

Of course the entire CGI model is fucking bullshit (great for quick hacks but useless for real applications) and PHP embraces it while making it worse in fundamental ways. And that's not even getting into the many, many problems with PHP as a language (of which there are many).

My "favorite" PHP problem is how it'll aggressively treat strings as numbers wherever possible. For example, the string "123abc" compares greater than the string "2foo" because when comparing them it converts them to the numbers 123 and 2. There is no way to do an actual lexicographical comparison between them.

Oh and I've also been burned by the weird edge conditions like what happens if you do foreach with a reference and then later reuse that same variable name for something else (because references taint things in unpredictable ways). And the lack of block-level scoping makes this even harder to figure out why the fuck a struct at the end of a list has suddenly turned into the number 5.


Bort - 2015-04-16

I'm a strong-typing kind of guy at heart, so I am not fond of PHP being "helpful" with strings either. In the Bortocentric model of the universe, people would program in Pascal or one of its descendants.


gravelstudios - 2015-04-16

As somebody who is still a rather novice programmer, I get the impression that php is very good for a small list of internet specific tasks, but it has been expanded into territory for which it was never intended and it isn't well suited. The courses I'm in right now focus specifically on Java and php with a little c++ thrown in. It's interesting to look at their similarities and differences.


Bort - 2015-04-16

"There is no way to do an actual lexicographical comparison between them."

Turns out there is, the "strcmp" function. That said, having to use a function because the straighforward comparison is unreliable, is hardly something for PHP to brag about. Again, worst features of C++ and Perl, and in this case, Javascript got its DNA in there too. Would not want to watch the movie they undoubtedly made of PHP's conception.


Bort - 2015-04-16

I think you're right, gravelstudio. PHP was apparently built by people who said to themselves, "wouldn't it be great to have a language that made Internet tasks easy". And so that's what they built. And I'll give PHP this much, it does what it was intended to, I think.

I have my frustrations with PHP, but overall I can't complain; it does work when all is said and done. PHP programmers are another matter altogether; they have a reputation for being the worst of the worst, and the reputation is somewhat deserved. PHP is the first language to (inadvertently) push the notion that you, yes you, can program and it won't require an expensive compiler or time-consuming computer science classes. If you can download software from php.net you're good to go! As a result there are an inordinate number of people claiming to be PHP programmers who can, at best, install existing PHP programs or make configuration changes or slap code snippets together and build a Frankenstein monstrosity. Plenty more who don't understand structured code and their attempts at code really show it. I can't blame that on PHP itself so much as its easy accessibility, which you would think would be a blessing.


TeenerTot - 2015-04-16

The only programming language I know is ActionScript. Clinging to a sinking ship.


fluffy - 2015-04-16

If you know AS3 then it's pretty easy to switch over to ECMAScript 5. Learn DOM bindings (which are ridiculously simple) and you're all set to transition into the modern world of HTML5.


ashtar. - 2015-04-16

I know hypercard.


Register or login To Post a Comment







Video content copyright the respective clip/station owners please see hosting site for more information.
Privacy Statement