⛑ Relative Oriented Programming



  • Dear TDWTF helpline

    A relative asked me whether I'd be willing to help creating a website. He's already gathered requirements (good!) and wrote some code (not good!) and is now asking me to pitch in with my expert knowledge. The problems are manifold:

    1. He's writing PHP
    2. Not using version control
    3. I've seen his code

    Unfortunately he's already managed to reinvent page-routing (long chain of includes into numbered subdirs), persistence (plain files storage), and page-rendering (append to file, echo that). Variant of the UNIX philosphy where every file is a hammer. He's also pulled-in a random third-party script for authentication. Now he's asking me to join because he'd like to port some things to MySQL and has trouble getting the connection to work.

    In a professional setting all that would yield an immediate no for an answer. Since he's doing what I find to be a worthy cause, I'm having trouble just declining. If this project came through it would ease a long-standing pain-point in the larger family! And it's endearing how he's learning to program past his sixties.

    It's clear to me that if I were to join, I'd either rewrite everything (who couldn't?) or just drop-in a CRM (sane choice) with the functionality we need. But then, what about all the work he's already sunk into this? It's clear he's invested a lot of thought into the project since the last time I told him it needs "restructuring". The easiest would be to tell him the truth that I'm very busy. But then the problem would go unsolved!

    What should I do?

    Note, before you let this influence you in your advice: none of his code will be featured here! He's a student.


  • Notification Spam Recipient

    Personally I wouldn't rewrite it for them. They asked for help connecting to a database, I'd give a sample script to do it in the most correct way at time of writing that they could abuse without too much worry.

    My own first projects reinvented a database as a flat file stored in-memory as a preallocated array of arrays of arrays (don't ask), and I'm not doing that anymore, so.... Baby steps?


  • BINNED

    @gleemonk Is this about the journey or the result?
    All that work he’s already sunk into it might be, well, literally “sunk cost”. If rewriting from scratch is less work than fixing it, that should be the answer. If it isn’t, or if helping him learn is more important, then fixing it might be the better idea.



  • Explain to him what it may mean for you to get involved with all your professional might, and if that is what he wants. Also say from the get go that you're busy.
    If he's in it to learn, go soft on the worst pain points, and ignore the rest the first few rounds and give good sources on why and how to do stuff. Be a guide to the right information and lend a hand with some examples or even code once in a while when he's really stuck...

    But, I'd be wary of ending up inheriting such a project.



  • @gleemonk rewriting it now would be a kick in the teeth for your relative. Effectively you'd be taking over his project - because the learning curve for him to pick it up again would be very steep and demoralising.

    I've been in a similar position to you and quickly learnt to bite my lips and make minor tweaks rather than undermine someone who'd learnt a huge amount from scratch but, through inexperience, had produced a monstrosity (mostly just for her own personal use).

    Offer specific guidance when asked but otherwise stay well clear.


  • Discourse touched me in a no-no place

    What's the website for? Is it his personal website or is he creating some sort of service he wishes to make money from?



  • Thanks you all! I couldn't imagine just doing surgical tweaks and giving advice. But now I can! So I'm going to try that.

    But, I'd be wary of ending up inheriting such a project.

    🙄



  • @loopback0 The site would supplement a mailinglist we use to coordinate access to a shared resource owned by the clan.


  • Discourse touched me in a no-no place

    @gleemonk I'd just do what asked, and maybe stick in another attempt at advising improvements. Rewriting it might cause friction and it sounds like the sort of thing where "it does the job" is good enough.



  • @gleemonk said in ⛑ Relative Oriented Programming:

    Variant of the UNIX philosphy where every file is a hammer.

    51037f8b-527c-42c9-8f75-41d04f0e2e53-image.png


  • Notification Spam Recipient

    @Rhywden said in ⛑ Relative Oriented Programming:

    @gleemonk said in ⛑ Relative Oriented Programming:

    Variant of the UNIX philosphy where every file is a hammer.

    51037f8b-527c-42c9-8f75-41d04f0e2e53-image.png

    Such a useful sex toy...



  • In a somewhat similar situation, I opted for small improvements where required (i.e. don't sprintf(buf, "%s", rows[7]); if (stricmp(buf, "(null)")!=0) {...} to check rows[7] == NULL) and education where possible (Fossil SCM is easy to get running even for a newbie; is there a good book on applied application architecture? would GoF's Design Patterns suffice?), so that eventual bigger improvements won't be too high on the learning curve.

    Despite there are still parts I would rather rewrite, they are now behind a level of abstraction and don't bother me too much, so the approach must be working.

    I wish you and your relative luck.


  • ♿ (Parody)

    I think you should give him your perspective as you've laid out here. Then help him figure out how to connect to MySQL, because he'll probably want to do all that anyways, but I'd try to stay clear of getting fully involved unless you can convince him to do something saner.


  • ♿ (Parody)

    @aitap said in ⛑ Relative Oriented Programming:

    nd education where possible (Fossil SCM is easy to get running even for a newbie; is there a good book on applied application architecture?

    Oh, yes! Whatever he does, get him to start using version control.



  • @boomzilla Yep source control is a must. But I might just run a git repo committing whatever state is on the server. I'm not sure he's ready for it. The last guy I did this with was mildly irritated that I could track the changes he was doing to the live system 😏 when I told him how exactly he broke it (again) after just thirty seconds of reading the diff. That guy didn't want in on it though when I told him how SCM works 🤷🏿♂

    And also yes: With the perspective of just helping with limited tasks I can actually talk to him about my situation. Because now it won't feel like an ultimatum he has to accept if he wants help.


  • ♿ (Parody)

    @gleemonk said in ⛑ Relative Oriented Programming:

    Yep source control is a must. But I might just run a git repo committing whatever state is on the server.

    Ugh. Don't use git. That's just mean.

    The last guy I did this with was mildly irritated that I could track the changes he was doing to the live system 😏 when I told him how exactly he broke it (again) after just thirty seconds of reading the diff. That guy didn't want in on it though when I told him how SCM works 🤷🏿♂

    Well, that would be a condition of my offering to help (more than a quick pointer or link to stackoverflow type of help). If he doesn't like it then he can work on his own. And if he gets upset (I realize we're talking about someone else) that I'm able to figure out and correct his problems quickly then he can just figure that stuff out himself.


  • Notification Spam Recipient

    @gleemonk said in ⛑ Relative Oriented Programming:

    mildly irritated that I could track the changes he was doing to the live system

    :rofl: