1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Generalization / Specialization. When and where???

Discussion in 'Programming' started by dembegama, Aug 5, 2019.

  1. #1
    I've always been of the opinion that you should generalize your functions only when it's required and specialize when it is only being used for one use.
    SEMrush
    This is under the assumption that you do not see any other use for the function in the foreseeable future. If you know you'll need it for other things later then I feel you should generalize just to save yourself the trouble later on. But generalizing without any foreseeable future case but making the assumption that there might be seems like you're adding unnecessary levels to your code.

    What are your thoughts?
     
    dembegama, Aug 5, 2019 IP
    SEMrush
  2. deathshadow

    deathshadow Acclaimed Member

    Messages:
    8,926
    Likes Received:
    1,625
    Best Answers:
    232
    Trophy Points:
    515
    #2
    This is one of those questions that just begs more questions because it's more philosophy than fact. It's the type of theoretical nonsense that career educators agonize over, and those out there actually programming never once deal with... why?

    Because "specialized" and "generalized" could mean almost anything, and usually do have radically different meanings to different people.

    Could you be more specific in your generalization, explaining how YOU define those terms with examples of each? I've been programming 40+ years, and to me it sounds like some teaching twaddle packed you full of proactive paradigms.

    Sorry, but there's a lot of theoretical BS that's bandied about by people who don't actually program, much of it in books and mindlessly repeated by educators, that does little but waste time on doing everything EXCEPT actually writing clean minimalist efficient code.
     
    deathshadow, Aug 6, 2019 IP