Sorry, the question in title sounds naive. I have no doubt that math is essential in programming, but I am thinking about philosophy of programming and want to summarize when they’re needed in programming. My attempt is below:

Most applications of programming are making electronics do things through their interfaces. Whether that’s telling a screen to display something, a network wire to transport data, a hard disk to persist data.

But we often need math because we often transform data, or we might make said electronics do things based on user input, or an event. Transforming an event to data is a mathematical construction.

Some applications are almost purely mathematical, like banking, crypto currency, or encryption.

In your opinion, does this fully explain why we need math in programming? Is there a better way to sum it up?

  • floofloof@lemmy.ca
    link
    fedilink
    English
    arrow-up
    4
    ·
    edit-2
    4 months ago

    It’s important to be able to reason about performance, even in ordinary business computing. If you pick the wrong data structure or algorithm, you can create memory problems, speed bottlenecks, etc. Even if you always use libraries it helps to understand the algorithms and structures they use so you can build efficient software.

    And in game programming some knowledge of algorithms and data structures is very valuable. You often have to direct the behaviour of many objects at once in real time and, efficiency is really important.

    Without this background knowledge you won’t recognize how the problem you are faced with is best addressed by a particular well-known algorithm. Recently, for example, I worked on a business problem that turned out to be tractable by arranging data into a graph and finding optimal pathways through the graph. This wasn’t obvious from the initial problem description. And for a game I needed to learn about N-body algorithms and how to efficiently approximate gravitational forces between many objects.

    I wouldn’t say you need advanced math to do these kinds of programming, but you do need to know when it’s time to defer to other people’s expertise and tried-and-tested data structures and algorithms.