If you translate a ‘ real life ‘ (sorry for the English version) problem into programming language, how do you find out what variables and functions you need for your application/program?

I have created the following model for a non-programming issue (a process issue).
Here you see two input variables, a transformation and a result of the transformation.
At the same time, you see a status (bottom) and an exception (exception).

The model is perfectly usable for an automatic solution.
Suppose I create a POS system.Then the variables could be the number of products and the price. The transformation is number * price. The status is displayed with a beep (scan) and the exception is if the product is not in the system.

The question that I think is playing before is: is the functionality I’m looking for (number of * price) in a library present or do I have to build it myself?
And there is a search engine or stackoverflow very useful.
The input variables and output is in alignment with the applicant, or specifications of the supplying and receiving system.

By thinking well.

Imagine you want to simulate traffic congestion, where you can use any card. You also want to display it on the screen.

Then you should somehow be able to display a map, one-way traffic and traffic lights, etc.You also need to display the traffic, where every car (and cyclist) has a position and goes somewhere. The best have the chilling only one purpose, no set route.

You should also be able to draw in the map, for example, interesting if you create a traffic plan and want to study its effects.

This is just the description of the problem.It looks like a game, where you can also customize the game’s card. Another variant seems to be the crowds. The game board is actually a count.

Would there also be a way to fix traffic jams and speed?Would the chilling choose alternative routes? Nice if you can enter real data and also see the same as the existing traffic pattern. You can then test the model. How would you measure that pattern? What characteristics? Of course you can also write to a file. Then you can compare different situations and alternatives quickly, without visualusation.

Now we are still not programing and also not working on solutions, just with wishes.Nevertheless, a lot has already become clear. A few variables and functions are already penetrating you, while you are only thinking about the problem.

I often work ‘ top-down ‘.But this is only one of the methods. Other methods are more suitable for other situations.

I start off by drawing up the work flows and the screens.You can then test with the customer or with users or this is what they had in mind. If this is not the case, then it is very cheap to still adjust things.

Based on these screens, I create a high-level design.This design is not in stone, but it does indicate the direction. Based on this design, I can also roughly estimate how much time is needed.

Then I start implementing it.I build the screens, but I fill in the data with dummy data. When this is done, I ask myself the question: how can I calculate this dummy data. Then I implement this calculation.

If a calculation is complex, you can work with layers.Then I work layer by layer from screen to database. When I work on a layer, I simulate the layer underneath with dummy data and possibly greatly simplified calculations.

This method has some advantages

  • You seldom build things you don’t really need
  • After each step, you can easily test whether your idea is working effectively and that you have not made a piece
  • You can always show on the screen what you can and what is not.

This makes it more tangible for non-technical people

There are also disadvantages

  • This method assumes that you are free to determine the structures in the database itself.

This is not always the case and then you have to take into account the high level design and possibly adjust the method.

  • Some tasks work in the background and do not have screens
  • A bad design can lead to performance problems, but most business problems are not that sensitive because the functionality is not used so often, or only works on a limited dataset.
  • I’m really not sure if I understand this question correctly.Basically, programming languages are boring. It is the use of features that a program tof does not make the functions themselves.

    • variables are a free choice (except some are reserved).

    The names for the variables are usually chosen so that there are easy to memorize. In case of a program with 200 variables this is what is crucial because if you leave it for a few baskets on the side you might forget a lot of them. There are some rules that respect everyone (e.g. A “myItem” is a piece of the set “myItems”). From good practice are normally all variables in English.

  • features are not that much.
  • Most are banal mathematical operations. The programming language interpreter understands nothing more than that. Sometimes it repeats a set of functions in a few places. This set of function is then shrouded in and by the programmer defined function.

    If we leave this, the “real life” problem is played. Anyway, programming is always translating “real life” problems into a programming language and then translating from a programming language to a “real life” solution.

    What counts in programming is what information is there and what should be done with the information.The rest should certainly be as simple as possible-file structure, variables, etc because with a complex application you can easily end up in the millions of lines code.

    Leave a Reply