|
Aleksei Vasiliev posted:PHP added gotos in 2009, actually. For the love of god, bring back pascal as a mandatory educational language PLEASE aarrgghhhhhhh. There is no valid reason to use GOTO ever that does not have as its root cause "Doesn't 'get' structured programming discipline".
|
# ? Apr 20, 2012 05:07 |
|
|
# ? May 14, 2024 10:11 |
|
duck monster posted:For the love of god, bring back pascal as a mandatory educational language PLEASE aarrgghhhhhhh. There is no valid reason to use GOTO ever that does not have as its root cause "Doesn't 'get' structured programming discipline". code:
|
# ? Apr 20, 2012 05:28 |
|
THE PLATFORM MASTER posted:Would you rather the error handling was moved into the loop? There are these things called procedure definitions that allow you to take code out of loop bodies and give them a name, y'know.
|
# ? Apr 20, 2012 05:33 |
|
duck monster posted:For the love of god, bring back pascal as a mandatory educational language PLEASE aarrgghhhhhhh. There is no valid reason to use GOTO ever that does not have as its root cause "Doesn't 'get' structured programming discipline". Oh please. Here's a ladder so you can get over yourself and your paleolithic exhortations. Why shouldn't you use a goto? Because structured control statements are more expressive. When should you use a goto? When the structured control statements in the language you are using aren't capable of clearly expressing the desired control flow for the program. That's it. It isn't any more difficult or complicated than that. On the last page it was definitively shown one case where goto is inescapably the best solution: error recovery and cleanup in C. This clearly evinces a weakness in the language, but that doesn't change the fact that if you're programming in C--either because you want to or because you have to--the right solution is a goto, like it or not. And so if you read Djikstra's paper I think you'll find what he was advocating was expressive control statements. You'll note that more modern languages provide facilities that obviate the need for a goto in this case; RAII or try-finally, for example. Languages evolve and, hopefully, their expressiveness grows. The principles Djikstra advocated are alive and well, and we don't need to brain-damage students by exposing them to Pascal in order to prove it.
|
# ? Apr 20, 2012 05:39 |
|
Internet Janitor posted:There are these things called procedure definitions that allow you to take code out of loop bodies and give them a name, y'know. GOTO is a horror to have in PHP, but it's perfect for many other languages and use cases.
|
# ? Apr 20, 2012 05:43 |
|
You should make your code as easy to understand and maintain as possible. If that means using a goto, then use a goto. Getting religious about it is stupid. Use the tools available to you when they're appropriate.
|
# ? Apr 20, 2012 05:55 |
|
Janin posted:Procedures also introduce lots of overhead in the form of branch mispredictions, poor cache locality, and less effective compiler optimization. Premature optimization something something.
|
# ? Apr 20, 2012 05:55 |
|
Contero posted:I'm not a professional web dev by any means, but why is this such a horror? Because it's not how you might expect it to be parsed at first glance. The start and end tags, <?php and ?> are commonly taught as "start PHP" and "end PHP", with everything else just sent directly down the pipe, with no logic behind it.
|
# ? Apr 20, 2012 06:02 |
|
hobbesmaster posted:Premature optimization something something. I was going to throw the full quote at you and mention how wildly it was being misinterpreted here, but instead I'll just note that the paper in which Knuth used this phrase was Structured Programming with Goto Statements
|
# ? Apr 20, 2012 06:29 |
|
So remember that PHP article I linked a while back? It now has fan art. Take that, other petty language debate articles.
|
# ? Apr 20, 2012 06:59 |
|
duck monster posted:For the love of god, bring back pascal as a mandatory educational language PLEASE aarrgghhhhhhh. There is no valid reason to use GOTO ever that does not have as its root cause "Doesn't 'get' structured programming discipline". From the previously linked lkml thread: quote:From: Linus Torvalds
|
# ? Apr 20, 2012 08:14 |
|
THE PLATFORM MASTER posted:
i'd rather error handling, was, y'know, error handling.
|
# ? Apr 20, 2012 10:53 |
|
Meaning what?
|
# ? Apr 20, 2012 11:38 |
|
Wheany posted:Meaning what? I prefer language mechanisms for error handling over unstructured mechanisms for ad-hoc error handling (where available). In the same way I don't use inline assembly, if there is a clearer way to express something within the idioms of the language, I will use it over a more primitive mechanism. tef fucked around with this message at 11:50 on Apr 20, 2012 |
# ? Apr 20, 2012 11:47 |
|
Basically you always want to use structured control flow. Every time. If the language you're using doesn't natively support the particular control flow structure you want to use, then it's fine to emulate it with gotos.
|
# ? Apr 20, 2012 12:25 |
|
Smash dogmatism while holding high the banner of modularity.
|
# ? Apr 20, 2012 12:39 |
|
Suspicious Dish posted:So remember that PHP article I linked a while back? It now has fan art. Take that, other petty language debate articles. I won't be impressed until I've seen a depiction of the house analogy.
|
# ? Apr 20, 2012 12:45 |
|
Recently, a friend of my ex-gf contacted me about doing some freelance work for him as and when I'm available. He's been running his own software company for a few years, and has built up a number of clients from around the area. Since extra money's always good, and most of the work involves taking an existing project and customizing it via copious amounts of copy/paste, I said why not. Here are the things I can think of off the top of my head that's wrong with this project: - It's in VB6 - They have no source control at all. Although I'm not working at their office, their source control consists of copying their work to a central "server" (i.e. the senior dev's pc) and him burning a dvd every day. Different versions of the source are stored as folders called v1.0.0, v1.0.1, v2.0.0, etc. This also means that all of my work will only be backed up by them when I upload to them - Passwords are stored in plain text - Money fields are stored in the db as floats - All fields in the db are nullable, and there are no foreign key constraints - There are no stored procedures, just direct sql statements in the code - As a result of their source code storage, there is no common code that is shared centrally between projects - each project gets a copy of the source, so if a bug gets fixed in a core file on one project, no other projects benefit from that automatically. Each project is one big .exe and the only references it has is to the OS and other shared 3rd party apps like Crystal and Office. What they typically do when they get a new client/project is they take an existing project that is similar enough to the client's needs, copy the source and db, and customize it. As a result, the project source that I was given to customize has a bunch of forms and tables that have nothing to do with the source project, which the dev forgot to remove when he was customizing that project.
|
# ? Apr 20, 2012 16:11 |
|
Sounds like the exact same thing from the last place I worked, but replace VB6 with PHP. They also made a lot of really arbitrary decisions, like using utf8_bin because it was "more unicodey" than utf8_unicode. (Nevermind the fact that it turned fields in phpMyAdmin into uneditable BLOBs!) duck monster posted:
That was actually a minor name change, but the fact remains that it's the only "function" in that whole mess. (I say "function" because it's actually a mess of if/then/else to choose what "function" to run.)
|
# ? Apr 20, 2012 16:47 |
|
beuges posted:Recently, a friend of my ex-gf contacted me about doing some freelance work for him as and when I'm available. He's been running his own software company for a few years, and has built up a number of clients from around the area. Since extra money's always good, and most of the work involves taking an existing project and customizing it via copious amounts of copy/paste, I said why not. He has no business running a software company.
|
# ? Apr 20, 2012 16:56 |
|
duck monster posted:For the love of god, bring back pascal as a mandatory educational language PLEASE aarrgghhhhhhh. There is no valid reason to use GOTO ever that does not have as its root cause "Doesn't 'get' structured programming discipline". There is an educational variant of Pascal called Turing that my high school offered in grade 9 and 10 programming courses, with Java in 11 and 12.
|
# ? Apr 20, 2012 16:59 |
|
Ensign Expendable posted:There is an educational variant of Pascal called Turing that my high school offered in grade 9 and 10 programming courses, with Java in 11 and 12. I just wish whatever the gently caress borlands latest hate-spawn is now called would loving wake up and offer a hacker friendly delphi or turbo pascal again at a price (or better still freeness) that makes senes. A fully updated object pascal is still a great language that emphasizes type correctness and is dead set all about doing structured and object oriented correctly. And seriously, follow the pascal rules and your code will make sense and be good and chivalrous. The sleep of java has produced monsters. Get off my lawn kids.
|
# ? Apr 20, 2012 17:30 |
|
code:
|
# ? Apr 20, 2012 17:48 |
|
My Python is weak so dumb question alert, but how does that avoid periods? Don't you need to dot into the instance to access the property anyway? Might save on parens...
|
# ? Apr 20, 2012 17:58 |
|
It's defining a new function so you can say foo.picked_by_username instead of foo.picked_by.username. One less period!
|
# ? Apr 20, 2012 18:01 |
|
Oh, I didn't see the dot, I thought it was returning self.picked_by_username.
|
# ? Apr 20, 2012 18:03 |
|
beuges posted:- They have no source control at all. hg init hg add hg commit or git init git add . git commit This is literally how easy it is to have version control these days. You don't have to administer servers (until maybe later if you want to make distribution a bit easier). And this works on Windows and Linux (and I assume Mac) e: And the best part is: You can start using it right now even if the other guys don't want to. Just commit your own changes, copy their files over your files, then commit again. It sucks but way less than not doing it at all. Wheany fucked around with this message at 18:34 on Apr 20, 2012 |
# ? Apr 20, 2012 18:30 |
|
Wheany posted:hg init What, I have to type git commit every single time I make a change?
|
# ? Apr 20, 2012 18:34 |
|
php:<? public function sumitcatagoryAction() { $layout = Zend_Layout::getMvcInstance(); $layout->setLayout('admin/adminajax'); $catid = $this->getRequest()->getParam('catid'); $catname = $this->getRequest()->getParam('catname'); echo 'haha got it'.$catid.' '.$catname; $userilftercat = new Model_DBTable_UserFilterCategory(); if($catid=='parentcatagory' || $catid=='parentcatagorylists') $userilftercat->addcatagory($catname); else $userilftercat->addcatagory($catname,$catid); } ?> It's quickly turning into one of the most hosed situations I've ever seen, and I'm finding myself wanting to build a case for my boss to fire him, which I can't say I've ever done before. There's so many problems with this guy I could start a blog on it, and I've exhausted myself trying to fix it by friendly coaching, fixing the poo poo on my own post-commit, and hardass routes of rejecting his commits and/or belaboring the constant quality problems each time they show up. Some are more effective than others but nothing improves him and I don't have the bandwidth anymore to keep paying attention. EDIT: I will give him a fraction of an excuse on spelling -- english isn't his first language. But really he speaks it just fine and it's more about laziness. I mean, I can understand even something like "catagory"..sort of. But "ilfter" as filter is straight up keyboard diarrhea that he doesn't bother to clean up because he can rely on the IDE to autofill. In another area of code, he had the word "agreement" spelled 3 or 4 different ways all in a 14 line function, just factors of what assembly of letters made it out on the variables and functions that involved the word. Bhaal fucked around with this message at 19:15 on Apr 20, 2012 |
# ? Apr 20, 2012 18:55 |
|
Bhaal posted:
What's terrible about it other than the obvious formatting issues and the "haha got it"? I'm not a PHP guy, but I want to understand how badly this guy sucks for schadenfreude and all that.
|
# ? Apr 20, 2012 18:59 |
|
Ithaqua posted:What's terrible about it other than the obvious formatting issues and the "haha got it"? I'm not a PHP guy, but I want to understand how badly this guy sucks for schadenfreude and all that. I think the point is you should multiply this by someone's entire work product and then imagine having to clean it all up for him because he's too thick to get that he needs to shape up.
|
# ? Apr 20, 2012 19:07 |
|
Ithaqua posted:What's terrible about it other than the obvious formatting issues and the "haha got it"? I'm not a PHP guy, but I want to understand how badly this guy sucks for schadenfreude and all that.
|
# ? Apr 20, 2012 19:07 |
|
He also can't spell for poo poo e: didn't refresh
|
# ? Apr 20, 2012 19:10 |
|
Munkeymon posted:I think the point is you should multiply this by someone's entire work product and then imagine having to clean it all up for him because he's too thick to get that he needs to shape up. It's definitely a place where the guy could improve, but he's not a native English speaker. I wouldn't push to get the guy fired if the code he's writing is otherwise adherent to best practices and functional.
|
# ? Apr 20, 2012 19:11 |
|
It's functional so I guess it's not really a critique of what his code does at runtime. It's more to do that this is representative of what he commits all the time. The spelling mistakes (sumit, catagory, ilfter) are ubiquitous. It's literally about once every 3 lines of code. Mix in his refusal to use camelcase for multi-word variable names and sometimes you are deciphering alphabet soup. Debug comments left into production are par for the course, and so on.
|
# ? Apr 20, 2012 19:13 |
|
Wheany posted:hg init When I asked how they manage source control, he told me about the daily DVD backup thing. I said I'd be storing stuff in my own svn repository regardless (unless they had svn or git or whatever, in which case I'd have used theirs). I offered to host a repo for them on my hosted server if they wanted, but he said he didn't want any of his code on some remote machine somewhere. It's just a very small-minded mentality. He'd rather hire 3 or 4freshly-graduated kids, pay them peanuts, and have them push out copy/paste projects, than one or two more senior guys who will work smart instead of hard, refactor everything (and port it to VB.net at least) and get more projects done quicker. One other thing I just thought of: - They have a reasonable separation of data access from the form UIs, which is good. However, say you're capturing information about a client... you have a client details form, and a client details data class (call it cls_ClientDetails) with properties for each field, to query and update the db. All good. Then, lets say you want a report that prints out a client's details via Crystal. There's an entirely new class called cls_ClientDetails_View, which retrieves the same information, just with only Get properties. Which means that if you add a new field to the form, you have to update two classes in order for everything to work.
|
# ? Apr 20, 2012 19:16 |
|
Bhaal posted:It's functional so I guess it's not really a critique of what his code does at runtime. Ithaqua posted:It's definitely a place where the guy could improve, but he's not a native English speaker. I wouldn't push to get the guy fired if the code he's writing is otherwise adherent to best practices and functional.
|
# ? Apr 20, 2012 19:18 |
|
Bhaal posted:It's functional so I guess it's not really a critique of what his code does at runtime. There's no excuse for sloppiness, but this is one of the things that code reviews really help out with. We had a developer from Myanmar a few jobs ago who was smart as poo poo, but was prone to similar mistakes -- and sometimes, when she forgot an English word, she'd just use variable names like "xxx". Luckily, we had mandatory code reviews for all check-ins, and after getting failed a few times, she shaped up. You don't fix it for him, he has to waste his time fixing it himself. If you fix it for him, he never learns.
|
# ? Apr 20, 2012 19:19 |
|
beuges posted:When I asked how they manage source control, he told me about the daily DVD backup thing. I said I'd be storing stuff in my own svn repository regardless (unless they had svn or git or whatever, in which case I'd have used theirs). I offered to host a repo for them on my hosted server if they wanted, but he said he didn't want any of his code on some remote machine somewhere. That's sane. He wants to make sure that their proprietary code stays within the company. Just use git locally, because you can, and what is he going to do about it?
|
# ? Apr 20, 2012 19:25 |
|
|
# ? May 14, 2024 10:11 |
|
420 SMOKEAWEED posted:That code actually works??? So everything that references that category stuff in the database spells it "catagory"? That's insane. Misspellings in tables & columns are not immune from him. Also controllers and actions and hey, those turn into URLS and those are client facing. It's madness, but it all works because in the IDE you go "$this->xx[arrow][arrow][enter]" and it all lines up! I've done a number of code reviews with him. I started as friendly coach, what I said got ignored and after a few months of that I switched to hardass commit-rejector. He'd fix what I told him to (to the letter, no more) and now I think he tries to avoid me. He's revamping our admin-side UI (we are a SaaS company) with stuff like collapsable navs and fancy bits, and instead of pulling in bootstrap.js like I suggested and all other senior programmers and the CTO agreed, instead he's going with some javascript plugin he found on a blog somewhere. I love this job, it has a million good things going for it, it is a successful startup, and so on. But I'm starting to consider my options. That and it's PHP and I'm sick to death of PHP and don't see any reasonable introduction of python or ruby or whatever into our app, and I don't want to get stuck doing PHP for the rest of my career and it's starting to dominate my work history. EDIT: Ithaqua posted:There's no excuse for sloppiness, but this is one of the things that code reviews really help out with. We had a developer from Myanmar a few jobs ago who was smart as poo poo, but was prone to similar mistakes -- and sometimes, when she forgot an English word, she'd just use variable names like "xxx". Luckily, we had mandatory code reviews for all check-ins, and after getting failed a few times, she shaped up. You don't fix it for him, he has to waste his time fixing it himself. If you fix it for him, he never learns. God now I'm feeling like a dick. Next time we hire I'm going to tell my CTO I want ownership of it. Bhaal fucked around with this message at 19:50 on Apr 20, 2012 |
# ? Apr 20, 2012 19:26 |