Thread: The only problem with simultaneous front- and back-end development is...

  1. #1
    Registered User MutantJohn's Avatar
    Join Date
    Feb 2013
    Posts
    2,665

    The only problem with simultaneous front- and back-end development is...

    The only problem with simultaneous front- and back-end development is I'll be writing a PHP script and write :
    Code:
    var dir_name = $_POST[ "dir_name" ];
    and for the life of me, I won't be able to figure out why my PHP won't work.

    *sigh*

    How many more times is this going to happen before I finally realize what I'm doing? XD

  2. #2
    Registered User Alpo's Avatar
    Join Date
    Apr 2014
    Posts
    877
    Quote Originally Posted by MutantJohn View Post
    The only problem with simultaneous front- and back-end development is I'll be writing a PHP script and write :
    Code:
    var dir_name = $_POST[ "dir_name" ];
    and for the life of me, I won't be able to figure out why my PHP won't work.

    *sigh*

    How many more times is this going to happen before I finally realize what I'm doing? XD
    I'm constantly doing that too. I switch between JavaScript and C++ pretty regularly and will do things like this:

    Code:
    int add (num1, num2) {
        sum = num1 + num2;
        return sum;
    };
    Also I started to write some stupid functional code in C++ using filter iterators and callbacks like you would do in JS :

    Code:
    void Level::update () {
    
        Level::forEachMatch(isObjectLayer, [] (const Shared_Layer& layer)->bool {
    
            layer->forEachMatch(Layer::isGravity, [] (const Shared_Object& obj)->bool {
    
                obj->addForce(getGravity(obj));
    
            });
    
        });
    
    }
    
    // Predicate functions :
    
    bool Level::isObjectLayer (const Shared_Layer& layer) {
        return layer->getType() == Layer::LAYERTYPES::OBJECTLAYER;
    }
    
    // ..
    
    bool Layer::isGravity (const Shared_Object& object) {
        return object->getReactionFlags() & Object::REACTIONTYPES::GRAVITY;
    }
    I ended up giving up on this 'forEach' model because it was too confusing to try and manage the captured scope when nesting deeply, plus there is probably a performance hit over normal filtered iterating.

    I still like the idea, I just haven't worked everything out lol. Edit: The point I'm trying to get at is that knowing different languages actually seems to influence how I want to do things, rather than just what I'm doing, if that makes sense.
    Last edited by Alpo; 08-27-2015 at 06:02 PM. Reason: what is keyboard?
    WndProc = (2[b] || !(2[b])) ? SufferNobly : TakeArms;

  3. #3
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Quote Originally Posted by MutantJohn View Post
    How many more times is this going to happen before I finally realize what I'm doing? XD
    Don't worry. It's not just you that are confused. We all are, as to why you insist in coding in PHP.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  4. #4
    Registered User MutantJohn's Avatar
    Join Date
    Feb 2013
    Posts
    2,665
    Quote Originally Posted by Mario F. View Post
    Don't worry. It's not just you that are confused. We all are, as to why you insist in coding in PHP.
    Oh, that's a slam. That's slam-tastic. You just took me to Denny's for a Grand Slam. You just put me in the slammer.

    Lol I'm having fun.

    But on a more serious note, why would I use something else? I can write PHP in my HTML​. How neat is that? Plus, it integrates so well with Apache!

  5. #5
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    A lot of other things integrate with Apache. You are just unfortunately another victim of the big mistake that was (L/W)AMP.

    But to clarify I'm not an activist. I don't hold any particular anti-PHP point of view. It was an important language in its time and shaped the web in ways that where needed. But it *was*. We have today better designed and better scaled languages for server-side development. So I was hoping that instead of gaining new users, PHP would actually start losing them.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  6. #6
    Registered User MutantJohn's Avatar
    Join Date
    Feb 2013
    Posts
    2,665
    Oh. In that case, what do you recommend?

    Edit : I've tried Node.JS and it didn't blow my socks off. Sure, I could make a chatroom app in like 30 minutes even with a tutorial and complete ignorance slowing me down but I wasn't impressed. Python looks like it sucks for making a directory. Compare PHP's mkdir() to doing the same in Python. To me there's no contest.

    Perl looks okay, I guess, but I'd rather just use PHP instead of Perl.

    Edit edit : Though one thing I loved about Node.JS was its support for WebSockets. Like, you can use the Node package manager to install the Socket library and it actually works. I've been looking for that kind of functionality and I'm happy it resides in Node.JS and the npm but at the same time, other aspects don't excite me as much.

    I also think the constant use of callback functions does indeed lead to the "callback hell". Hmm... So many decisions... Maybe JSP would be a good choice?
    Last edited by MutantJohn; 08-27-2015 at 09:34 PM.

  7. #7
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    2,158
    Quote Originally Posted by MutantJohn View Post
    I also think the constant use of callback functions does indeed lead to the "callback hell". Hmm... So many decisions... Maybe JSP would be a good choice?
    If you're looking for Node.js minus callback hell, check out IcedCoffeeScript.

  8. #8
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    How many more times is this going to happen before I finally realize what I'm doing?
    O_o

    I've thrown more braces at more Python than I am willing to admit.

    I still like the idea, I just haven't worked everything out lol.
    o_O

    You can implement a `forEachMatch` mechanic as performing combinations using a handful of proxy classes.

    Code:
    match(isObjectLayer).match(isGravity).forEach([] (const Shared_Object& obj)->bool {
        obj->addForce(getGravity(obj));
    });
    You only need to package a more advanced form of the filtering iterators we've already discussed such that the `<???>::match` of the proxy implements the desired combination.

    Code:
    template
    <
        // ...
    >
    class SIteratorFilter
    {
        // ...
    };
    Code:
    template
    <
        // ...
    >
    class SMatch
    {
        // ...
        SIteratorFilter</* ... */> begin()
        {
            return(SIteratorFilter</* ... */>(*this, PredicateAnder</* ... */>, *this));
        }
        SIteratorFilter</* ... */> end();
        // ...
        SMatch</* ... */> match(/* NewPredicate, ... */)
        {
            std::vector</* Predicate */> s(m);
            return(SMatch</* ... */>(s.push_back(NewPredicate)));
        }
        // ...
        std::vector</* Predicate */> m;
        // ...
    };
    Code:
    template
    <
        // FIterator
        // FPredicateCollection
    >
    bool PredicateAnder(/* ... */)
    {
        // reverse depending on usage
        // for c in anFPredicateCollection if c(anFIterator) return true
        return(false);
    }
    The point I'm trying to get at is that knowing different languages actually seems to influence how I want to do things, rather than just what I'm doing, if that makes sense.
    The source of the influence is more the different ways you can express your ideas.

    Maybe JSP would be a good choice?
    O_O

    How did Yarin not comment on the JSP part?

    Soma
    “Salem Was Wrong!” -- Pedant Necromancer
    “Four isn't random!” -- Gibbering Mouther

  9. #9
    Registered User MutantJohn's Avatar
    Join Date
    Feb 2013
    Posts
    2,665
    I swear to God, phantom, we both use C++ but every time I look at your code it feels like we're using a totally different language O_o

    I know you're a good programmer and way more experienced than me so I desperately want to understand your code but every time I look, I'm just like, "lol wut?"

    Man, I thought traits and stuff were as hard as C++ gets... Guess not...

  10. #10
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    I don't feel comfortable recommending a web development platform. I don't do web development for customers anymore. Only internal stuff. This means that I'm free to choose an option and ignore the rest entirely. So, for instance, I never tested or cared for Node.JS, not knowing whether it is actually any good.

    But, from my experience, Python is the way to go if you which a portable open-source community driven web development platform. Python with the Django framework is the best option for quick development of scalable web solutions these days. And I'm not sure what difficulties you are getting with python to make a directory. Something so simple as that may be a clue that you are probably making something wrong.

    An added advantage of Python is that it binds very well to numerous user-level languages (including, of course, python). So a knowledge of Python allows you to create a development environment where C++ and Python can coexist nicely, for instance. Also, for more close-to-the-metal server-side code, you may wish to go with Pyramid or Flask frameworks for python. A concept that PHP won't offer you.

    An alternative to community-driven web development platforms is Ruby on Rails. I hear also good things from it. But I don't know anything about Ruby.

    As for proprietary solutions, the rage is apparently ASP.Net. It allows you to leverage C# and Javascript and it is quite a good development environment. Easy to learn, easy to use and quite powerful. But you are bound to Microsoft whim and moods on how they want to see their web development tools evolve and you ask asking your customers to stick to a commercial operating system with the exclusion of anything else.

    EDIT: Of course, there's PHP. Your present choice. Still a viable option for server-side development. But that's a sinking ship. And it's not wise, when trying to come up with a programming career to place your bets on sinking ships. I've seen languages drop their job offerings dramatically in the span of a single year. And if (when, is more appropriate. The writing is on the wall) that happens with PHP you will be left with the problem that you cared for nothing else in the meantime.

    EDIT2: I know you are just having fun. But I also know you are serious in your attempt to make a career of programming. So my advice: don't make fun of programming. Be careful. The job market today in this area is ruthless and will spit you out without a care in the world.
    Last edited by Mario F.; 08-27-2015 at 10:57 PM.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  11. #11
    Registered User MutantJohn's Avatar
    Join Date
    Feb 2013
    Posts
    2,665
    Interesting...

    What do you mean by "don't make fun of programming"?

    <Edit>

    If this was about the code phantom posted, I wasn't trying to "make fun" of anything. Like, I think there's a lot to learn there and I do want to learn it but I'd require more explanation.

    I was, however, trying to poke fun at how esoteric it looked to someone who is more of a C++ newby. To me, something like a traits class is this weird mind-bending abstraction while to him, he probably knows how to actually make one.

    If I came off as a douche to you, Mario, or to you, phantom, I apologize. It's been... an interesting night for me... Don't get married, kids.

    </Edit>

    And I stopped being so hard on Python. I hate that I have to include an "os" module but it seems like it offers the same supported features so maybe I was a tad hard on it. I think at times I can be a tad scared of the future and that's a fault of mine as a developer. *sigh* I'm sorry.

    But the more I read about Node, the more I think it's going to be the language I choose... It also seems like I don't need to rely on Apache anymore either. I used tutorials yesterday that had me writing a HTTP server in Node. Like, what? What?! Plus, that web socket support, man. But now I'm wondering, how do I make the Node HTTP server work through a real DNS? Huh... I guess it's just like Apache in the sense that it's a process listening on a port and awaits a socket connection so it should be no different... How do I make my web server publicly visible?

    *sigh*

    The future freaks me out...

    I MISS MESHING!!!
    Last edited by MutantJohn; 08-27-2015 at 11:43 PM.

  12. #12
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    I swear to God, phantom, we both use C++ but every time I look at your code it feels like we're using a totally different language
    O_o

    I always work to simplify the expression of my code so as to be more palatable to other people before I post.

    You've never actually seen my code.

    I know you're a good programmer and way more experienced than me so I desperately want to understand your code but every time I look, I'm just like, "lol wut?"
    A lot of the C++ code I post which isn't the expected flavor is just an expression of techniques learned in other programming languages.

    The fastest way to learn my C++ would be studying languages that do not readily express the techniques with which you are already familiar.

    Man, I thought traits and stuff were as hard as C++ gets... Guess not...
    The traits you are referencing are just the foundation.

    A trait is really just the condition of branches evaluated during template expansion.

    If this was about the code phantom posted, I wasn't trying to "make fun" of anything.
    I think the statement was a warning. The market for programmers is, as stated, ruthless. If you really want to "make it", you probably need to give programming for fun a pass; you should be programming to develop your skills if you plan to sell those skills.

    I don't necessarily agree, but my interpretation may simply be wrong.

    Soma
    “Salem Was Wrong!” -- Pedant Necromancer
    “Four isn't random!” -- Gibbering Mouther

  13. #13
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    27,750
    Quote Originally Posted by MutantJohn
    I can write PHP in my HTML​. How neat is that?
    Considering the work that some template engine and framework authors put in just so they can avoid using PHP as a template language...

    Quote Originally Posted by MutantJohn
    And I stopped being so hard on Python. I hate that I have to include an "os" module but it seems like it offers the same supported features so maybe I was a tad hard on it.
    O_o

    You were not a "tad hard" on Python; you are being irrational.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  14. #14
    Registered User MutantJohn's Avatar
    Join Date
    Feb 2013
    Posts
    2,665
    That's fair, laser. I apologize.

    Moving on, is it not possible to code something fun that also develops my skills? I think project selection is very key here. If something is impractical, it better improve skills.

  15. #15
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Quote Originally Posted by MutantJohn View Post
    Moving on, is it not possible to code something fun that also develops my skills?
    Phantomotap got it. My meaning was more or less what he thought it was. But I don't mean you shouldn't have fun. Programming can be an emotionally rewarding task. It often is. Instead, I mean you should be more practical about your core decisions and not let fun factor much into it. And one of those core decisions is what languages you should invest your time and your future in.

    Quote Originally Posted by MutantJohn View Post
    I think project selection is very key here. If something is impractical, it better improve skills.
    I wouldn't think so. Almost every incomplete personal project of yours on some solution no one cares about, is still going to help you gain new skills or hone your existing skills. Programming is a continuous learning process and you will remain a "student" for all your career. I will remain forever in awe as to how sometimes even the simplest of projects have forced me into researching new stuff or reveal some weakness I didn't think I had.

    More important than what projects you work on, is your knowledge range. The languages and the domains of programming you chose to study and take with you as your programming Knowledge Base.

    It is here that fun should not be a factor and you should make more conscious decisions based on current market trends and your own aspirations as a software developer. Once you secure your career, then you will have plenty of free time to have fun on dying, emergent or niche languages or programming paradigms. But for now, as you are trying to build your resume, don't make choices based on how much fun you are having.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Add to Front, Remove from Front, Traverse
    By Brandon Smith in forum C Programming
    Replies: 9
    Last Post: 04-10-2012, 03:26 PM
  2. Simultaneous Tasks
    By C_ntua in forum C# Programming
    Replies: 2
    Last Post: 07-28-2009, 08:21 AM
  3. Problem with fget and simultaneous printf.
    By Ironic in forum C Programming
    Replies: 13
    Last Post: 12-08-2008, 11:05 PM
  4. Using Front/Back Buffers With DirectX 3
    By Mike7409 in forum Game Programming
    Replies: 10
    Last Post: 05-06-2008, 02:54 AM
  5. simultaneous equations
    By nic_elmo_13 in forum C Programming
    Replies: 3
    Last Post: 04-14-2003, 08:11 AM