Do We Need to Start from Scratch in Embedded Development?

I’ve seen some discussions among peers about the topic of “reinventing the wheel,” with various opinions. Here, I will first outline two common scenarios.First Scenario:The boss never rushes the progress, and the engineers working on the project are not in a hurry, starting from scratch and building the project step by step, writing code incrementally (i.e., reinventing the wheel from scratch).By the time the project is completed, or even halfway through, the company might have already gone bankrupt.Second Scenario:The boss demands that the project be completed in the shortest possible time. In this case, various templates are directly applied (such as: unit modules, software libraries, protocol stacks, etc.), piecing things together, and finally, the project is completed on time, albeit barely functional.Do We Need to Start from Scratch in Embedded Development?(A program that runs on bugs)One day, the boss asks for a new feature, and it turns out to conflict with existing functionalities. What should be done? Start rewriting the code?You will find that whether starting from scratch or directly using templates, both approaches have their drawbacks.

Pros and Cons of Starting from Scratch vs. Using Templates

Starting from scratch means that the entire project is completed step by step by the engineers without using various ready-made templates.Nothing is perfect; both starting from scratch and using templates have their advantages and disadvantages.1. Pros and Cons of Starting from ScratchAdvantages:The software logic is clearer to the developers, making it easier to add, delete, modify, and query later.Disadvantages:It can be time-consuming, and there is a higher possibility of bugs in the software.2. Pros and Cons of Using TemplatesAdvantages:The software is reliable and stable (referring to commonly available software libraries, protocol stacks, etc.), and it saves development time.Disadvantages:There may be conflicts with your project, such as blocking situations or resource consumption issues.

Start from Scratch or Use Templates?

I cannot definitively say which approach is better; it ultimately depends on the actual situation of your project.1. Consider the Project TimelineIf the project development time is relatively flexible (not too rushed), starting from scratch can be a good option. For example:Try to allocate time early on to planthe project well, setting up thesoftware framework, etc.If the project needs to be completed in the shortest time possible, you can use some ready-made templates or even download a similar project from GitHub and make simple modifications, focusing on functionality first, and then gradually optimizing.2. Consider the Project PurposeIf the software is just for demonstration to clients, using templates is advisable.If it is intended for mass production, it is recommended to start from scratch, combining mature templates.3. Consider the Engineer’s Skill LevelIf the engineer is a novice, asking them to start from scratch may lead to delays. Even if the project is completed, it may have numerous bugs. In this case, it is still advisable to refer to others’ templates or source code (not just any random ones found online).If the engineer has some experience and there are not many reference templates available, they can start from scratch.4. Consider Leadership Decisions······5. Consider Company Decisions······6. Consider Project Planning······

Practical Work

When a company initiates a project, various short-term and long-term plans are made, including detailed planning for embedded software.For example:modules (modularization), software naming, software framework, etc.

Do We Need to Start from Scratch in Embedded Development?

In summary, a lot of time was spent on preparation work in the early stages, and then, the project was developed step by step from scratch according to the plan.In previous years, projects went very smoothly, and although there were occasional small bugs, they could be quickly identified and resolved.However, with market changes, the frequency of feature changes and additions increased, and time became tighter. When adding, modifying, or deleting features or modules, there was little time to optimize the project.Eventually, more and more issues were exposed in the project, and the number of critical bugs reported by the testing department increased, along with frequent market feedback on problems.Ultimately, there was no choice but to pause the project, reorganize the software architecture, and after a month, the updated architecture was completed successfully.To clarify:The entire software project became quite large, and third-party libraries, protocol stacks, etc., were also used. Because a lot of planning (preparation work) was done, the early development went smoothly, but the later stages became tense without optimization, leading to more bugs due to code accumulation.Fortunately, sufficient groundwork was laid in the early stages, such as modularization and high cohesion with low coupling in the code, making the subsequent software refactoring relatively smooth, with many modules being directly reusable.

Conclusion

Whether to start from scratch or use templates should follow several principles:

  • The shorter the project development time, the better.
  • The more stable the project, the better.
  • The easier it is to add, delete, modify, and query in the later stages, the better.
  • ······

In situations where balance cannot be achieved, compromises must be made, but efforts should be made to maintain balance. As mentioned above, rushing progress without optimization leaves hidden dangers for the future.Therefore, it is generally recommended to first plan the project, such as the software framework and structure, based on the project situation, then refer to or use some mature templates, and finally, during the coding process, continuously optimize and improve the code.Ultimately, regardless of the approach, the goal is to make the project stable and facilitate adding, deleting, modifying, and querying.Source: WeChat Official Account: strongerHuang

-END-

Previous Recommendations: Click the image to jump to readDo We Need to Start from Scratch in Embedded Development?

Does embedded development really not require software architecture design?

Do We Need to Start from Scratch in Embedded Development?

As an embedded engineer, I participated in the OpenHarmony Innovation Competition …

Do We Need to Start from Scratch in Embedded Development?

How to design an embedded software abstraction layer?

I am Lao Wen, an embedded engineer who loves learning. Follow me to become even better!

Leave a Comment