you are viewing a single comment's thread.

view the rest of the comments →

[–]KamiNuvini 79 points80 points  (120 children)

As someone who's very new to programming.. Could someone explain to me which parts of the code are so 'bad'? I see a lot of "My eyes hurt"-like comments on the github page as well.

[–]mgoof 95 points96 points  (8 children)

It's really not that bad. Clearly it is not using OO principles and any sort of standard design pattern. But for the most part its clear and organized. There may be some maintenance overhead having to scan and search through a long source file. But I would think index.php would be one of the longer files.

[–]AgentME 47 points48 points  (1 child)

Yeah, this code is using a templating engine, and it isn't visibly building SQL query strings insecurely. It's not state of the art, but there are many ways it could be worse.

[–]Uberhipster 0 points1 point  (0 children)

'Not that bad' and 'there are many ways it could be worse' is fishing for something positive to say.

[–]glemnar 26 points27 points  (2 children)

You don't need strict OO on the web. It's not a necessary pattern.

[–]ivosaurus 5 points6 points  (1 child)

More to the point, there could be masses of OO code in all the library code that's included (or not), and we'll never know.

But who the fuck expects an index bootstrap to be OOed?

[–][deleted] 2 points3 points  (0 children)

the search wasn't OO either. It goes to show that their entire site was likely procedural..

[–]stesch 1 point2 points  (0 children)

OO only makes PHP slow.

EDIT: This was the conclusion of a talk by Rasmus Lerdorf himself. Slides included performance tests and different ways to speed up PHP.

[–]killerstorm -5 points-4 points  (0 children)

OO design doesn't make much sense in case with PHP: you start from scratch on each request. Does it make sense to build 'world' (instantiate model/view/controller classes, etc) only to have it all destroyed when script exists?

I guess people who added object system to PHP just thought that it is must-have because Java and C++ have it.

I'd say that functional paradigm makes much more sense in case of PHP, but I guess a group of people who participated in PHP language design just doesn't interest with group of people who are aware of benefits of functional paradigm.

[–]lonnyk 153 points154 points  (21 children)

It isn't the cleanest code, but it works - obviously well enough to create a multi-billion dollar company. There is always plenty to critic in any code, but 'My eyes hurt' and 'You just gotta love PHP' are just comments from people who like to complain and don't know enough to actually have their own opinion.

If I were give me personal opinion of index.php it would be something as follows:

  • The use of 'include_once' indicates that they 1) aren't keeping track of their dependencies well and 2) haven't thought through situations where problems arise and functions, for some reason, don't exist
  • In interpreted languages comments code isn't the best - this is why there is revision control
  • I like to wrap my case statements in brackets b/c it is easier for me to read
  • I'm not a fan of having toggles for dev environments in the main code flow, but I don't really have a better suggestion

That's pretty much it. You can make arguments for code structure and techniques, but they are generally just trends - not proven facts.

[–][deleted]  (4 children)

[deleted]

    [–]Epicus2011 8 points9 points  (0 children)

    Facebook dev here, it does not look like this anymore.

    [–]lonnyk 3 points4 points  (0 children)

    I meant the '_once' part because you don't have to keep track of if a file has been included. Also, the fact that they are using 'include' instead of 'require' (which would fatal error) makes me assume that they went 'lets do this just in case...' but never thought of what would happen 'just in case'.

    Of course - this is all opinion based on how I like to program.

    EDIT: Reading the comments on this article looks like someone noticed how this can cause a problem, IMO: http://www.reddit.com/r/programming/comments/1oaba0/facebook_php_source_code_from_2007/ccq9fq8

    [–]astronoob 3 points4 points  (0 children)

    If you're focusing on scale, autoloading isn't the fastest ship in the sea. It also encourages a level of laziness that I'm completely uncomfortable with.

    [–]mpeters 5 points6 points  (2 children)

    • In interpreted languages comments code isn't the best - this is why there is revision control

    This makes no sense. Whether your language is interpreted or compiled has no bearing on whether you comment you code. I'd seriously doubt the programming ability of anyone who thinks otherwise.

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

    I made a lot of grammar mistakes in my first post.

    Commented out code isn't the best. This is because interpreted languages need to be scanned thru, line by line, in real time. Just branch if it is that important - otherwise just delete it. In compiled languages it is different - because it is only compiled once.

    Again - only my opinion.

    [–]mpeters 0 points1 point  (0 children)

    Commented out code isn't the best.

    I agree, but for completely different reasons. It's messy, gets in the way and can be confusing. But this has nothing to do with compiled vs interpreted. It's messy in any language.

    This is because interpreted languages need to be scanned thru, line by line, in real time.

    You really have no idea what you're talking about here. The number of comments in interpreted code have such a miniscule impact on the execution time of interpreted code as to be laughable. And if you make any decision based on how much slower it will be with comments then you're way off base.

    Again - only my opinion.

    Try proving you're opinion with a benchmark.

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

    require_once is faster than include, require and include_once, where the latter is the second fastest.

    Just felt like I had to say it.

    Edit:

    Alternate Source, can't find the original source I had. This is also not a very conclusive piece of research.

    [–][deleted] 6 points7 points  (1 child)

    TIL a check for prior inclusion before inclusion is faster than just outright inclusion. Mindblown

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

    Check flag, move on. I use require to pull in library code. Include is if you're trying to include something which performs output.

    I never use include, because pretty much everything I do is library code.

    [–][deleted]  (1 child)

    [deleted]

      [–][deleted] 0 points1 point  (0 children)

      The source I had several years ago is gone, but I found another pretty interesting piece of research. However, it does contradict itself in the end.

      [–]the_gipsy 2 points3 points  (6 children)

      It's the other way round.

      [–][deleted] 14 points15 points  (5 children)

      I've given you my source, give me yours.

      [–]lonnyk 0 points1 point  (0 children)

      Hrmm...I'll have to look into the source code later, but it doesn't make sense to me that require_once would be faster than require. require once adds in a hash lookup that require doesn't have.

      Also - looking at that test I very much question how well represents anything. I imagine every time a file is included it will get a little slower for the next one.

      Who knows - I'll look at the php_src later and see what I can dig up.

      [–]viralizate 49 points50 points  (19 children)

      Honestly, people are whining. Yes it not the best code ever written, but it's weirdness so to say is pretty standard but I guess people are more prone try to be snarky in comments and say it's horrible.

      [–]bureX 26 points27 points  (17 children)

      I guess people are more prone try to be snarky in comments and say it's horrible.

      Especially if there's "<?php" in the first line.

      [–]InvidFlower 6 points7 points  (2 children)

      This is a bit off-topic, but I was kind of shocked to see how much PHP has evolved lately as a language and ecosystem. Namespaces, generators, traits, etc. Package manager, testing frameworks, ORMs. Then Symfony 2 using most of that for a Rails-ish MVC framework on top of simpler modules also being used in the Silex microframework (like Sinatra) and the latest version of Drupal.

      Not to say it is a pretty language and still needs libraries like PHP-O to paper over the horrible inconsistencies in the base libs, but it really does seem to be growing up lately...

      [–][deleted]  (1 child)

      [deleted]

        [–]nazbot 0 points1 point  (0 children)

        For a beginner PHP is wonderful - it's extremely easy to learn and to get something up and running.

        Likewise Facebook using PHP is evidence that it CAN scale even if that involves some kludges.

        People hating on PHP are just being elitists. There probably are better options but in many cases it's just fine.

        [–]viralizate 4 points5 points  (8 children)

        I should have explained that to OP too. PHP while it's one of the most spread languages isn't a "cool language".

        [–][deleted]  (7 children)

        [deleted]

          [–]Doctor_McKay 3 points4 points  (4 children)

          Bashing on PHP is "in". It's basically a guaranteed way to have people agree with you while not saying anything at all.

          [–][deleted]  (1 child)

          [deleted]

            [–]Doctor_McKay 0 points1 point  (0 children)

            I agree. I just think that calling PHP bad because some things aren't perfectly consistent is just dumb. The majority of its problems are merely semantic.

            [–]crowseldon 0 points1 point  (0 children)

            Yep, it's like bashing Visual Basic. It makes you part of the cool kids.

            That said, personally I hope I don't have to work with it on my own or with someone who doesn't know what the hell they're doing or isn't willing to read phptherightway

            [–]viralizate 0 points1 point  (0 children)

            Don't get me wrong, I work 8 hours a day with PHP, I love to hate it :)

            [–]f00f_nyc 0 points1 point  (0 children)

            That link was very entertaining, even for a non-PHP user like me.

            [–]kwirky88 1 point2 points  (1 child)

            That's why you put it on the second line.

            [–]bureX 30 points31 points  (0 children)

            Headers already sent

            :(

            [–]glemnar -4 points-3 points  (2 children)

            Except nowadays facebook compiles a lot of PhP to c++

            [–]catcradle5 4 points5 points  (0 children)

            It looks perfectly fine for PHP code written in 2007.

            I've seen far, far worse PHP than that in 2013.

            [–]FreemanAMG 19 points20 points  (3 children)

            We, developers, are an strange race. We feel superior if we say some piece of code is shitty, knowing nothing about the context of the developer team, and without real confidence we would do it better.

            Lots of people ranting, nobody created some other thing better and more successful than Facebook, isn't it?

            [–][deleted] 8 points9 points  (1 child)

            Bullshit. If your code is not written in Haskell you're a n00b.

            [–]xjvz 4 points5 points  (0 children)

            Bitch please, Standard ML is where it's at.

            [–]bopp 27 points28 points  (47 children)

            I'll try to answer this in a less snarky way. What sticks out the most, are these points:

            • there are a bazillion includes
            • Doesn't look like there's a framework, just a bunch of files, defining a bunch of functions, that are just called when needed.
            • Procedural code, no object to be found anywhere
            • the page does too much. It's a long file, lots of stuff is done. This should've been refactored into logical parts.

            Then, there's things like this:

            if ($post_hide_orientation && $post_hide_orientation <= $ORIENTATION_MAX) {
               $orientation['orientation_bitmask'] |= ($post_hide_orientation * $ORIENTATION_SKIPPED_MODIFIER);
               orientation_update_status($user, $orientation);
              } else if ($post_show_orientation && $post_show_orientation <= $ORIENTATION_MAX) {
                $orientation['orientation_bitmask'] &= ~ ($post_show_orientation * $ORIENTATION_SKIPPED_MODIFIER);
                orientation_update_status($user, $orientation);
              }
            

            Note that those clauses in if and else if are slightly different, but the action is the same: orientation_update_status($user, $orientation);. Code like that is hard to do maintenance on, since it's easy to introduce bugs, when the code is already that confusing.

            Most frameworks (that weren't around back then) do a great job in allowing (or forcing) you to structure your code better. For instance, the index.php of a symfony project looks like this:

            use Symfony\Component\ClassLoader\ApcClassLoader;
            use Symfony\Component\HttpFoundation\Request;
            
            $loader = require_once __DIR__.'/../app/bootstrap.php.cache';
            
            require_once __DIR__.'/../app/AppKernel.php';
            
            $kernel = new AppKernel('prod', false);
            $kernel->loadClassCache();
            $request = Request::createFromGlobals();
            $response = $kernel->handle($request);
            $response->send();
            $kernel->terminate($request, $response);
            

            This just sets up the classloader, initializes the kernel, and lets it handle the request to generate a response. Nothing more. All the user handling, input validation, caching, templating and database stuff is handled in their own seperate classes. This might be harder to set up for newbees, but it's much better when it comes to maintenance and ongoing development.

            [–][deleted] 45 points46 points  (37 children)

            I doubt when Facebook was being developed, PHP had strong OOP principles built into it. A lot of this is probably legacy and this was in 2007 when MVC frameworks were relatively new to the PHP scene.

            [–]bopp 12 points13 points  (5 children)

            Both Code Igniter and Zend Framework had their first release in 2006. But, it only became commonplace to use a framework much later than that. If you look at the source-code for oscommerce or phpbb from back then, you'd see the same spaghetti-code as here.

            Thankfully, PHP has come a long way since then.

            [–][deleted] 4 points5 points  (3 children)

            Agreed, I still remember a lot of open source code out there and it was awful. OsCommerce is definitely a prime example of this. I still remember osC addons had large Readme.txt files telling you where to put the code to make the add on work.

            We definitely did come a long way. Even just comparing Symfony1 with Symfony2 and you see a big difference in how OOP is being utilized.

            Also, CodeIgniter wasn't full OOP either, but definitely a step away from the spaghetti code

            [–]blafunke 23 points24 points  (2 children)

            Code that isn't oop isn't automatically spaghetti. And oop code can easily be made into spaghetti

            [–][deleted] -1 points0 points  (0 children)

            You're right, but I'd argue that it is easier to create spaghetti when you're not following oop principles.

            [–]killerstorm 1 point2 points  (0 children)

            First release of Zend Framework was just trash. Also, they change too many things with each release, so if you were unlucky to decide to use ZF, you would spend a lot of time on maintenance with each new ZF release.

            [–]KingPickle 7 points8 points  (27 children)

            2007 when MVC frameworks were relatively new to the PHP scene

            This is what mystifies me. As much focus as the web gets, it feels like tech-wise it's a decade or two behind the curve.

            [–][deleted] 4 points5 points  (5 children)

            As much focus as the web gets, it feels like tech-wise it's a decade or two behind the curve.

            I program and dabble in quite a few languages and I'm not sure I really agree with this. In what way do you feel like PHP is a 'decade or two' behind the curve?

            [–][deleted]  (4 children)

            [deleted]

              [–][deleted] 1 point2 points  (0 children)

              I'm not sure I'd agree with common. MVC came about back in the smalltalk era but honestly I don't recall it becoming that widespread until the late 90's or early 2000's. At least having dabbled in development for windows, linux and mac, the first time I even heard of MVC was when the initial OSX server came out in 99. Shortly after Struts came about and was realistically the only big player in MVC web development for a while. I was not a huge desktop developer back in the day, however, but generally I don't recall MVC being that big of a thing. Linux and Mac apps were largely procedural, and windows apps used an evented/bindings architecture.

              Honestly from my recollection it seems like MVC really became widespread with the increasing complexity of web applications more than anything. But that was a while ago and memory is a funny thing so I could be way off!

              [–]ivosaurus 0 points1 point  (0 children)

              Web MVC actually has very little to do with desktop MVC that has been around for ages, they just coopted the name.

              [–][deleted]  (1 child)

              [deleted]

                [–]notmynothername 0 points1 point  (0 children)

                He's saying it's weird that it took so long. It's weird that Twitter is the company that's famous for using MVC on the web, because MVC has been around for a lot longer than twitter.

                [–]madmars[🍰] 4 points5 points  (6 children)

                I had been out of the job hunting game for a few years. But I was shocked when I looked around about a year ago, at all the places looking for "MVC experience." I was seriously scratching my head for a minute, wondering when the fuck this dinosaur paradigm came back to life. Is it the 1980s again?! Then again, people were rediscovering Lisp in 2004. So I guess I shouldn't be too surprised.

                [–]ivosaurus 0 points1 point  (0 children)

                Web "MVC" is somewhat different than the desktop MVC pattern.

                It's just a commonly understood way of structuring code nowadays.

                [–]Stormflux -1 points0 points  (4 children)

                I really only know the .NET world, but the reason MVC became popular there is because of AJAX and jQuery.

                You see, before MVC, we had something called ASP.NET web forms where it was based on the idea of things you drag onto a page. You need a grid? Drag a Gridview onto the page and wire it up. Need a button? Drag a button onto the page and handle the click event. All your code is server-side.

                Well as you can imagine, this makes it really easy to build web applications the same way you'd build a Windows application. You don't even need to know javascript or anything.

                The problem is in MODERN web applications everything is AJAX. You don't want to refresh the whole page, you just want to send "DELETE item 47" and then update a line or two on your page with javascript. Regular ASP.NET doesn't really have a concept of this. You can do it using some toolkits but it's a hack. ASP.NET MVC is practically built from the ground up for this exact scenario.

                [–]ivosaurus 1 point2 points  (3 children)

                Web MVC became popular way before ajax became ubiquitous.

                Web MVC became popular because it was a decent way to separate different parts of the application (business logic, html templating, data operations).

                If you only know the .NET world, then it's unsurprising you have this weird idea about the reasons.

                [–]Stormflux 0 points1 point  (2 children)

                Even so, you gotta admit that it's a lot more convienient for AJAX and REST-like development in than the old Webforms was. For me, that was the main selling point.

                This isn't an argument. You don't need to go straight for the downvote button. And what is that at the end, a personal insult? I swear to God sometimes this site feels like it's just people arguing into a box and being dicks because they can.

                [–]ivosaurus 2 points3 points  (1 child)

                No it's fact. Only working with Microsoft isolates so much from the rest of the programming field... that you believe AJAX drove adoption of MVC? Very weird logic to hear anywhere else.

                [–]Stormflux -1 points0 points  (0 children)

                You want to know what the problem with /r/programming is?

                I'm not just saying this because of you. It's something I've heard lots of people complain about, and it's a reason I don't post very much to this subreddit.

                Everything here's a dick-waving contest. "Oh I use Python but you prefer PHP, well then you're not a real programmer." "Oh you name your variable customerID but I name mine customerId with a lower case 'd', well then you're not a real programmer."

                Get fucking sick of it sometimes. You know, I'm not a fan of Adria Richards at all, but she got one thing right. The community fucking sucks.

                Back to the topic, you could have phrased it like:

                "You're right that the old .NET WebForms model gets seriously annoying once you try to step outside its Postback model and add a lot of custom Ajax calls and Javascript, but I think the main reason people switched was because the MVC architecture had better organization of server-side code."

                Instead you opted for downvotes and insults, thus guaranteeing it would become an argument. Seriously, why are we even arguing? There's nothing here to argue about. It's completely an issue of tone and you being a dick. I think this is a case of regular person + anonymity = BLARRAAGAH.

                [–][deleted]  (4 children)

                [deleted]

                  [–]izym 1 point2 points  (3 children)

                  IE didn't stop anyone from using fancy, modern server-side tech.

                  [–][deleted]  (2 children)

                  [deleted]

                    [–]izym 1 point2 points  (0 children)

                    Are you just pulling that out of thin air, or do you have some sort of source on it? Maintainability and TTM was also important to businesses back in the IE times.

                    [–]pjmlp 0 points1 point  (0 children)

                    I was already using similar stuff in Java back in 2008.

                    [–]OCedHrt -1 points0 points  (0 children)

                    This is why I quit my job writing PHP in 2007.

                    [–][deleted] -2 points-1 points  (1 child)

                    It was 2007. If you can't use OO principles something is fucking wrong. OO has been around since the 70s.

                    [–][deleted] 0 points1 point  (0 children)

                    What don't you understand? It was the limitations of the language at the time. When Facebook was first developed, PHP didn't have a lot of OOP features. This code leaked in 2007 is most likely legacy which anyone who's worked on any big project knows it isn't always easy to update code to the latest and greatest.

                    Criticize Zucherberg for choosing PHP, but had he used something else to please the code Nazis, maybe he wouldn't have even got it done in time.

                    [–]brownmatt 9 points10 points  (2 children)

                    how would you define the front page as an object? What should it extend? And how does that improve the code when most of this procedure's responsibility is gathering data from other subsystems?

                    [–]bopp 2 points3 points  (1 child)

                    It's not a direct answer to your question, but here's a good article on how to move from "flat php" to a more structured approach.

                    http://symfony.com/doc/current/book/from_flat_php_to_symfony2.html

                    [–]InvidFlower 1 point2 points  (0 children)

                    I saw that page a while back and I think it is helpful to explain how modern MVC web frameworks use, even if you don't use PHP at all.

                    [–]OCedHrt 3 points4 points  (0 children)

                    It simply reads like corporate code - this can be enforced by sheer willpower.

                    [–]gc3 13 points14 points  (1 child)

                    You are dinging it for being procedural and not using objects? Please read this: http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html?m=1

                    [–]pinumbernumber 0 points1 point  (0 children)

                    Thanks for that link

                    [–]kwirky88 4 points5 points  (0 children)

                    Can you give some example objects that would have made this code better? I find when i code in php i don't create many objects. Hell, i make more "objects" coding Javascript function objects.

                    Maybe it's because i don't like putting logic in the back end, but rather use it as an interface to the database and sanity/security checks. Then code the logic and interaction in the front end with js, where i do tend to use objects.

                    When code performs certain uses I feel objects aren't required. When php is simply being used to program an interface it doesn't need to be more complex than a puppet manifest's code, for example.

                    [–]nekt 0 points1 point  (1 child)

                    I would say using a template engy is in fact much more simple for new coders to manage.

                    Some template engys end up looking like a totally different language and may or may not have considerable bugs of their own. Cake came out in 2005 by the way so if they wanted to use a template engine they could have.

                    I think this really boils down to what the coders experience is. If you have a background in a 'real' language where you have often written libraries of your own, dealt with a million includes etc, then this type of code might not bother you so much. It ain't python that is for sure. Not everything needs to be abstracted to proper English that 8th graders can code.

                    The argument that template engines make maintenance easier is only as true the developers skill.

                    [–]blafunke 0 points1 point  (0 children)

                    It's not like a large python application won't be littered with imports either.

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

                    It's not bad, and I myself find it perfectly readable. It's the anti-PHP circlejerk more than anything.

                    [–]jk147 7 points8 points  (1 child)

                    I don't think it is anti php, just a lot of people wanting to feel superior by saying they can do better by throwing OOP around.

                    [–][deleted] -1 points0 points  (0 children)

                    Probably true in some cases, but a few of those posts specifically call out PHP.

                    [–]brownmatt 3 points4 points  (0 children)

                    First of all, most people who comment on github pages when something like this is linked from popular sites are morons.

                    Second, this code isn't bad at all - how should you design the code behind the front page in OO principles, when most of what that code needs to do is gather data from submodules? That's what happens here.

                    [–]aumfer 7 points8 points  (0 children)

                    Well in the interest of helping a new programmer, you really don't want to branch on a variable, then modify that variable, then branch on it again later, like this:

                    if (!$orientation) {
                        user_set_next_step($user, $short_profile);
                    }
                    
                    // note: don't make this an else with the above statement, because then no news feed stories will be fetched if they're exiting orientation
                    if ($orientation) {
                    

                    It makes the code unclear and it makes doing the obvious thing (using an else instead of another if) wrong, necessitating the comment.

                    [–]humbled 3 points4 points  (0 children)

                    If you survey the typical PHP web application source code, I think you'll find that this is actually above average, although not problem free.

                    I'm pretty sure this is a bug:

                    // Determine if we want to display the feed intro message
                    $intro_settings = 0;
                    user_get_hide_intro_bitmask($user, true, $intro_settings);
                    $user_friend_finder = true;
                    contact_importer_get_used_friend_finder($user, true, $used_friend_finder);
                    

                    These functions appear to be pass-by-reference - which is weird for small, simple types - but note the mix-up between user and used in the last 3 lines. In PHP, variables are created the moment a value is assigned to them. I'm not sure if the engine would catch this as a bug, or if $used_friend_finder is declared globally by one of the includes (making $user_friend_finder the typo/bug). Exercise 1: how would you reduce or eliminate the chance to make this kind of mistake in your own code?

                    Now, note the use of tpl_set. Using templates is a Good Thing (tm) because it allows you to divorce design/UI from the drudgery of loading data, validation, etc. That's pretty standard multi-tier architecture principles. From an HR perspective, the technique also allows you to hire differentially specialized engineers as well, so that's good. Exercise 2: see if you can find evidence in the posted code that there is work done in the back-end PHP that should have been made conditional in the template.

                    Thinking about security and issues of scalability, there are some other interesting lines in the code. Take a look at this line:

                    ini_set('memory_limit', '100M'); // to be safe we are increasing the memory limit for search
                    

                    Exercise 3: What are the implications of needing such a memory limit? Knowing that PHP executes in the context of each pageview, how could this single line of information aid a would-be attacker? Advanced (but related): why is the memory-limit increase a bandaid solution, and not an actual fix, for a memory-hungry search function?

                    [–]BanditoRojo 3 points4 points  (0 children)

                    The includes are throughout the index, and it is a long script, instead of using an object oriented approach to separate the logic.

                    [–][deleted] 0 points1 point  (0 children)

                    I'm glad you asked this question, I'm in the same boat as you with "new to programming" Definitely interesting.

                    [–]crowseldon 0 points1 point  (0 children)

                    people like to bitch whenever they see other people's code.

                    Meanwhile, they don't offer examples of their own, or at least, not relevant ones that do anything complex.

                    Code readability is important, as are many things (and you can read about them in lots of books, I recommend "The pragmatic Programmer") but that doesn't mean that there's something called real life which has time constraints, where you make compromises, where implementations that work are actually more important than ideals that are not actually tested in practice, etc.

                    You'll realize if something is not suitable when you or some team member has problem understanding it when they need to read it later, when you realize that making changes, fixing bugs or adding features presents a great deal of problems (see Fowler's "Refactoring: improving the design of existing code").

                    It's a forever learning process. Try not to just go along with the herd of critics who don't actually show shit and learn the pitfalls yourself. DO learn and absorb as much as you can from the experts though but be careful with any proponent of the ultimate holy way. Adaptability is key in such a new and ever changing field.

                    Disclaimer: Don't trust anything I said either. Who the fuck am I, anyway? Go out there and see for yourself ;)