25

Almost 3 weeks back I joined a company as a React developer. For a week I had nothing to work on as they were already working on few projects.
So my senior asked me to take up a project(not yet live) which was developed by 2 interns, as the frontend guy's internship was about to end in 4 days I have to take over the front-end role.

So I talked to that guy for next 2 days regarding all the project scope, codebase and whatnot. But still not entirely convinced. As i got the repo access, I began to check the codes. God !! It was all spaghetti code. I was damn frustrated. And still I am.

This whole week I am trying to do the refactoring as much as I can, I completely lost interest.

I cannot blame the intern guy, he is smart and tried to do the best he could, as he didn't know about the company standards. Maybe I was too the same kind back then. Now he is gone and I am stuck building components over that code.

Bonus: He used some old react boilerplate.
-_-

Comments
  • 1
    Welcome to devrant! here is your first upvote...
    rewrite from scratch, is better then tring to reuse the old code. But I feel your pain.
  • 0
    @AlinaWithAFace the object oriented pattern 'facade' is nice for a single application (so not an entire architecture). It's basically a fancy word for: interfaces everywhere.

    It's useful to refactoring shitty code bases, for example:
    Consider some shitty implementation of some ORM class. First, build a facade with the specifications needed in the rest of the application. Then adapt the bad situation to work behind the facade and put the facade to work. Then, start building the new situation behind the facade, separated from the old situation. Write new code, classes or whatever, or reuse parts of the bad code. Just make sure you can test your facade and therefore your new implementation. Last step once done: use the new facade implementation by flipping the switch from old to new situation. Boom, bad old code gone in one or a few lines of code!
  • 0
    More on the facade pattern:

    https://sourcemaking.com/design_pat...

    With some fantasy, it can be extrapolated to a system architecture as well.
Add Comment