|
How much math is required to learn javascript or php?
02-19-2010, 09:56 PM
|
How much math is required to learn javascript or php?
|
Posts: 7
|
Just about done learning HTML/CSS and will probably venture off to javascript next. When I went to take programming class for C++, it requires that I take rigorous math courses.
Is this the same for javascript and php? What sort of math is involve in this?
Thanks.
|
|
|
|
02-20-2010, 12:20 AM
|
Re: How much math is required to learn javascript or php?
|
Posts: 2,815
Name: Matt
Location: Irvine, CA
|
There is next to no math involved in just writing code (granted this depends on the program you are writing). If you know how to add and subtract you can learn to write code. If you want to determine the time and memory complexity of an algorithm you're going to need a bit more.
In general, the further you move away from programming and the closer you get to computer science, the more math you'll need.
|
|
|
|
02-20-2010, 04:38 AM
|
Re: How much math is required to learn javascript or php?
|
Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
|
Agree. Math where never my strongest point in school, and it never had handicaped me in programming.
Except for that one time where I had to implement the computing of a distance between 2 points given by latitude/longitude.
But if you ever had something like this to solve, and with internet at disposal, you won't have much problems solving it.
Thanks again, Google...
__________________
Only a biker knows why a dog sticks his head out the window.
|
|
|
|
02-22-2010, 11:51 AM
|
Re: How much math is required to learn javascript or php?
|
Posts: 3,987
Name: Abel Mohler
Location: Asheville, North Carolina USA
|
I've always been pretty good at math, and it helps me when doing client-side programming (JavaScript). I've built a couple of things that I needed to calculate positions on the screen with a limited amount of data available to me, so math was pretty important for this. However, for me, it was more a matter of drawing diagrams and eliminating what I didn't need, like a logical reduction to find the answer I needed.
People that are good at math tend to be able to be good programmers, since math is pure logic. But we have more freedom since programming is more about creative solutions to problems using logical steps than finding the one and only answer to fit the solution. There are also more skills involved such as pattern recognition and memorization that are mostly intuitive and not purely mathematical.
I've never been a computer science student, but my understanding is that students often study linguistics to better understand the language of computers. I don't know if this is true or not any more, but it makes sense, seeing how computer languages have evolved to be understandable like a reduced real language.
__________________
I build web things. I work for the startup Please login or register to view this content. Registration is FREE
.
|
|
|
|
02-23-2010, 01:02 AM
|
Re: How much math is required to learn javascript or php?
|
Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
|
I have a BA in math with a minor in CIS (Computer Information Systems). Mathematical knowledge comes into play in a variety of instances in coding where non-mathematically-oriented individuals will have more trouble than those with a background. Namely,
1) Logic. I'd suggest this is the fundamental reason for requiring mathematical knowledge. Logic will help you significantly in determining a best routine. I don't mean "common sense", but mathematical logic.
2) Knowing the difference between rounding, flooring, and ceiling functions
3) Understanding order of operations -- these are applicable for conditional expressions.
4) On a more advanced level, Big-O calculations to increase efficiency.
Also, in many elementary coding classes, problems are presented where you need to find an unknown. Being able to take a word problem, convert it to an equation, solve it, and then express it as code is a big help.
Finally -- for this post -- knowing different bases (e.g. binary, decimal, and hex) will make many tasks easier.
__________________
Jeremy Miller
Please login or register to view this content. Registration is FREE
|
|
|
|
02-23-2010, 03:53 AM
|
Re: How much math is required to learn javascript or php?
|
Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
|
Quote:
1) Logic. I'd suggest this is the fundamental reason for requiring mathematical knowledge. Logic will help you significantly in determining a best routine. I don't mean "common sense", but mathematical logic.
2) Knowing the difference between rounding, flooring, and ceiling functions
3) Understanding order of operations -- these are applicable for conditional expressions.
4) On a more advanced level, Big-O calculations to increase efficiency.
|
For the first point, do you relate it to your studies ?
I always had an curious mind, tearing my toys open as a kid to understand how they work, reading VCR schematics later for the same reason.
Trying to repair everything that broke on my own, even when the product was under warranty, just to try it.
Sure, math can help you develop a logical mind, but I believe that some people can have such a tendency without having to learn them.
The day I was introduced to OOp, it made so much sense to me that my first question was "Why haven't every (programming) languages been designed that way ?", which made my "mentor" chuckle.
For the second point, I find it hard to understand, honestly.
I am not a native English speaker, but even just the semantic of those words is way enough to understand what they means.
And those concepts are not very abstracts..
The third point is in fact scaring me....
The order of operations is something I learned between the 4th and 7th year of my mandatory school cursus.
Don't tell me that students, anywhere where there is basic mathematics, don't learn that multiplication and division are of an higher priority than additions and substractions (not sure about that word, but you understand me.)
The fourth point is the main reason I regret not having that background. Because that, I think, is something a lot harder to acquire without being taught.
__________________
Only a biker knows why a dog sticks his head out the window.
|
|
|
|
02-25-2010, 04:15 PM
|
Re: How much math is required to learn javascript or php?
|
Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
|
Quote:
Originally Posted by tripy
For the first point, do you relate it to your studies ?
I always had an curious mind, tearing my toys open as a kid to understand how they work, reading VCR schematics later for the same reason.
Trying to repair everything that broke on my own, even when the product was under warranty, just to try it.
|
Yes, I learned that in my "Introduction to Mathematical Logic" class.
For instance, if (!$a || !$b) is the same as if (!($a && $b)). That's the logic part, but then the coder brain must ask which will be solved faster. For example, given that the expression is evaluated left-to-right, if $a is more likely to be true, we could very often skip the evaluation of !$b, reducing the calculation by 1 calculation (yes, a minor savings in this instance, but we're working with a simple example). The equivalency, on the otherhand, will always require a full evaluation because the ! must be evaluated after the inner parenthesis.
As a more realistic, English example: "If the user is not logged in or does not have access, then ..." is the same as "if the user is logged in and the user has access is a false statement, then ...".
Sometimes we get much more complicated expressions and knowing how to simplify and reduce them while maintaining logical equivalency can mean the difference between an efficient and a less-efficient routine.
Quote:
Originally Posted by tripy
For the second point, I find it hard to understand, honestly.
I am not a native English speaker, but even just the semantic of those words is way enough to understand what they means.
And those concepts are not very abstracts..
|
I've seen people write code like this:
PHP Code:
$number_of_required_things = $number_of_smaller_things/$number_of_things_in_a_package;
if ((int)$number_of_required_things < $number_of_required_things) {
$number_of_required_things++;
}
where they could have just written
PHP Code:
$number_of_required_things = ceil($number_of_smaller_things/$number_of_things_in_a_package);
Having never heard of ceil, they found a way to achieve their goal, but it's less efficient. Sometimes, they've even committed this error:
PHP Code:
$number_of_required_things = round($number_of_smaller_things/$number_of_things_in_a_package);
Which would underestimate in some cases.
I know the variables are well-named, but just to help in the understanding, an example of such a routine would be a solution to the problem: If I have 654 apples and 25 apples fit in a box, how many boxes will I need?
__________________
Jeremy Miller
Please login or register to view this content. Registration is FREE
|
|
|
|
02-25-2010, 06:00 PM
|
Re: How much math is required to learn javascript or php?
|
Posts: 3,987
Name: Abel Mohler
Location: Asheville, North Carolina USA
|
PHP Code:
$apples = 654; $per_box = 25; $in_box = 0; $total_boxes = 0; for($i = 1; $i <= $apples; $i++) { $in_box++; if($in_box == $per_box) { $total_boxes++; $in_box = 0; } } if($in_box != 0) { $total_boxes++; }
Wait, you mean there's an easier way?
__________________
I build web things. I work for the startup Please login or register to view this content. Registration is FREE
.
|
|
|
|
02-25-2010, 06:51 PM
|
Re: How much math is required to learn javascript or php?
|
Posts: 10,815
Name: Steven Bradley
Location: Boulder, Colorado
|
Interesting conversation. With the original question you don't need to know math to be a programmer, though it's already been pointed out how the two connect. I think a lot of it comes down to logic and while you don't need to take classes to learn how to be logical keep in mind that from a schools point of view that's how they want to see you learn logic skills. In part it's simply because to them it's an easy way to guarantee you've been presented that kind of information.
|
|
|
|
02-25-2010, 07:56 PM
|
Re: How much math is required to learn javascript or php?
|
Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
|
Too funny!
Quote:
Originally Posted by wayfarer07
PHP Code:
$apples = 654; $per_box = 25; $in_box = 0; $total_boxes = 0; for($i = 1; $i <= $apples; $i++) { $in_box++; if($in_box == $per_box) { $total_boxes++; $in_box = 0; } } if($in_box != 0) { $total_boxes++; }
Wait, you mean there's an easier way?
|
__________________
Jeremy Miller
Please login or register to view this content. Registration is FREE
|
|
|
|
02-25-2010, 08:17 PM
|
Re: How much math is required to learn javascript or php?
|
Posts: 3,987
Name: Abel Mohler
Location: Asheville, North Carolina USA
|
The programming equivalent of counting on one's fingers...
__________________
I build web things. I work for the startup Please login or register to view this content. Registration is FREE
.
|
|
|
|
02-28-2010, 12:07 PM
|
Re: How much math is required to learn javascript or php?
|
Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
|
Interesting how such conversations occur and then we get a thread like http://www.webmaster-talk.com/php-fo...unding-up.html to provide an opportunity to demonstrate.
__________________
Jeremy Miller
Please login or register to view this content. Registration is FREE
|
|
|
|
02-28-2010, 05:22 PM
|
Re: How much math is required to learn javascript or php?
|
Posts: 2,815
Name: Matt
Location: Irvine, CA
|
I read something today that I think demonstrates very well the relationship between math and programming: http://www.robweir.com/blog/2010/02/...er-ballot.html
|
|
|
|
|
« Reply to How much math is required to learn javascript or php?
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|