Logical error: headache and confusion

avatar

Have you ever written a program that didn't do what you expected it to, despite running successfully and coding it without errors? Have you found the reason? How long did it take you to find it? How confused were you?

I'm @albro and here I want to talk about programming issues and the path I've taken.

In the first days of programming, they gave us a simple question! The master asked us to write a program that only adds two integers, any arbitrary number. He said write it and compile it to see the result!

Although writing it was simple, I thought what is it! I changed the code a bit! This is how I wrote the program.

My idea was that the program would first welcome the user and then ask him to enter two integers. Then calculate and display their sum!

Although the program had changed, the problems remained. Uncontrolled inputs will also lead to ambiguous results! When we entered strings with the keyboard; Logical errors showed themselves and gave illusory results!

The most painful mistakes that sometimes take a person to the border of madness! I remember when I had to implement a game in Pascal as my first programming project.

The master wanted the game to be simple. The balls would come down and a gun would shoot them. In case of collision, the ball would explode and a point would be added to the user's score.

I wanted to design stages and manipulate it as much as I could. When you want to do such programs with pure coding, you only have a blue editor and a black space that must be shaped by your codes.

Since cohorts didn't contribute, I was dealing with a lot of code alone. I had to write the codes of different parts by myself in Pascal's blue editor.

I had to design all the pieces of this puzzle by myself and put them together, but I didn't have enough time and skilled manpower.

When you're designing a software, personnel and time will be your challenges! So I didn't have time to open the editor and write functions one by one and compile them separately. I decided based on mentality to define the functions in an editor and then program depending on the specified name that indicates its function. A violent and stupid work and far from the principles of software engineering!

When the functions were written I was dealing with a messy page full of functions! How confusing! There were thousands of lines of code on one page!

A logical error appeared when the program was compiled. The design was such that the ball came down from the top and if the shot was not successful, it would leave the bottom plate, but the problem was that the first ball remained at the bottom and could not be cleared.

Now in the pile of codes; Find its origin! After spending a lot of time and checking every single function, I found the problem in an infinite loop! More interestingly, the time I spent to find it was twice the time of writing the codes themselves!

These are all lessons that will be learned through trial and error and practice. Your ideas about programs are not always correct. This is a lesson you will be reminded of over and over again.

When you do a project, you have to stick to the basics! The principles of software engineering can be clearly seen when we look at the evolutionary history of programming languages. When dealing with small projects; Maybe opening and coding works, but when you are dealing with a big or professional project; This is stupid!

Time and personnel will be two inseparable things. Ideas alone are not important. Creativity alone is not enough. Only codes are not important. You are faced with a multitude of issues. You will encounter a lot of files and new ideas and capabilities will attack you while working and poison your mind. What should be done at this time?

I advise you: after defining the problem, gather the group, review all the ideas and design an overview of the final program. Each group will design and compile the relevant parts and the final software will be formed by joining all the codes.







0
0
0.000
174 comments
avatar

!LUV

0
0
0.000