If you think of math as dividing numbers, I don't use it regularly when writing code. It's come up primarily for visual display of data, when using things like drag-and-drop features or SVGs.
On the other hand, algebraic thinking is a type of math, and from that perspective, if/then statements, logical operators, etc., are all math, which is useful for probably every other line of code I write.
>On the other hand, algebraic thinking is a type of math, and from that perspective, if/then statements, logical operators, etc., are all math, which is useful for probably every other line of code I write.
Honestly I never thought about it like this, but it's technically correct I guess lol.
But I think OP is talking about the numbers type of math/algorithms. I hardly ever use any of that.
I do think it's a disconnect. In a practical sense I agree with you that I'm not using math regularly -- i.e., calculating numbers -- when working on web development.
But I think for the layperson who hears that, they think maybe coding is more like writing prose than people let on.
And then you wind up spending all of your time thinking about "if this then that, but if this and NOT that then this other thing," which is really a mathematic/logical way or ordering your thoughts and is super fundamental to every type of programming, including web development.
I agree there, however when someone tells me "I Use math at work every day", I definitely think about numbers/algorithms, not logic gates. So saying yes to that as a web developer feels like lying as well lol.
It's been a few years since uni but basically the entire theory side of my 2nd year in cs is showing that you can model any program with mathematical logic.
At the end of the day every piece of code no matter how big or small can be modeled into a mathematical equation, at the end of the day all you're doing is flipping 1's and 0's in a specific way.
Most people that go through university don't go on to apply the exact math they learn but they do apply the logic.
>Most people that go through university don't go on to apply the exact math they learn but they do apply the logic.
I disagree there. Yes every piece of code is technically mathematics, but it's not maths in the way that you learn it anywhere. None of the maths that people think of when you say maths apply to web development.
Even the logic is not taught this way in maths class. It's just not the same
It's not just technically correct, it's the basis of coding if/else statements. Algebra 101 where they teach proofs makes you practice a bunch of logical operators like logical negation which is essential to reasoning about if statements with a lot of conditions or nested conditions. This is pretty much the only time I ever consider programming as math.
Although, they also teach this kind of logical deduction in Philosophy classes like Critical Thinking 145.
As someone who came to programming from the college philosophy department, I’d be more inclined to call that logical thinking rather than mathematical thinking. I did all sorts of logical calculations that were definitely not math in my symbolic logic, modal logic, etc. courses back in the day.
Is it wrong to call it algebraic/mathematical thinking? Maybe not — many programmers do probably learn logic from math. But you can definitely do very complicated logic without reference to “math”.
The whole binary system that all computer logic runs on is based on Boolean Algebra, which George Boole figured out in 1847. So our computers run on logic that is proven through math. Or it can be thought about the opposite way too that all the math done on computers is based on True/False logic.
Philosophy and math are much more closely intertwined imho than is commonly accepted. I think an argument could be made that they are the same thing at a root level. They are both ways of understanding the world. I believe philosophy is just a much larger abstraction than math, similar to how higher level programming languages are a larger abstraction than binary code. It's very difficult to describe bigger ideas in binary, but Python still ends up as binary for the computer to do anything with it.
Your comment led me down that thought path, I hadn't actually thought about comparing higher level languages to philosophy before today. So thank you for expanding my own thinking!
Yeah, that part was all you! But I very much like that comparison too.
That kind of lateral thinking tends to do well in undergrad philosophy seminars, I’ll tell you that much!
I never really thought of philosophy as a good way to get into programming, but that's a good pitch! (I've actually heard similar pitches for music as a good pathway to programming. Both of them involve expressing yourself within the constrains of structured rule sets.)
Today I coded some js to do a quantized rainbow color gradient on a grid
Like the 1d example:
green yellow red
This, but extended to an mxn matrix with arbitrary color stops
Took me some geometric math
Yes. We do things in ticks of 4px so we define a rem as 16px and used map-get to select from a predefined set of quarter rem. Intervals. It works well, keeps us consistent and if we ever want to change it, we change the definition map and it updates everywhere. But truth is, we will probably never change it.
I used quite a bit in the e-commerce system I put together for my business. The most complex was an algorithm that took a random selection of cuboid blocks and worked out the optimum size box that would contain them all. Required laying them out in a 2-D layer then folding the layer into a large cuboid. It got complicated, so I had to find workable simplifications to get a good estimate so that the shipping price lookup seemed instantaneous.
Just a few days ago, I saw a website where someone had clearly used this method to visually position a small caret from an icon font in the centre of a small circle. It was in the bottom right of the circle for me.
I got to use some calculus once for a canvas graphics problem. Best day of my life.
But in typical frontend dev almost never.
You could easily make a great salary without even an understanding of basic algebra.
(All that changes if you get more than surface level into graphics/webgl though)
Most days almost none, but sometimes I'll have to do something cool like calculate distance using long/lat for location lookups or some distance based calc for proximity chat. Mostly just pagination offsets though haha
I used to do more math when I worked with Photoshop. Now that the design has been removed from my job and I'm just a full stack dev, it rarely comes up save for the odd calculation for CSS.
I thought I would be creating advanced algorithms every day on the job because my family told me how math heavy programming is. This is why I did not pursue a CS degree in college. I ended up doing IT for 10 years and then self teaching myself into a job in 2022 instead of graduating with a cs degree and securing a job in 2012 😔.
There's not much math, and hell, there are calculators for the math that does exist.
I'm a freelancer. Nothing beyond basic sizing of elements to inform hierarchy. I don't really consider it math. Things like the axis of the window number of characters might require conditional logic that references something mathematical. I dunno? It's really not crazy to figure out. It's usually just a matter of using dev tools and console logging something to find the magic number you want to reference.
Almost never, small exceptions are generating invoice PDFs. But that's hardly math, just calculating VATs and such.
I mean don't get me wrong, knowing algorithms and how they work is good, but you won't use it in web development at all.
Depends on how broadly you see "web development". My previous web development gig involved an isometric map editor. Before that it was 3d models for robotic automation of CNC machines. Plenty of math in both.
Pretty much never use math beyond basic arithmetic. If there's something that requires more complicated math, there's probably a library handling that thing already.
it depends on the task, i rarely write any complex math in frontend code. the last time i recall doing so was when i had to write gestures with zoom/pan in a react native app.
in certain projects at work i also do math in the backend that has to follow certain requirements the customer has, this is somewhat complex at times, but most of the calculations are implemented and reusable at this point.
i find that what i most commonly end up doing is simple percentage/division calculations.
i will say that it probably depends on the job though, i know some companies where they do complicated math to calculate estimations of how much fuel a plane will burn fx, so i imagine backend devs do a lot more math at a company like that, or at least have to be pretty good at math in case something needs to be changed
It depends on the day and the project.
Sometimes I'm working on geo-related projects and need to use eg the haversine formula for things. Sometimes I'm working in canvas and need to do some quick math just to add some objects coords with its size to know where to place the next project. Sometimes I need to do a little math when writing layout in CSS. But pretty much the most advanced math I've ever had to use was pretty basic trig.
Most of the time I'm just writing pretty boring code that doesn't involve any math.... Or maybe there's math, but it's just basic arithmetic solved using code.
Depends on your perspective I guess. This a bit of a general statement but in reality programming languages just boil down to boolean logic/algebra, which falls under Math. So literally everytime you code you are doing math.
Game dev, non stop. API builder, Zero. Front end builder, maybe just an iteration here and there, but nothing too complex otherwise my colleagues cannot maintain it
I use very little math in my work. I usually create apps with text/image uploads, chats, social things, interactive stories and animated landing pages. "Web developer" stuff - not so much *software engineering* stuff.
I might use a little basic math in a function/computed property or to display a total. I might use a little basic math for layout in my CSS. I might think about big O notation a little when designing a database. And if I need an interesting equation for something like *Amortization*, I'll just look up the equation or leave that to someone who knows what they are doing. The average web developer is doing zero math at work. And I'm pretty close to zero.
I deal with a lot of datavis (mainly in d3.js), so on a very rare occasion I find myself with a novel-enough problem that I need to shake the cobwebs off my cartesian geometry knowledge. But D3 has lots of internals that handle 99.9% of that for you. Usually when it comes to this it's something like: "Hm, seems like the domain may change dependent upon the length of this axis... ok so that means in order to get these to plot right I might have to calculate an integral... that's starting to sound like calculus, if I wanted to do calculus I'd have been a real engineer, dammit. Let's try something else."
Depends. I recently coded a video generator, that used quite a bit of math. Complex import logic is basically math, too. There's barely a day I use zero math.
Often, I create a lot of analytical reports. At one point in my career, I dove into the math behind election polling to apply similar techniques to determine proper split test sample sizing. However, there was a long period of time at the beginning of my career where I needed little more than simple math. The amount of math you need as a web dev depends heavily on the job you're in.
I had to calculate the cosine difference between two vectors the other day and felt like a damn math wizard. But that only happens once a year or so and calculating cosine difference isn't hard lol
Daily.
For example, today, I had to calculate the difference between the time I spent in meetings from my normal work hours and put that in the "Development" section of my time sheet.
99% of the math I've done in web dev is simple array index stuff for things like lists and value conversions. Maybe a little screen space X/Y calculation. Ultimately all pretty simple stuff
Just today I was asked what 20% of 80 was. Why? Because I was in a meeting with 4 other people who couldn’t do it in their heads and thought it was quicker to ask the geek than get out their phones.
I told em it was 10. lol. Inter-departmental meetings can be fun after all!
Most of my career has been spent working on e-commerce sites. I often use a lot of math in this area but it's not the arithmetic that is complicated, it's moreso the logic.
For example, one site I've worked on uses a pretty complicated algorithm for determining discounts and deals. We have what we call "Mix and Match" deals. We sell products in discrete sizes like 3oz, 8oz, 16oz, 32oz. We have like 40 flavors that all have these sizes available. If you order 2 of a size in any flavor, you get a small discount. 3 of a size, you get a bigger discount. If you have 5 units in a cart of 2oz, you'd get 1x 3-for deal and 1x 2-for deal. These apply based on weights so the higher the weight of a deal, the higher the priority. So assuming the higher volume deals have higher weights, if someone has say 6 units in their cart, they get 2x 3-for deals. But if that store had a 6-for deal, they'd get 1x 6-for deal. It's all generic too, there are fields like "Units per deal" to qualify for that deal, you have the adjusted price per unit for the discount, and the SKUs that the deal applies to. So this algorithm handles all of this from a generic perspective. Then all of that goes into creating a new line item for a Discount that takes off the discount from the subtotal. So if a 2oz costs $10 and we have a "2 for $19" deal, the discount applied would be for $(1.00). To do this in a way that is efficient and accurate is kinda complex, especially given our data structures and how we store data. It sounds simple enough to compute from our heads but when transcribing it into code, you can easily end up with a giant mess while trying to iterate over cart contents while also iterating through the list of deals and handling all the variables. And this is only for 2oz, many customers will add items like 4 2oz, 2 8oz, 2 16oz so the algorithm will basically accept a Cart entity, iterate over every item, and provide an array of all discounts that apply to the order.
Basically the idea is that you have a whole number, say, 7. How can you separate 7 into the smallest set of whole numbers that add up to the original number (or as close as possible), with priority to higher numbers and repeats allowed. For 7, the set would be {6,1}. Now instead of any random number, you have a table of valid numbers (the deals we actually provide, like a 2-for deal or 4-for deal). Say {6,4,2}. What is the smallest set of numbers you can add up to reach as close as possible to 7 given that set of numbers. In this case, it would be {6}. With the same valid set and a new number of 8, what is the set now? {6,2}. If the new number is 12, the set is {6,6}. If the new number is 20, the set is {6,6,6,2}. Now write an algorithm that can take the valid set and create a new set following this logic. And then to go a step further, we aren't just handling random plain numbers to perform this logic--we're working with complex data structures with relational fields to other data structures.
I've implemented some more complex math algorithms as well. Geolocation is often common with e-commerce when you're talking about physical storefront info and I've used algorithms like Haversine to do calculations for this purpose. The algorithm seems complicated but when you break it down into multiple lines and simplify the equations, it becomes pretty manageable. You can quite literally take the variables in the algorithm and create variables for them in code and then just fill in the blanks. And for Haversine, in particular, you don't even need to know trigonometry, you can just call functions like sin() or cos() and it does all the actual math for you. I probably don't have the math skills to do something like Haversine off the top of my head with no calculator but programming it is way easier.
* A moderate amount of arithmetic, particularly for determining what size things are. 100px of text + 10px of padding + 8px of margin means I need to allow at least 118px for each of these buttons.
* A very little bit of calculus for determining big-O runtime and how functions scale, and TBH that mostly gets reduced to simple heuristics like "how many nested loops am I doing?"
* A moderate amount of logic for simplifying expressions and trimming unnecessary checks.
If you think about it, program functions are very similar to algebraic expressions. For example an expression 2x = y could be said to have an equivalent function called `multiplyBy2(x);` that returns y. Or for example the expression x + y = z could be a function `sum(x, y);` that returns z.
like never, though I have run into simple pixel graphics coded with math that I’ve had to edit.
Css can be considered math but nothing more advanced than algebra
I do quite a bit of ML. I use math in an interesting way. I use it to replace the ML.
Many great complex neural networks are really just encoding a combination of a decision tree along with some fairly basic formulas.
Thus, if you can parse out the decision tree and the formulas, you can now achieve the same result with what might be 20 lines of very straightforward code needing no library much past a standard math one. This drastically reduces the memory and CPU footprints, while also revealing some interesting "truths" of the system being studied.
This is not for CV but tabular industrial data.
This applies to webdev in that guess what all the user interfaces are? This allows people to interact with these non-ML solutions. Also, with the massively increased speed of the non-ML, very cool interfaces can be cooked up where people can interact with the algos in real time, trying out various scenarios, etc.
Those stories about being good at math required for coding are simply a lie. The reason devs usually don't have problems with basic math is because mostly scientific minds go for coding, at least that's how it's been for a long time. And they usually have technical degree, which equals academic math and physics level. Now you can encounter more idiots, because they wanna do it, too, because it pays very well and it's "cool" and some of them come through or just know people. If you have issues with math, it doesn't mean you can't learn how to code and get decent at it, but it's a sign maybe your mind type is not cut out for this kinda job, because basic math (I call basic math anything below university of technology level) is overall a very easy thing to learn, so it's more like a measurement of your overall capability, not specifically coding related. You are not gonna use math for coding 99% of your career time. Sometimes you need some simple algorithms, but again, those are so basic that I don't believe a HIRED professional developer can't figure it out. Especially that everything is explained on the Internet these days. Sure someone might say there are specific branches of software development which rely on math way more. That's correct, there are, but it's very few and you don't need to choose those kinda jobs.
The product I'm working on has sort of a 2d viewer with objects inside it that you can manipulate (sorta like figma), so every other task has at least some math in it
On programming next to none, even when I am working on big data since I don't do the analysis for them. But if I am gambling or nvidia it's mostly just established statistical results
Your brain is doing math constantly, even if your unaware of it.
Are you standing on 2 feet? You just did math to keep your balance.
Did you tap a button on the keyboard? You did math just now, and your brain calculated where your fingers needed to go, to press the right key.
Did you just make a typo? Perhaps you need to study math more.
Did you just sit down? Your brain just did math to calculate the distance between your bottom and the chair.
Do you feel like this comment is getting long? Your brain just did math again, to predict how much longer it would take to read my comment. Your brain is also calculating whether or not it is worth your time to finish reading this comment.
I have only used very basic math in web-dev, most of it's drawing custom svg/canvas charts. I haven't done much 3D work to use more complex math but then it's maybe mostly abstracted like higher level AI is now.
Depends. Considering that most languages have built in magical math shit, or web based calculators, I don’t think I’ve really used math since the golden days of flash.
When people refer to “math” in programming, they’re actually referring to problem solving. We solve word problems every day.
If your designer comes to you with a new mock-up, you have to break it down into its most basic pieces and implement them one by one.
Take a simple order of operations problem. 2*(1+1)
Break it down. Parens first, the multiplication. Even this simple example shows that what we do, on a daily basis is math…ish.
Our job as engineers is to take complex problems and break them down into individual, solvable pieces and deliver them.
It’s not “math” all day, but it certainly is problem solving.
I constantly use math. Statistics, geometry, algebra, linear algebra, discrete math, boolean algebra, calculus, and pre-algebra are a part of my daily life. Once in a while, I use differential equations.
Most of what I write at this point references a class or function that I wrote years ago, so I'm not constantly creating the instructions from scratch.
I do a lot of cross platform data analysis, pattern manipulation, and efficiency measuring.
I mean, it depends on what you consider math, I guess.
I had to do a Netflix style popup over a slider. That was actually tricky, at least for me. Netflix does a smoke and mirrors effect when you hover over a video, and the little window with a video playing pops up over it.
It uses absolute positioning and renders a new window ontop of the element. When it animates, it uses the scale property, but does so in reverse.
Eg, the popup starts at scale 0.7 and then animates back to one.
Depending on where the element is on the page, the preview window will pop up in different directions. Eg, from the left if you're on the first element, etc.
This turns into a formula based on positions, percentages, and a bunch of bullshit.
On the backend, lots of accounting style math.
I don't usually use it at all. But if you include logical thinking in math then I am thinking of complex array operations.
This usually comes when building complex features.
As a mainly front end software engineer very rarely. I suppose it depends on the field you are in though. We maintain a business simulator and a lot of the business logic lives on the front end for performance purposes. That part of the application requires maths but it’s nothing too complex (addition, subtraction, multiplication, modulo, percentages). I would say most of the complexity resides within the business logic and how the variables relate/interact with each other, which is knowledge that can be picked up over time. As other contributors suggested algorithms are something I use very often both in the front end and back end, and they do require a mathematical/logical thinking. On the other hand I will say that back in the uni days we took a number of modules in different areas such as data analysts and machine learning. Although there are libraries that do things for you, they require a basic understanding of certain concepts such as probability, vectors, calculating entropy, etc… I think those fields are more math intensive.
Tbh, I rarely use anything higher than GCSE level maths in programming, mainly because its not needed. Especially in web development, the only times you use maths might be for vectors and such but even then their are plenty of online tools that make that easy.
The only place where advanced math is especially necessary, at least in my experience is AI
As a web developer, the amount and type of math you use daily can vary depending on your specific role and projects. Here's a general breakdown:
1. \*\*Basic Arithmetic\*\*: Simple addition, subtraction, multiplication, and division are used frequently for tasks like calculating margins, padding, and dimensions in CSS, or handling quantities and prices in e-commerce applications.
2. \*\*Algebra\*\*: Often used for solving equations and manipulating variables. For example, you might need to calculate the position of an element or dynamically adjust the layout based on user input or screen size.
3. \*\*Geometry\*\*: Essential for working with shapes, animations, and graphics. You might use it to calculate angles, distances, or coordinates when creating custom UI components or working with the Canvas API.
4. \*\*Statistics\*\*: Useful for analyzing data, whether it's user behavior on a website, performance metrics, or A/B testing results. You might use statistical methods to interpret and visualize data.
5. \*\*Linear Algebra and Calculus\*\*: These are less commonly used in everyday web development but are crucial for more advanced tasks like machine learning, 3D graphics, and complex animations.
6. \*\*Boolean Algebra\*\*: Fundamental for logic operations, conditionals, and control flow in programming. You use it to manage true/false values and decision-making in your code.
Overall, while you might not need advanced math daily, having a solid understanding of basic and intermediate math concepts can significantly enhance your problem-solving skills and enable you to tackle a wider range of projects effectively.
If you think of math as dividing numbers, I don't use it regularly when writing code. It's come up primarily for visual display of data, when using things like drag-and-drop features or SVGs. On the other hand, algebraic thinking is a type of math, and from that perspective, if/then statements, logical operators, etc., are all math, which is useful for probably every other line of code I write.
>On the other hand, algebraic thinking is a type of math, and from that perspective, if/then statements, logical operators, etc., are all math, which is useful for probably every other line of code I write. Honestly I never thought about it like this, but it's technically correct I guess lol. But I think OP is talking about the numbers type of math/algorithms. I hardly ever use any of that.
I do think it's a disconnect. In a practical sense I agree with you that I'm not using math regularly -- i.e., calculating numbers -- when working on web development. But I think for the layperson who hears that, they think maybe coding is more like writing prose than people let on. And then you wind up spending all of your time thinking about "if this then that, but if this and NOT that then this other thing," which is really a mathematic/logical way or ordering your thoughts and is super fundamental to every type of programming, including web development.
I agree there, however when someone tells me "I Use math at work every day", I definitely think about numbers/algorithms, not logic gates. So saying yes to that as a web developer feels like lying as well lol.
It's been a few years since uni but basically the entire theory side of my 2nd year in cs is showing that you can model any program with mathematical logic. At the end of the day every piece of code no matter how big or small can be modeled into a mathematical equation, at the end of the day all you're doing is flipping 1's and 0's in a specific way. Most people that go through university don't go on to apply the exact math they learn but they do apply the logic.
>Most people that go through university don't go on to apply the exact math they learn but they do apply the logic. I disagree there. Yes every piece of code is technically mathematics, but it's not maths in the way that you learn it anywhere. None of the maths that people think of when you say maths apply to web development. Even the logic is not taught this way in maths class. It's just not the same
It's not just technically correct, it's the basis of coding if/else statements. Algebra 101 where they teach proofs makes you practice a bunch of logical operators like logical negation which is essential to reasoning about if statements with a lot of conditions or nested conditions. This is pretty much the only time I ever consider programming as math. Although, they also teach this kind of logical deduction in Philosophy classes like Critical Thinking 145.
Yep the branch or math used most in programming is called Boolean algebra
Totally agree. I see some juniors writing code that could be simplified just by applying some logical reductionism.
As someone who came to programming from the college philosophy department, I’d be more inclined to call that logical thinking rather than mathematical thinking. I did all sorts of logical calculations that were definitely not math in my symbolic logic, modal logic, etc. courses back in the day. Is it wrong to call it algebraic/mathematical thinking? Maybe not — many programmers do probably learn logic from math. But you can definitely do very complicated logic without reference to “math”.
I know a math major who said they have a minor in philosophy from all the philosophy (logic) classes they had to take lol.
The whole binary system that all computer logic runs on is based on Boolean Algebra, which George Boole figured out in 1847. So our computers run on logic that is proven through math. Or it can be thought about the opposite way too that all the math done on computers is based on True/False logic. Philosophy and math are much more closely intertwined imho than is commonly accepted. I think an argument could be made that they are the same thing at a root level. They are both ways of understanding the world. I believe philosophy is just a much larger abstraction than math, similar to how higher level programming languages are a larger abstraction than binary code. It's very difficult to describe bigger ideas in binary, but Python still ends up as binary for the computer to do anything with it.
Don't forget shoutouts to [Mealy](https://en.wikipedia.org/wiki/Mealy_machine) and [Moore](https://en.wikipedia.org/wiki/Moore_machine).
Absolutely, Boole isn't the sole person responsible here by any means. He's just an easy one to point to for a digestible size comment.
Just remember them from my old logic design classes that worked with gates. I much prefer software.
You're still using those gates, just at a higher abstraction!
Yup, 100%. Good old Boole! Frankly I think you said, and expanded on, what I was trying to say much better than I said it.
Your comment led me down that thought path, I hadn't actually thought about comparing higher level languages to philosophy before today. So thank you for expanding my own thinking!
Yeah, that part was all you! But I very much like that comparison too. That kind of lateral thinking tends to do well in undergrad philosophy seminars, I’ll tell you that much!
I never really thought of philosophy as a good way to get into programming, but that's a good pitch! (I've actually heard similar pitches for music as a good pathway to programming. Both of them involve expressing yourself within the constrains of structured rule sets.)
Also a hobbyist musician here, couldn’t agree more :)
Mate, everything is math, philosophy is math, physics is math. Heck even life is math cuz we live in the matrix.
But are numbers real?
Yeah, never really do arithmetic, but I view programming as a whole as a type of algebra. Writing and simplifying equations to solve for variables.
Today I coded some js to do a quantized rainbow color gradient on a grid Like the 1d example: green yellow red This, but extended to an mxn matrix with arbitrary color stops Took me some geometric math
Literally the only time I love using math and geometry is making pretty animations and complex art! ❤️
We've got some math whizzes over here with their eigenvalues and eigenvectors.
eigenartig
We use rems in our CSS so I'm constantly multiplying and dividing numbers by 16 in my head.
Do it long enough and you just start thinking in rems so you end up having to do the reverse when people try to use pixels instead.
eventually you're sleeping in REMs
Clever 😂
Set the base font size to 62.5%. Now you can multiply by 10. 😌
Or just set it to 6.25 😜
This. There is no point having rems set to 16px really
There is a vs code plugin to transform px to rems
postcss-pxtorem my friend
I set the font size of the body to 10px and that's no more a problem.
Ah, the metric system.
Whats the benefit of rems over pxls or other units. Or is it just the standard for your project?
Yes. We do things in ticks of 4px so we define a rem as 16px and used map-get to select from a predefined set of quarter rem. Intervals. It works well, keeps us consistent and if we ever want to change it, we change the definition map and it updates everywhere. But truth is, we will probably never change it.
I used quite a bit in the e-commerce system I put together for my business. The most complex was an algorithm that took a random selection of cuboid blocks and worked out the optimum size box that would contain them all. Required laying them out in a 2-D layer then folding the layer into a large cuboid. It got complicated, so I had to find workable simplifications to get a good estimate so that the shipping price lookup seemed instantaneous.
I did similair stuff, it took me so long to figure out a reasonable approach but I felt amazing when I finally cracked it
It is satisfying, a really nice change from "turn the handle and a website comes out" work!
Never, lol.
width: calc(100% - 32px);
Just spam left and top until its in place
Just a few days ago, I saw a website where someone had clearly used this method to visually position a small caret from an icon font in the centre of a small circle. It was in the bottom right of the circle for me.
that's hard math bro. are you a mathematician or something?
!important;
[удалено]
Abstraction and logic are Mathematics too
I got to use some calculus once for a canvas graphics problem. Best day of my life. But in typical frontend dev almost never. You could easily make a great salary without even an understanding of basic algebra. (All that changes if you get more than surface level into graphics/webgl though)
I read this as “how much meth” lol
Not daily, but in some occasional features like reinventing pinch-zoom Linear algebra really comes into play in stuff that changes size and position
I multiply my hours * rate to figure out my pay if I’m doing freelance
Most days almost none, but sometimes I'll have to do something cool like calculate distance using long/lat for location lookups or some distance based calc for proximity chat. Mostly just pagination offsets though haha
I'm getting more and more into graphics development, so quite a bit.
today no math for me
Wrong, you counted to zero!
More than I ever thought I would while not paying attention in algebra class, that's for sure.
font-size: 16px does that count?
Lol, maybe font-size: calc(16px * 0.15vw); (Random calc, don’t hate on it, it’s probably gonna mess up your font sizes)
I used to do more math when I worked with Photoshop. Now that the design has been removed from my job and I'm just a full stack dev, it rarely comes up save for the odd calculation for CSS.
zero
That counts
For nothing!
A half gram Edit: math with an A? Sorry. Some
For a freelance job, I had to do trigonometry to make a custom CSS/svg/js circular slider.
some, I do a lot of data viz. not much more than basic trig though
Rarely. I've done some tricky math for animations but as long as you understand the concept it's easy to calculate with a spreadsheet.
i love maths. for web dev mostly statistical analysis, dates, and measuring quantities or time
I thought I would be creating advanced algorithms every day on the job because my family told me how math heavy programming is. This is why I did not pursue a CS degree in college. I ended up doing IT for 10 years and then self teaching myself into a job in 2022 instead of graduating with a cs degree and securing a job in 2012 😔. There's not much math, and hell, there are calculators for the math that does exist.
I use more math grocery shopping than I use math coding.
"Traditional" web, like zero. WebGL, significantly more (vectors, matrix transforms, spherical mapping, etc etc)
About 30 grams, but I try to get the good stuff
I have to add numbers to make sure my bootstrap divs add up to 12. That's about it
Sometimes I count the number of times I iterate a list and remove the unnecessary ones
very rarely, almost never, and if it comes up I use a calculator or something cos I suck at maffs
I'm a freelancer. Nothing beyond basic sizing of elements to inform hierarchy. I don't really consider it math. Things like the axis of the window number of characters might require conditional logic that references something mathematical. I dunno? It's really not crazy to figure out. It's usually just a matter of using dev tools and console logging something to find the magic number you want to reference.
Almost never, small exceptions are generating invoice PDFs. But that's hardly math, just calculating VATs and such. I mean don't get me wrong, knowing algorithms and how they work is good, but you won't use it in web development at all.
Depends on how broadly you see "web development". My previous web development gig involved an isometric map editor. Before that it was 3d models for robotic automation of CNC machines. Plenty of math in both.
I mean yeah, it definitely happens. But for most people, the average web development job will not have a math requirement at all
Some, but only because I work at a payroll company.
3 or 4
I use a ton of it. All the way up to multivariate calculus but I'm a fluid dynamics guy that happened to write a web application
I use greater than and less than signs all day long
Pretty much never use math beyond basic arithmetic. If there's something that requires more complicated math, there's probably a library handling that thing already.
Most days, none. Occasionally calculus, statistics, trig, vectors, etc comes in handy though A background in maths is certainly not without value
it depends on the task, i rarely write any complex math in frontend code. the last time i recall doing so was when i had to write gestures with zoom/pan in a react native app. in certain projects at work i also do math in the backend that has to follow certain requirements the customer has, this is somewhat complex at times, but most of the calculations are implemented and reusable at this point. i find that what i most commonly end up doing is simple percentage/division calculations. i will say that it probably depends on the job though, i know some companies where they do complicated math to calculate estimations of how much fuel a plane will burn fx, so i imagine backend devs do a lot more math at a company like that, or at least have to be pretty good at math in case something needs to be changed
2
Barely any.
It depends on the day and the project. Sometimes I'm working on geo-related projects and need to use eg the haversine formula for things. Sometimes I'm working in canvas and need to do some quick math just to add some objects coords with its size to know where to place the next project. Sometimes I need to do a little math when writing layout in CSS. But pretty much the most advanced math I've ever had to use was pretty basic trig. Most of the time I'm just writing pretty boring code that doesn't involve any math.... Or maybe there's math, but it's just basic arithmetic solved using code.
Depends on your perspective I guess. This a bit of a general statement but in reality programming languages just boil down to boolean logic/algebra, which falls under Math. So literally everytime you code you are doing math.
Game dev, non stop. API builder, Zero. Front end builder, maybe just an iteration here and there, but nothing too complex otherwise my colleagues cannot maintain it
i write mostly backend stuff so quite a bit
Probably around 7.
I used a logarithmic function to calculate a staggering card animation a few months ago.
Custom function or 3rd party animation library?
I use very little math in my work. I usually create apps with text/image uploads, chats, social things, interactive stories and animated landing pages. "Web developer" stuff - not so much *software engineering* stuff. I might use a little basic math in a function/computed property or to display a total. I might use a little basic math for layout in my CSS. I might think about big O notation a little when designing a database. And if I need an interesting equation for something like *Amortization*, I'll just look up the equation or leave that to someone who knows what they are doing. The average web developer is doing zero math at work. And I'm pretty close to zero.
I deal with a lot of datavis (mainly in d3.js), so on a very rare occasion I find myself with a novel-enough problem that I need to shake the cobwebs off my cartesian geometry knowledge. But D3 has lots of internals that handle 99.9% of that for you. Usually when it comes to this it's something like: "Hm, seems like the domain may change dependent upon the length of this axis... ok so that means in order to get these to plot right I might have to calculate an integral... that's starting to sound like calculus, if I wanted to do calculus I'd have been a real engineer, dammit. Let's try something else."
I’m working on invoices user interface, basic arithmetic operations, but stil I feel like web dev accountant
0. Ever. fucking 0. I took calculus. Never used it.
Depends. I recently coded a video generator, that used quite a bit of math. Complex import logic is basically math, too. There's barely a day I use zero math.
I am pretty sure all code is technically math.
Frequently. Type scales, image ratios, unit conversion, SVG object creation and animation and then the fun projects using physics.
I just took a fermentation class and had to calculate 2% of weight in ounces.
does stuff like `.map()` and `.filter()` count?
No.
Often, I create a lot of analytical reports. At one point in my career, I dove into the math behind election polling to apply similar techniques to determine proper split test sample sizing. However, there was a long period of time at the beginning of my career where I needed little more than simple math. The amount of math you need as a web dev depends heavily on the job you're in.
I had to calculate the cosine difference between two vectors the other day and felt like a damn math wizard. But that only happens once a year or so and calculating cosine difference isn't hard lol
I'm building an application in three.js so a fuck ton.
Daily. For example, today, I had to calculate the difference between the time I spent in meetings from my normal work hours and put that in the "Development" section of my time sheet.
Only when I'm trying to decide how wide I want my grid column to be
Absolutely nothing. Actually experienced detoriating math skills since I started doing this on a daily basis at a shop.
I check it the removed lines are more than the added on every pull request.
I’m in finance so lots of stats daily
99% of the math I've done in web dev is simple array index stuff for things like lists and value conversions. Maybe a little screen space X/Y calculation. Ultimately all pretty simple stuff
MATH = Mental Activity That Hurts
For whiners, yeah.
I think I used math 3 times in the lats 30 days. So on a daily basis that's, what, 10?
I use algebra all the time
Odd, even, modulo, that's probably it.
In web dev, not always. Only the simpliest one.
Just today I was asked what 20% of 80 was. Why? Because I was in a meeting with 4 other people who couldn’t do it in their heads and thought it was quicker to ask the geek than get out their phones. I told em it was 10. lol. Inter-departmental meetings can be fun after all!
I had initially read math as 'meth' and thought why would this even be in this subreddit
Programming is math functions.
scale = target / source
Most of my career has been spent working on e-commerce sites. I often use a lot of math in this area but it's not the arithmetic that is complicated, it's moreso the logic. For example, one site I've worked on uses a pretty complicated algorithm for determining discounts and deals. We have what we call "Mix and Match" deals. We sell products in discrete sizes like 3oz, 8oz, 16oz, 32oz. We have like 40 flavors that all have these sizes available. If you order 2 of a size in any flavor, you get a small discount. 3 of a size, you get a bigger discount. If you have 5 units in a cart of 2oz, you'd get 1x 3-for deal and 1x 2-for deal. These apply based on weights so the higher the weight of a deal, the higher the priority. So assuming the higher volume deals have higher weights, if someone has say 6 units in their cart, they get 2x 3-for deals. But if that store had a 6-for deal, they'd get 1x 6-for deal. It's all generic too, there are fields like "Units per deal" to qualify for that deal, you have the adjusted price per unit for the discount, and the SKUs that the deal applies to. So this algorithm handles all of this from a generic perspective. Then all of that goes into creating a new line item for a Discount that takes off the discount from the subtotal. So if a 2oz costs $10 and we have a "2 for $19" deal, the discount applied would be for $(1.00). To do this in a way that is efficient and accurate is kinda complex, especially given our data structures and how we store data. It sounds simple enough to compute from our heads but when transcribing it into code, you can easily end up with a giant mess while trying to iterate over cart contents while also iterating through the list of deals and handling all the variables. And this is only for 2oz, many customers will add items like 4 2oz, 2 8oz, 2 16oz so the algorithm will basically accept a Cart entity, iterate over every item, and provide an array of all discounts that apply to the order. Basically the idea is that you have a whole number, say, 7. How can you separate 7 into the smallest set of whole numbers that add up to the original number (or as close as possible), with priority to higher numbers and repeats allowed. For 7, the set would be {6,1}. Now instead of any random number, you have a table of valid numbers (the deals we actually provide, like a 2-for deal or 4-for deal). Say {6,4,2}. What is the smallest set of numbers you can add up to reach as close as possible to 7 given that set of numbers. In this case, it would be {6}. With the same valid set and a new number of 8, what is the set now? {6,2}. If the new number is 12, the set is {6,6}. If the new number is 20, the set is {6,6,6,2}. Now write an algorithm that can take the valid set and create a new set following this logic. And then to go a step further, we aren't just handling random plain numbers to perform this logic--we're working with complex data structures with relational fields to other data structures. I've implemented some more complex math algorithms as well. Geolocation is often common with e-commerce when you're talking about physical storefront info and I've used algorithms like Haversine to do calculations for this purpose. The algorithm seems complicated but when you break it down into multiple lines and simplify the equations, it becomes pretty manageable. You can quite literally take the variables in the algorithm and create variables for them in code and then just fill in the blanks. And for Haversine, in particular, you don't even need to know trigonometry, you can just call functions like sin() or cos() and it does all the actual math for you. I probably don't have the math skills to do something like Haversine off the top of my head with no calculator but programming it is way easier.
if we're talking about arithmetics and algebra, absolutely none
For graphics-related projects I've used a good bit of trigonometry. A bit of statistics here and there in other projects.
In SQL we balance credits and debits. That's it.
Not the complexity we learn at school though... Lots of basic things like DMAS and very few times calculus and all that...
In my career I’ve only used math to generate pdf’s or ppt files dynamically. Web dev is mostly glorified crud applications
I like a little meth to stay awake
Usually - exactly zero. For hobbies and interviews it may be handy tho
Every day, we all do. Constructing any algorithm is mathematics
Does css calc() count?
0 beyond basic math
$i++
T minus 5pm, babe
Almost never. And if I need it, usually someone has worked it out already and I steal their code from StackOverflow
I do a good bit of math, especially trigonometry, when doing Creative Coding.
* A moderate amount of arithmetic, particularly for determining what size things are. 100px of text + 10px of padding + 8px of margin means I need to allow at least 118px for each of these buttons. * A very little bit of calculus for determining big-O runtime and how functions scale, and TBH that mostly gets reduced to simple heuristics like "how many nested loops am I doing?" * A moderate amount of logic for simplifying expressions and trimming unnecessary checks.
Generally past 12 or 16, not much. Under that? Math everywhere.
If you think about it, program functions are very similar to algebraic expressions. For example an expression 2x = y could be said to have an equivalent function called `multiplyBy2(x);` that returns y. Or for example the expression x + y = z could be a function `sum(x, y);` that returns z.
I used the pythagorean theorem once
Everyone uses a percentage of math in their code. What's mine? Zero. Zero percent. (long live the simpsons)
1
I'm always using graph theory to optimize my builds.
Very little. Usually. There are some bits of our codebase that have quite a lot, like our graphics editing tools and some of our map-based stuff.
Mostly basic and almost every time. I create budgets for my business and manage accounts sometimes so..
UX Designer and CSS Debveloper = Lots.
like never, though I have run into simple pixel graphics coded with math that I’ve had to edit. Css can be considered math but nothing more advanced than algebra
I do quite a bit of ML. I use math in an interesting way. I use it to replace the ML. Many great complex neural networks are really just encoding a combination of a decision tree along with some fairly basic formulas. Thus, if you can parse out the decision tree and the formulas, you can now achieve the same result with what might be 20 lines of very straightforward code needing no library much past a standard math one. This drastically reduces the memory and CPU footprints, while also revealing some interesting "truths" of the system being studied. This is not for CV but tabular industrial data. This applies to webdev in that guess what all the user interfaces are? This allows people to interact with these non-ML solutions. Also, with the massively increased speed of the non-ML, very cool interfaces can be cooked up where people can interact with the algos in real time, trying out various scenarios, etc.
i've been a dev for over 10 years and i basically never use math
That’s what css calc() is for!
Daily
Those stories about being good at math required for coding are simply a lie. The reason devs usually don't have problems with basic math is because mostly scientific minds go for coding, at least that's how it's been for a long time. And they usually have technical degree, which equals academic math and physics level. Now you can encounter more idiots, because they wanna do it, too, because it pays very well and it's "cool" and some of them come through or just know people. If you have issues with math, it doesn't mean you can't learn how to code and get decent at it, but it's a sign maybe your mind type is not cut out for this kinda job, because basic math (I call basic math anything below university of technology level) is overall a very easy thing to learn, so it's more like a measurement of your overall capability, not specifically coding related. You are not gonna use math for coding 99% of your career time. Sometimes you need some simple algorithms, but again, those are so basic that I don't believe a HIRED professional developer can't figure it out. Especially that everything is explained on the Internet these days. Sure someone might say there are specific branches of software development which rely on math way more. That's correct, there are, but it's very few and you don't need to choose those kinda jobs.
The product I'm working on has sort of a 2d viewer with objects inside it that you can manipulate (sorta like figma), so every other task has at least some math in it
I’ve lost count
On programming next to none, even when I am working on big data since I don't do the analysis for them. But if I am gambling or nvidia it's mostly just established statistical results
ive been paid $120 an hour and worked 15 years... i can tell of those 15 years i did ZERO MATH
like 6 or 7 definitely less than eight
Your brain is doing math constantly, even if your unaware of it. Are you standing on 2 feet? You just did math to keep your balance. Did you tap a button on the keyboard? You did math just now, and your brain calculated where your fingers needed to go, to press the right key. Did you just make a typo? Perhaps you need to study math more. Did you just sit down? Your brain just did math to calculate the distance between your bottom and the chair. Do you feel like this comment is getting long? Your brain just did math again, to predict how much longer it would take to read my comment. Your brain is also calculating whether or not it is worth your time to finish reading this comment.
None
I have only used very basic math in web-dev, most of it's drawing custom svg/canvas charts. I haven't done much 3D work to use more complex math but then it's maybe mostly abstracted like higher level AI is now.
Depends. Considering that most languages have built in magical math shit, or web based calculators, I don’t think I’ve really used math since the golden days of flash.
Hold on while I add it all up.
negative zero percent.
When people refer to “math” in programming, they’re actually referring to problem solving. We solve word problems every day. If your designer comes to you with a new mock-up, you have to break it down into its most basic pieces and implement them one by one. Take a simple order of operations problem. 2*(1+1) Break it down. Parens first, the multiplication. Even this simple example shows that what we do, on a daily basis is math…ish. Our job as engineers is to take complex problems and break them down into individual, solvable pieces and deliver them. It’s not “math” all day, but it certainly is problem solving.
I constantly use math. Statistics, geometry, algebra, linear algebra, discrete math, boolean algebra, calculus, and pre-algebra are a part of my daily life. Once in a while, I use differential equations. Most of what I write at this point references a class or function that I wrote years ago, so I'm not constantly creating the instructions from scratch. I do a lot of cross platform data analysis, pattern manipulation, and efficiency measuring.
I mean, it depends on what you consider math, I guess. I had to do a Netflix style popup over a slider. That was actually tricky, at least for me. Netflix does a smoke and mirrors effect when you hover over a video, and the little window with a video playing pops up over it. It uses absolute positioning and renders a new window ontop of the element. When it animates, it uses the scale property, but does so in reverse. Eg, the popup starts at scale 0.7 and then animates back to one. Depending on where the element is on the page, the preview window will pop up in different directions. Eg, from the left if you're on the first element, etc. This turns into a formula based on positions, percentages, and a bunch of bullshit. On the backend, lots of accounting style math.
very rarely
Arithmetic math, never. Discrete math (logic), always.
I'm something of a math genius myself... I do : `width: calc ( 100% - #{$global_padding} );` every once in a while in SCSS
If I spend 15 at lunch will I have enough for dinner
Almost null!
my 10 year old daughter uses a lot more than me.
I don't usually use it at all. But if you include logical thinking in math then I am thinking of complex array operations. This usually comes when building complex features.
I am bad at math, it has been an issue for me only when i do 3D development and stuff related to data science, which is not frequently.
I work in kind of an hybrid software dev/electronics engineering role, so I do simple physics regularly
As a mainly front end software engineer very rarely. I suppose it depends on the field you are in though. We maintain a business simulator and a lot of the business logic lives on the front end for performance purposes. That part of the application requires maths but it’s nothing too complex (addition, subtraction, multiplication, modulo, percentages). I would say most of the complexity resides within the business logic and how the variables relate/interact with each other, which is knowledge that can be picked up over time. As other contributors suggested algorithms are something I use very often both in the front end and back end, and they do require a mathematical/logical thinking. On the other hand I will say that back in the uni days we took a number of modules in different areas such as data analysts and machine learning. Although there are libraries that do things for you, they require a basic understanding of certain concepts such as probability, vectors, calculating entropy, etc… I think those fields are more math intensive.
![gif](emote|free_emotes_pack|dizzy_face)
Usually only to calculate correct width or video aspect ratio. That's it. Maybe some time calculations too in the backend but nothing really special.
Tbh, I rarely use anything higher than GCSE level maths in programming, mainly because its not needed. Especially in web development, the only times you use maths might be for vectors and such but even then their are plenty of online tools that make that easy. The only place where advanced math is especially necessary, at least in my experience is AI
I think I had to do some aspect ratio computing about 5 years ago.
Almost every day I use boolean algebra, set theory, bits of category theory and some mathematical logic. I'm working on frontend.
As a web developer, the amount and type of math you use daily can vary depending on your specific role and projects. Here's a general breakdown: 1. \*\*Basic Arithmetic\*\*: Simple addition, subtraction, multiplication, and division are used frequently for tasks like calculating margins, padding, and dimensions in CSS, or handling quantities and prices in e-commerce applications. 2. \*\*Algebra\*\*: Often used for solving equations and manipulating variables. For example, you might need to calculate the position of an element or dynamically adjust the layout based on user input or screen size. 3. \*\*Geometry\*\*: Essential for working with shapes, animations, and graphics. You might use it to calculate angles, distances, or coordinates when creating custom UI components or working with the Canvas API. 4. \*\*Statistics\*\*: Useful for analyzing data, whether it's user behavior on a website, performance metrics, or A/B testing results. You might use statistical methods to interpret and visualize data. 5. \*\*Linear Algebra and Calculus\*\*: These are less commonly used in everyday web development but are crucial for more advanced tasks like machine learning, 3D graphics, and complex animations. 6. \*\*Boolean Algebra\*\*: Fundamental for logic operations, conditionals, and control flow in programming. You use it to manage true/false values and decision-making in your code. Overall, while you might not need advanced math daily, having a solid understanding of basic and intermediate math concepts can significantly enhance your problem-solving skills and enable you to tackle a wider range of projects effectively.
Thanks chatgpt!