When I was a child junior developer I used to start my projects by adding a framework and ... That's pretty much all. Just my "favorite" (the only one I knewπ) framework and solo-coding for 10-14 hours per day. I heard from other developers about linter, prettier, git-flow, best practices, but I was like: "I don't need things I haven't had time learning to be added to my project". There was no rush, basically, I just wanted to start coding.
If you're like me, I will save you some time by saying: "Stop right there and listen to me!"π
Let's say you're going to play hookey. Could you go to the ice without special equipment? You can, but it's risky for your health. The same is with the initial setup. It's your project's special equipment, the superpower.
After many years, I've become a Senior Developer. I've learnt learned from my mistakes and here's my own list of "Steps before I start the brand new project".
- Take care of your code formatting
- Check with the best practices
- Take care of other developers by adding ReadME
- Check your code on compile - TS, Flow, etc
- Use the latest versions from the start
- Define terminology
- Git and Branch naming
1. Take care of your code formatting π€
As a first step, I take care of my code by defining the rules and turn on autoformatting. For that I always add 2 tools to the project:
- ESLint - helps me to define specific rules for the code I write and stick to that rules by showing warnings and errors if I try to break them;
- Prettier - helps me to forget about single/double quotes, tab, spaces, everything regarding the code styling. You just set up it and all your code will be autoformatted by this tool;
2. Check with the best practices β
At this step, I research as much as I can because as good developers we shouldn't reinvent the wheel, right? So I'm trying to find good boilerplates with things I would need in my own project. Don't make a mistake by skipping this step because it can save you a ton of time.
3. Take care of other developers by adding ReadME π€
I like to have 2 files in my project from the start - ReadME and Conventions. I use ReadME to add general info about the project and instruction on how it can be run. And in Conventions, I always add some description about the code styling, approaches I use and advise how other developers can continue to work and scale the project.
4. Check your code on compile - TS, Flow, etc π
I'm not a big fan of working without TypeScript or Flow. I'm a human and I make mistakes but with these tools, I can at least be assured that I work with the proper User object and I will get returned from a function an array of Users and not an array of Animals. Besides, it's easier to debug and understand code in this way.
5. Use the latest versions from the start π
This one is pretty much straightforward. If you start a project - don't go back
, but rather stay present
and use everything up to date since new versions can have great features, and the code will be better tested and less buggy.
6. Define terminology π³
Before I start coding I want to know the terminology I would be using in the project and stick to it. I don't like to spend time thinking about names for my entities but rather think about the logic I want to implement. Also, at this step, I define the folder structure since I have all information it seems a logical step.
7. Git and Branch naming βοΈ
As the last step, I make an initial commit and put the project to one of the version control services and when I work on feature/task/bugfix I create a separate branch for each of them with the following convention - work-type/short-description
. Also, I use branching since in that case, I'm able to show any feature/task/bugfix to a client separately.
Summarizing
When all steps are done I can go to the ice and play hockey without any health risk π₯·π₯·π₯·.
- My code smart - I don't need to remember all rules and how to format code properly;
- I follow best practices and learn something new each time so my project is easy to scale;
- I can give the project to any developer and they can start without my help by using ReadME and Conventions;
- I'm safe with TypeScript, I write better code and can refactor code easier, therefore faster;
- I can use the latest features of libs in the project;
- I can understand the project itself by looking at its structure, models, and types;
- I can always show to a client any feature I create, merge any tasks, or a bug I fix. Also, it's easier to work in a team with good git-flow.
What are your steps? Please, share in the comments βοΈ
Top comments (0)