I felt like doing a quick post about the importance of taking a break from some projects. My English teachers would all like to slap me for that kind of intro, but I'm a computer science major, not writing.
As someone who's been learning programming on my own (except for one semester of college) for 6 years and counting, I've started many projects and "given up" on many. Very few projects I actually start come to completion. Granted, that may not look good, but it's been the primary source for everything I've learned so far. I would not be where I am today without projects that I've given up on.
Some of those lucky projects, I pick back up later. For instance, I have a Google Docs Addon (which I don't update since Google is annoying for submitting addons). I wanted to insert a line of text into the user's document, and have a portion in bold. At the time, I was in 10th grade, and was still somewhat new to programming. I was at the point where I knew I wanted to do programming as a career, but not at the point where I knew a whole lot of experience. It was sort of a tipping point. For the life of me, I wasn't able to decipher Google's documentation for Google Apps Script (GAS). Google documentation in general was like Greek to me, where I could go to w3schools and be comfortable.
Around a year went by and I decided to check back in on the addon, and I was able to figure out what I needed to do! It turns out, GAS has builtin types for G Suite products which I didn't quite understand. For instance, Google Docs, has
paragraph types. You can 'new up' a paragraph, decide to set it's italics state, and insert it into the document. Coming from HTML, paragraphs are separate elements that should be separated by something like a line break (since you press enter in the document to create a new paragraph). Turns out, paragraphs can be merged! You can create a paragraph with certain styles, create a new paragraph with different styles, merge them, and bam!
While that may seem somewhat simple for a seasoned programmer to comprehend, especially after actually reading the documentation, I was only in my third/fourth year of programming and was learning everything on my own. I didn't have a teacher for GAS to teach me any of this, but it was on my own experience that I had to learn a lot of programming knowledge.
That's just one example of me taking a break from a project and coming back better. Just now, I came back and redesigned a portion of the current project I'm working on, and it made me feel a lot better about my code. I can put this code to production and feel content about it.
Long story short, I run my own Biblical blog and I want to move away from the fact that Google Firebase (my current database system) has limits. Even though I am nowhere near hitting the data cap (and potentially never will be), I find pleasure in knowing that I have complete control over my project. As I gain experience with technology, I am slowly able to move toward complete control, especially with hosting my own website. Static pages are cool, but you can do so much more when you have a backend that you have 100% control over.
I am using MongoDB for my database, and Node.js for serving the page and as the backend. I decided when I went back to working on the upgrade that I wanted to use HTTP requests to get data about the posts. I could generate the site's data before sending it to the user, but for some reason I don't like that idea. (Would dynamically serving the page technically not be as secure, or does it matter unless evidence of my backend is leaked through the responses?) Eventually, I changed my mind and went to Socket.io, which I found when making (a now abandoned) real time multiplayer Pong game using Node.js, Express, and Socket.io. To make a long story short, I used the design of the original HTTP request code and applied it to Socket.io which some more complexity due to how I designed my other bits of code, but still was able to decrease the lines of code used.
I've heard that it's not necessarily better to have less lines of code, but I think it can depend on the situation. A student (who was new to programming) in my programming class this past semester wrote some code that sort of drove me insane. Granted, this was his first time writing a larger program, but as someone who has some experience, it still got to me. He was using quite a bit of if statements, and was copy-pasting a lot of code (and seemed quite proud of it). To me, there are things called variables and functions which are pretty nice, which allow for a programmer to not repeat a lot of code. He had multiple modes to a simple text game he was designing, and copied the logic for each mode over. I would have had a variable for the mode, and use that for changing calculations later in the game, thus saving lots of code. Also, if he changed the logic in one part, more copy-pasting had to be done. In this instance, I think that less code would be better and allows for a more logical flow to the code rather than a verbose flow of thought. Granted, this student has never really wrote code before, so I put my rant aside and applaud him for his efforts.
While I've jabbered on about different things, back to the Biblical blog project. I went from 44 lines of code with my HTTP request method to 31 lines of code with my Socket.io method. Even though 13 lines of code isn't really all too much and probably will free the processor for like 500 milliseconds, I still feel a lot better with a new system in place, which compacted the earlier system. Also, the new system is "more secure", so it's an upgrade in space and also security.
If you're stuck in a project, or just want a "second wind" on it, don't be afraid to take a break. Granted, not every project has time for a year long break like I took for my Google Apps Script addon, but even just taking a quick moment to take a walk, binge watch LGR or another related YouTuber, or even just get something to eat could be enough to help relax the brain to catch new inspiration. If the project has many parts like mine, switch between parts every so often. My project has frontend code and backend code to be worked on, so if I'm deep into backend code and getting frustrated, then maybe switch to designing an interface.
Being burned out sucks, and the only remedy for being burned out is to have some new oil to burn. Take a break, refresh, reload, recharge, and don't be afraid to relax if you need it. Recoding and revision isn't an enemy, but can help in great ways on the end result. Just make sure to commit!