strategy to develop program for projects

Thread Starter

skyr6546

Joined Mar 22, 2019
73
It is a difficult question how to write code for a big project. Its simple answer will be that divide your big project into small parts so that you will be able to write code easily. I want to understand how to divide big project into small parts. I am not asking for any single project. My question is how to divide the big project into smaller parts so that we can write the program easily.

You can just assume, for example, that I have to make a real-time clock with alarm features for college In which the bell rings after each lecturer is finished. I have made this example myself and I think it represents a big and complex project. I assume project has a microcontroller, RTC chip, LCD and a buzzer.

I do not want to discuses about particular part because this is just an example, I am not going to implement it. It will only help me to understand how I have to write simple code and then increase complexity after that.

How to make strategy to develop program for such big projects?
 

SamR

Joined Mar 19, 2019
5,031
In the chemical industry when I had to design and program/configure a DCS for a new process the key was the engineering Process Flow Diagram. The Project Manager should have developed the scope of the project prior to submitting for fund approval. From that overall scope, the project team will develop a detailed scope of what needs to be done and develop a flow chart to direct the programming. At that point, it is a line item by line item job to program and test.
 

BobTPH

Joined Jun 5, 2013
8,813
That is not what I would call a big project, but I guess that is relative to your experience.

Anyway, the method would be the same. First, list all of the things it must do.

Here would be my attempt:

1. It had to keep tome of day, which id not what is meant by real-time.

2. You mist have a way of setting the current time.

3. You need to be able to set multiple alarms for your class times.

4. Finally it must notice when the alarm time has come and sound the buzzer.

Bob
 

MrChips

Joined Oct 2, 2009
30,720
You can break down the project into two streams, (1) required functionality (2) resources.
Let us use the real-time clock as an example.

Required functions
1) Set Time
2) Set Alarm
3) Increment Time
4) Compare Time with Alarm
5) Output to buzzer
6) Snooze buzzer
7) Reset buzzer
8) Display Time on LCD
9) Read buttons

Resources
1) LCD
2) Buttons
3) Buzzer
4) Time-base input
5) RTC chip

You can write code module for each one of the above items.

Focus on each individual module as follow:
1) What is the input to the module?
2) What is the function of the module?
3) What is the output of the module?
4) Are there any exceptions and how to deal with exceptions?
 

BobaMosfet

Joined Jul 1, 2009
2,110
Your question is very broad. Very broad. There is no one coding approach for breaking logic (which what you are implementing in code) into chunks. Usually it is the needs of the logic itself that determines how you break things up, based on constraints you must develop the logic under.

Constraints are things like data transfer speeds and quantities, human interface requirements, etc. How quickly must a I debounce something, or how fast must I empty a buffer to keep it from overrunning, etc.

Managing these 'circles of time' in the right priority, independently of one another is probably the largest underlying building block of elegant logic. But of course, your ability to do any of it really must also consider your overall skill and knowledge in translating a processes logic into code that elegantly and effeciently implements that process, and how you think.

Problem solvers are people who can think their way through a problem, or a process. Problem solving usually starts with answering one question- either by yourself, or by asking someone else, and that question usually falls along the lines of: ie, where would you start in trying to solve this? The keyword in this, is _this_. You have to have something to solve. The very act of having a problem presents a specific set of hurdles you have to overcome, and it is your ability to define and understand those hurdles, and your knowledge of the language (like C/C++) that you utilize to figure out the logic process to solve it.

What I offer most is this- read everything you can from others who are smarter, who are older, who have solved or done things in your area of interest- it will broaden your mind and help you do something that most people never teach their children today- it will help you find how _you approach anything_ and solve it. Everybody has their own 'approach'. But until you find it, it's easy to get confused and lost. Learning how your mind works will give you leverage over your life- it will let you wade into problems way over your head with the confidence you can solve them because you just have to let your mind work, and because you learn how your mind works, you then know what information to feed it.

Programming is a technical science, AND an art, because the best use their mind to creatively solve problems in code elegantly, efficiently, and not always in an obvious way. Identify all your limits, things you must work within- constraints. Start there and figure out how to solve your problem within those constraints.
 

MrChips

Joined Oct 2, 2009
30,720
Here is an example.
Right now I am in the process of building a 6-axis robotic arm from scratch. All the components will be sourced from the waste bin and local hardware store. This is a very complex project to say the least.
Have I done something like this before? No.
Is this doable? Yes.
Can I do it with my knowledge and experience? Certainly.
Where do I begin? I begin with a concept of what it will do and what it will look like. Something like this:

1580415705154.png

Of course, I know that it would not look as pretty.

How do I get going? I cannot possibly foresee all the problems to be encountered in detail. I have to fix each problem as I go.
I am into the first week into the project. The program is up and running. The GUI program is running on a PC. The MCU program is in C on an ARM chip. I have axis-1 (J1) completed with full motion and position feedback. Everything is modular. Why? Because that makes the project manageable. Because once I create the code for one axis, I can call the same code for the other axes.

I am on to axis-2.

Edit: This is one motivation to go buy a 3-D printer. That one is coming soon.
 
I was involved with a project that took two of us 9 months to write.
No management per se.

Anther project turned out to be too massive with an unknown language, Labview 2.2.1. The programming language was rapidly evolving too and was going cross-platform. Very rapid changes. I essentially did project management. I designed the package to work without instumentation present to speed up development time. I had to solve programmng issues and I did the hardware interfacing. That program lasted 17 years without modification until another major upgrade occurred.

The boss wanted immediate laser printed results, but it wasn't possible. It was too slow.

Ironically, it used the type of hardware i wanted to use initialy.
 
Top