The path to extra work.



  •  I have a co-worker who has been developing a fairly large site for over 4 months and it has come time to launch it live. I've been charged to take on this supposedly easy task, that is, until I take a look at the staging site's url and the site's codebase.

    The staging site has a url similar to dev.stagingsite.com/devsites/example.com when the url of the live site has to be www.example.com. The problem lies in the fact that the developer HARD CODED THIS URL IN EVERY SINGLE PLACE WHERE THERE NEEDS TO BE A URL PASSED IN SOME SORT OF WAY. Javascript, CSS, images, php, everywhere.

    I can see making this staging url a global constant as being semi acceptable, but no, that would make our code far too maintainable. When asked why in the world he hadn't defined paths as a constant OR why he hadn't just given the dev site a proper domain like dev.example.com, he answered both questions with "We wanted to save money on registering domains so we just made the dev site use a subpath".

     So... I had spent a majority of the day opening all the files of this site and doing a mass replace on hardcoded absolute urls in order to make the code base work on both the staging and live sites... I sometimes wonder why I left my old job...



  • Ok, the developer didn't exactly think it through, but at least it sounds like you can just do a stream edit of all files to do the bulk of the work. The folks who build our internal sites believe in dynamically constructing all URLs from individual subdirectory paths; good luck finding code like that without manually walking through every line.



  • @snoofle said:

    Ok, the developer didn't exactly think it through, but at least it sounds like you can just do a stream edit of all files to do the bulk of the work. The folks who build our internal sites believe in dynamically constructing all URLs from individual subdirectory paths; good luck finding code like that without manually walking through every line.

     ...that...sounds...horrible.

    Still, I have to manually test every page and feature to make sure that I didn't miss a file or hardcoded url.



  • @captainpants said:

     ...that...sounds...horrible.

    Still, I have to manually test every page and feature to make sure that I didn't miss a file or hardcoded url.


    How about handing the shit back to him until he fixes it? There's no deployment anyway until it's fixed, and he might learn something if he has to clean up his own mess.



  • @captainpants said:

    "We wanted to save money on registering domains so we just made the dev site use a subpath".
     

    "well, congratulations. You've saved money that way but cost the company over ten times that amount by making the idiot developer correct every page URL so the site won't break when deployed to another host, namely the live one."

    Admittedly, if you own example.com then adding staging.example.com and dev.example.com to DNS to host testbeds (which is what I do) incurs no extra cost. Makes cookie testing easier, too.

    @Aeolun said:

    How about handing the shit back to him until he
    fixes it? There's no deployment anyway until it's fixed, and he might
    learn something if he has to clean up his own mess.

    ... would have been my approach.

     



  • @Cassidy said:

    Admittedly, if you own example.com then adding staging.example.com and dev.example.com to DNS to host testbeds (which is what I do) incurs no extra cost. Makes cookie testing easier, too.

    Maybe they also saved money by not buying a wildcard cert.



  • @blakeyrat said:

    Maybe they also saved money by not buying a wildcard cert.
     

    But.. but.. hmm... true, I just presumed (from the developer's justification) that https wasn't in use.



  • @blakeyrat said:

    @Cassidy said:
    Admittedly, if you own example.com then adding staging.example.com and dev.example.com to DNS to host testbeds (which is what I do) incurs no extra cost. Makes cookie testing easier, too.
    Maybe they also saved money by not buying a wildcard cert.

    Even that is not an issue, a domain validated certificate can be obtained for free from startssl or you can use a self-signed certificate. It's not necessary to have an EV certificate for staging or dev.
    Only if you still have to support IE on Windows XP you cannot have more than one vhost per IP address using SSL (unless you use non-standard ports).



  • @solitario said:

    …domain validated certificate can be obtained for free from startssl or you can use a self-signed certificate…

    Or create your own company-wide CA. It's used for other things anyway (e.g. exchange), so it can be used for testing.



  •  ...why on earth would a dev domain cost an extra domain?

    All our dev sites run off our own domain, obviously: http://clientxyz.dev.ourcompany.com/

    Same thing for the staging server, and every site in production has an alternative where the 'dev' bit is replaced with the server's designated number.



  • Since you're not posting the tech being used I'm going to assume it's something fairly recent and that your fellow developer has no idea of how the thing works. Every respectable web development framework provides some sort of routing configuration...

    Oh wait, I just read it's PHP... why I'm not surprised?



  • @dhromed said:

     ...why on earth would a dev domain cost an extra domain?
     

    Because (presumably) they wanted to register a new domain, completely separate from the production one.@dhromed said:

    All our dev sites run off our own domain, obviously: http://clientxyz.dev.ourcompany.com/

    ... which is the way I've seen it done in many non-WTF development houses, and is probably the easiest and cheapest way of doing it.

    (hell, I own four domains and control my DNS so keep creating subdomains at will for all manner of experiments, as well as running a zone at home for LAN testbed stuff.)

    @ubersoldat said:

    Oh wait, I just read it's PHP... why I'm not surprised?

    I'll have to say that part of the WTF is that the dev site was setup and handed over to the developer without guidance about loosely-coupling the code to the FQDN. And if the dev in question was the person who set it up then they should have learned how to set it up properly (or reassigned the task to someone more experienced).



  • @snoofle said:

    @captainpants said:
    So... I had spent a majority of the day opening all the files of this site and doing a mass replace on hardcoded absolute urls in order to make the code base work on both the staging and live sites... I sometimes wonder why I left my old job...

    Ok, the developer didn't exactly think it through, but at least it sounds like you can just do a stream edit of all files to do the bulk of the work.

    Exactly. The developer was a dumbass, but if he really hard coded it, it should be super simple to zap all of the places where you find the staging URL. You shouldn't have to open a single file! This is, like, a 10 minute task.



  • I'm always super-skeptical of mass automatic replace actions. It depends on the specifics of the task, obviously, but it's really easy to accidentally nuke all semicolons, or maybe something far subtler, like the value of a constant.



  • @dhromed said:

    I'm always super-skeptical of mass automatic replace actions. It depends on the specifics of the task, obviously, but it's really easy to accidentally nuke all semicolons, or maybe something far subtler, like the value of a constant.

    Sure, which is why I say 10 minutes, because you have to go back and check the results. But your source control should give you a diff of what you changed, and then it's trivial to revert and fix your mistake and try again if you mess up. Still less error prone than accidentally leaving extra characters behind, or accidentally deleting surrounding characters in one or two of the dozens of places you'll paste in the new value.



  • @boomzilla said:

    Still less error prone than accidentally leaving extra characters behind
     

    I have done this.



  • @dhromed said:

     ...why on earth would a dev domain cost an extra domain?

     

    We don't own the domain to the live site, our client does. My approach would be to just create a staging domain like dev.exampledev.com for a measly $3.00 but your approach would definitely be the cheapest.

     @boomzilla said:

    But your source control should give you a diff of what you changed.

    This idiot also didn't use any source control. His excuse? "I thought I'd be the only developer working on it." So I had to init a git repo myself and he started complaining because thre arent any nice git GUIs for windows environments.

     



  • @Aeolun said:

    @captainpants said:

    Still, I have to manually test every page and feature to make sure that I didn't miss a file or hardcoded url.


    How about handing the shit back to him until he fixes it? There's no deployment anyway until it's fixed, and he might learn something if he has to clean up his own mess.

     

    You're assuming the original dev won't fuck it up even more "fixing" it.

     



  • @Suburban_Decay said:

    You're assuming the original dev won't fuck it up even more "fixing" it.
     

    Then (a) he gets a bigger bollocking for a larger fuckup, and (b) he does not get the impression he can author any old shite knowing that somewhere further along the line some mug will defuck it for him.



  • @captainpants said:

    @dhromed said:

     ...why on earth would a dev domain cost an extra domain?

     

    We don't own the domain to the live site, our client does.

     

    So?

    You mean to say that you don't have a development server? 

     



  • @captainpants said:

    We don't own the domain to the live site, our client does. My approach would be to just create a staging domain like dev.exampledev.com for a measly $3.00 but your approach would definitely be the cheapest.

    Why would you need even that? You can make any development host you like, up to and including "clientxyz.development", properly configure your webserver and DNS, and be done with it. That windows-using colleague could even just modify his hostfile if your company doesn't have a DNS server, add a single line and whatever domain he'd like to test with could point to your development server. Free of charge. Adding a vhost with a fictional name to apache is another work of three, four lines tops, and I presume the same holds for other webservers.

    Of course that would not work so well for staging, but as others have mentioned, it is fairly trivial to do the same thing with a domain you do own - as a webdeveloping company, I assume your company owns at least one domain already. This really is webdevelopment 101 if you ask me. Pretty much every company I worked for had some sort of system like this for setting up development environments.



  • @captainpants said:

    My approach would be to just create a staging domain like dev.exampledev.com for a measly $3.00 but your approach would definitely be the cheapest.
     

    You wouldn't even need to do that - simply create another DNS record for customer-staging.myowndomain.com and use that.

    If it's only for internal work you could use www.customersite.LAN or www.customersite.TESTBED and have that point at an internal boxen with host-headers that respond to requests featuring that URL. My network is "org.test" (but I'm thinking of changing it over to cassidy.lan)

    @captainpants said:

    This idiot also didn't use any source
    control. His excuse? "I thought I'd be the only developer working on
    it." So I had to init a git repo myself and he started complaining
    because thre arent any nice git GUIs for windows environments.

    I've never met this dev of yours but I'm getting to dislike him immensely.

    I expect some snoofle-level tales forthcoming - or a dev-sized bump under your patio slabs - in the forthcoming weeks.

     

     



  • @Cassidy said:

    You wouldn't even need to do that - simply create another DNS record for customer-staging.myowndomain.com and use that.

     

    I agree, dhromed had mentioned this as well. I'll probably talk to our sys admin and ask him if we can start doing things this way.

    @Cassidy said:


     I expect some snoofle-level tales forthcoming - or a dev-sized bump under your patio slabs - in the forthcoming weeks.

     

    A slight feeling of horror washed over me as I realize that people on these forums may find the WTF level of my organization and snoofle's to be similar.

     



  • @Cassidy said:

    I expect some snoofle-level tales forthcoming - or a dev-sized bump under your patio slabs - in the forthcoming weeks.

    So THAT'S where you hide the bodies!



  •  @captainpants said:

     Still, I have to manually test every page and feature to make sure that I didn't miss a file or hardcoded url.

     Can't you just grep for the old URL?  I guess if you can, then you could use sed to replace it to begin with...



  • @Gordonjcp said:

    Can't you just grep for the old URL?  I guess if you can, then you could use sed to replace it to begin with...
     

    I think it's already been mentioned that identifying which files contain the old URL and replacing it with the new one (or a placeholder constant) can be done programatically.

    However, testing that it all works as intended is still a manual process.



  • @Cassidy said:

    @Gordonjcp said:

    Can't you just grep for the old URL?  I guess if you can, then you could use sed to replace it to begin with...
     

    I think it's already been mentioned that identifying which files contain the old URL and replacing it with the new one (or a placeholder constant) can be done programatically.

    However, testing that it all works as intended is still a manual process.

     

     

    ... and that is TRWTF.  You should never have to manually test stuff.

     



  • @Gordonjcp said:

    You should never have to manually test stuff.
    How else would you perform UAT?

    Automated testing only gets you so far. Like it or not, a system used by a human will be under test, either formally or informally.

    And let's not forget that automated tests are only as good as the tester that authored them.



  • Our site final testing is done with HOSTS entries to the staging IP address for each cluster.

    Site gets switched live by switching the DNS entries to the new IP.

    Domain name is also only a config file setting.


  • Discourse touched me in a no-no place

    @Gordonjcp said:

    ... and that is TRWTF.  You should never have to manually test stuff.
    If only there was some software that could automatically grok websites, follow any links found and report on any 404's it gets. It could be called, I dunno, a 'spider' and people could possibly offer it for free.



  • @PJH said:

    It could be called, I dunno, a 'spider' and people could possibly offer it for free.
     

    Ooohhh... that's given me an idea.. suppose I took something like that, had it record words and common terms it grokked then allowed people to trawl through those records and report back which site contained those words?

    I'd have to sell that idea, mind.

    I mean, if I allowed people to scan my list of records for free, I'd hardly make any money out of it now, would I?



  • @captainpants said:

    This idiot also didn't use any source control. His excuse? "I thought I'd be the only developer working on it." So I had to init a git repo myself and he started complaining because thre arent any nice git GUIs for windows environments.

     

     

    Why do people use git? I prefer Murcurial (HG), i find it more complete and better help then git.  To boot you also get the free and reasonable TortoiseHG, i find makes a very good stand-alone solution. 


     



  • You murked up the name, but otherwise you must be totally right...  it does absolutely the same things in a completely better way. And TortoiseHG is also so much better than the enslaved and unreasonable TortoiseGit


  • Discourse touched me in a no-no place

    @Gordonjcp said:

    You should never have to manually test stuff.
    I see that you don't write GUI code. Even GUI toolkit code is fantastically difficult to auto-test (unless you do horrible things like requiring always the same version of the OS with the exact same fonts installed) and GUI apps are even harder. "What happens when the user changes the system font size multiplier when our app is running and everything is configured to use some weird-ass font that costs $10k a seat?" Ugh!

    Minimizing the amount of code that it is hard to auto-test is a very good idea though.



  • @Cassidy said:

    @Gordonjcp said:

    Can't you just grep for the old URL?  I guess if you can, then you could use sed to replace it to begin with...
     

    I think it's already been mentioned that identifying which files contain the old URL and replacing it with the new one (or a placeholder constant) can be done programatically.

     

    string UrlToUse = "ohshit.example.com/firstpage.aspx";  // Easy!

    string BaseDomain = "example.com";
    string SubDomain = "ohshit";
    string ToUrl = SubDomain + "." + BaseDomain
    string MyPaegToGoTo = ToUrl + "/firstpage.aspx" // Uh=oh

    List<String> Domains = new List<String>();
    Domains.Add("com");
    Domains.Add("example");
    Domains.Add("ohshit");

    string MyPageToGoTo = Implode(Domains, ".") + "/firstpage.aspx" // motherfucker!

     



  • @Lorne Kates said:

    @Cassidy said:

    @Gordonjcp said:

    Can't you just grep for the old URL?  I guess if you can, then you could use sed to replace it to begin with...
     

    I think it's already been mentioned that identifying which files contain the old URL and replacing it with the new one (or a placeholder constant) can be done programatically.

     

    string UrlToUse = "ohshit.example.com/firstpage.aspx";  // Easy!

    string BaseDomain = "example.com";
    string SubDomain = "ohshit";
    string ToUrl = SubDomain + "." + BaseDomain
    string MyPaegToGoTo = ToUrl + "/firstpage.aspx" // Uh=oh

    List<String> Domains = new List<String>();
    Domains.Add("com");
    Domains.Add("example");
    Domains.Add("ohshit");

    string MyPageToGoTo = Implode(Domains, ".") + "/firstpage.aspx" // motherfucker!

     

    string RainbowPageThePageYouGoToWhenYouDie = (char)0x6f + (char)0x68 + (char)0x73 + (char)0x68 + ...



  • @ekolis said:

    @Lorne Kates said:

    @Cassidy said:

    @Gordonjcp said:

    Can't you just grep for the old URL?  I guess if you can, then you could use sed to replace it to begin with...
     

    I think it's already been mentioned that identifying which files contain the old URL and replacing it with the new one (or a placeholder constant) can be done programatically.

     

    string UrlToUse = "ohshit.example.com/firstpage.aspx";  // Easy!

    string BaseDomain = "example.com";
    string SubDomain = "ohshit";
    string ToUrl = SubDomain + "." + BaseDomain
    string MyPaegToGoTo = ToUrl + "/firstpage.aspx" // Uh=oh

    List<String> Domains = new List<String>();
    Domains.Add("com");
    Domains.Add("example");
    Domains.Add("ohshit");

    string MyPageToGoTo = Implode(Domains, ".") + "/firstpage.aspx" // motherfucker!

     

    string RainbowPageThePageYouGoToWhenYouDie = (char)0x6f + (char)0x68 + (char)0x73 + (char)0x68 + ...

    print get_url(array("some", "page"), array("some" => "parameters"));


  • @georgir said:

    You murked up the name, but otherwise you must be totally right...  it does absolutely the same things in a completely better way. And TortoiseHG is also so much better than the enslaved and unreasonable TortoiseGit

     

    So why is Git more popular?

     



  • Because it was initially promoted by someone relatively famous?



  • @solitario said:

    Only if you still have to support IE on Windows XP you cannot have more than one vhost per IP address using SSL (unless you use non-standard ports).

    I don't see even that as a problem. Set up the live site's certificate as the default one. When you test with IE on XP you'll have to skip the warnings, but end users shouldn't see any issues with the live site.



  • @captainpants said:

    The staging site has a url similar to dev.stagingsite.com/devsites/example.com when the url of the live site has to be www.example.com. The problem lies in the fact that the developer HARD CODED THIS URL IN EVERY SINGLE PLACE WHERE THERE NEEDS TO BE A URL PASSED IN SOME SORT OF WAY. Javascript, CSS, images, php, everywhere.

    I can see making this staging url a global constant as being semi acceptable,  

    Obviously you need to use a variable constant.

     



  • @Helix said:

    Why do people use git? I prefer Murcurial (HG), i find it more complete and better help then git.  To boot you also get the free and reasonable TortoiseHG, i find makes a very good stand-alone solution. 

     

     

    Actually gonna try HG for a personal project of mine. Heard some horror stories from git and it is a bit too complex for what I use it for.

     



  • @captainpants said:

    @Helix said:

    Why do people use git? I prefer Murcurial (HG), i find it more complete and better help then git.  To boot you also get the free and reasonable TortoiseHG, i find makes a very good stand-alone solution. 

     

     

    Actually gonna try HG for a personal project of mine. Heard some horror stories from git and it is a bit too complex for what I use it for.

     


    I've used both and git is faster and easier to use. Simple test case: git grep vs hg grep



  • @Ben L. said:

    @captainpants said:

    @Helix said:

    Why do people use git? I prefer Murcurial (HG), i find it more complete and better help then git.  To boot you also get the free and reasonable TortoiseHG, i find makes a very good stand-alone solution. 

     

     

    Actually gonna try HG for a personal project of mine. Heard some horror stories from git and it is a bit too complex for what I use it for.

     


    I've used both and git is faster and easier to use. Simple test case: git grep vs hg grep

    i think if you are a windows dev then HG is better, if you are a Linux dev then git is a better fit.

    any app on windows that needs cygwin sucks by default. hg runs natively and the gui bolt on is half sane so you do not need shell ninja skills.



  • @Helix said:

    @Ben L. said:
    @captainpants said:

    @Helix said:

    Why do people use git? I prefer Murcurial (HG), i find it more complete and better help then git.  To boot you also get the free and reasonable TortoiseHG, i find makes a very good stand-alone solution. 

     

     

    Actually gonna try HG for a personal project of mine. Heard some horror stories from git and it is a bit too complex for what I use it for.

     


    I've used both and git is faster and easier to use. Simple test case: git grep vs hg grep

    i think if you are a windows dev then HG is better, if you are a Linux dev then git is a better fit.

    any app on windows that needs cygwin sucks by default. hg runs natively and the gui bolt on is half sane so you do not need shell ninja skills.

    I tried TortoiseGit and TortoiseHg back when I was on Windows, and I wouldn't call either of them sane. TortoiseHg was the saner of the two, so I'll give you that.



  • @Ben L. said:

    @Helix said:
    @Ben L. said:
    @captainpants said:

    @Helix said:

    Why do people use git? I prefer Murcurial (HG), i find it more complete and better help then git.  To boot you also get the free and reasonable TortoiseHG, i find makes a very good stand-alone solution. 

     

    Actually gonna try HG for a personal project of mine. Heard some horror stories from git and it is a bit too complex for what I use it for.


    I've used both and git is faster and easier to use. Simple test case: git grep vs hg grep

    i think if you are a windows dev then HG is better, if you are a Linux dev then git is a better fit.

    any app on windows that needs cygwin sucks by default. hg runs natively and the gui bolt on is half sane so you do not need shell ninja skills.

    I tried TortoiseGit and TortoiseHg back when I was on Windows, and I wouldn't call either of them sane. TortoiseHg was the saner of the two, so I'll give you that.

    Exactly, windows dev = HG, Linux dev = git



  • @dkf said:

    Even GUI toolkit code is fantastically difficult to auto-test
     

     Windows has an API used for disabled accessiblity (screen readers, etc.); does Linux have a standard How many standards does the linux world have?


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.