Ideas and Workflow Organisation for (Slightly) Larger Projects

Hi all!

I was wondering if I could get some advice on what tools and/or methods are helpful for larger projects, or if I’m doing something wrong.

The trigger for this question is the dungeon crawler project (with React) is that I have been working on for a couple of weeks—it’s currently unfinished and has over 1000 lines of code not including assets and styles, and I am starting to experience, or have questions regarding, the following problems:

  • Keeping track of all components, functions, and variables in my head is increasingly difficult, and is slowing down almost every aspect related to the project
  • Debugging, simplifying/generalising code distracts me from implementing (sometimes dependent) new features. It’s not that I think those things shouldn’t be done, but task switching is costly
  • I seem to spend more time improving code that is already written than writing new code now. Again, most of the time it is necessary to do so (I think) because new features need to be implemented, or an earlier design decision is simply flawed. But am I doing something wrong or does one only get better at this with more experience?
  • Is it stupid to not use libraries? I hasn’t crossed my mind until literally just before I typed this…

I am currently using Git to keep tracks of things as much as possible (learning Git half way through and migrating from CodePen was the best decision I have made so far), and development is done in Atom (which also helps a lot because of minimap, highlight selected, and some autocomplete features). The project was started with create-react-app.

Thank you very much in advance for any input!

If there are 3rd-party libraries that will do the job, I say use it.
By the same token, try writing your own library of functions you can re-use for future projects.

I have (4) files that I use for that purpose, each file containing multiple functions. I grouped them logically by files. Each file ranging from short 120 lines, to 1300 lines of code. It makes development faster as I don’t have to re-invent the wheel and I can pull from my bag of magic tricks.

Name your functions/methods and variables descriptive names. Yeah, they may be longer but it will also read more easier and aid in remembrance. Also, I put comments on my functions so I’ll remember what it does months or years down the road (when the client requests a change or new feature, or to fix discovered bugs).
examples:

    public static int IncrementAdViews(int adid)
    {  // update page view counter for this story id#
       // return value will be the updated view total

       // actual code goes here...
    }

    public static string GetAStoryPhoto(int storyid)
   {  // retrieve a photo (if any) and use this photo 
      // for the facebook/twitter feed

      // actual code goes here...
   }

Don’t hardcode magic numbers throughout your code… a few months down the road, you may not remember what they’re for. Instead, name them for what they are. Example:

   int defaultWidth = 400;

If your editor supports split-windows, use it. One window can be viewing one part of your code, and another window pane on the section you’re working on. Then you can quickly lookup variable names, function names, whatever on the other window.

Multiple monitors — love them. I used to have (2) 23" Apple Cinema display. Now, I’ve added a third monitor! One monitor is my editor, the 2nd monitor is a preview of the work in a browser, the 3rd monitor can be Chrome Developer tools, or Netflix, or email, or facebook, or a view of the database in SQL manager, etc. Minimizes switching windows, or scrolling up and down.

Refactoring can come in later. Make your program work correctly first, giving the right results. Then git, commit. Then branch out and work on refactoring piece by piece. If something breaks during your refactoring, and you can’t recover, you can always go back quickly to last known good copy of whatever file you’re editing.

Tracking To do lists, issues, etc… I recently started using a software called JIRA. I’m just a single developer, and this software may be overkill. I don’t use all of it’s features right now, but it has helped me keep track of my to-do lists and issues. Before, I just use a notebook… and I forget to do items when I change the page. JIRA costs a one-time $10 for a self-hosted version. I’m hosting mine on my OSX desktop. Or go cloud version, but it’s $10/month.

Plus I get pretty graphs showing what I’ve finished, new to-do items or issues I’ve created, and how much is left.

That’s all for now, If I think of something else I’ll add to this.

Interested to hear others workflow too, please add to the list.

3 Likes

Thank you very much for taking your time to address my questions! :slight_smile: It’s super helpful and I really appreciate it.

I think I may have taken advice from some articles about styles a bit too zealously and started having irrational fears about variables being too long (corridorAmountBias started to make me cringe), and also started commenting a bit less. I will try commenting the way I did before to see if it helps. :slight_smile:

I was actually just thinking about whether or not could fit another screen on my desk earlier today because I discovered the goodness of split-windows when I started using Atom just a bit over a week ago. Now I have no more excuses to not make space for another one!

That actually looks great and I will definitely give it a go because my notebook is becoming a bit overwhelming (and every now and then I would flip through it and find things that I haven’t done).

Once again, thank you very much for your time! :slight_smile:

With code completion on modern editors, you just have to type a few letters of your variable name, and the choices/options of what it matches pops up. Just a quick hit of the arrow keys, then press Enter, and the long variable is instantly on your editor. There’s really not much typing, and letting autocomplete do the job also means less typos when entering variable names (long or short kind).

2 Likes