Page 428 -
P. 428

leftovers


          #8: Algorithms


           There are plenty of great books that believe it’s impossible to learn
           about programming without also learning about algorithms.
           The word “algorithm” is used to describe a precise and established
           way of solving a particular problem in any programming language.
           It’s often useful to think of an algorithm as a recipe.
           In the good ol’ days, it was certainly true that every programmer had
           to have a good grasp of algorithms in order to get anything of any
           worth done. But, luckily for you, this is no longer the case.
           Nowadays, with programming technologies such as Python (and
           Ruby, Perl, Java, and C#), this is less of an issue because modern
           programming languages just do so much for you.

           For instance, if you need to sort something in Python, you either
           call the sort() method on a object or use the built-in sorted()
           function, and the thing you are working with is duly sorted. You are
           probably less concerned (and rightly so) with how the sort actually
           occurred—that is, with the details of the algorithm used to sort your
           data. Was it the quicksort algorithm or the bubblesort? Maybe it was
           timsort or something else entirely? Maybe you don’t care, because
           calling sort() or using sorted() orders your data in the way you
           desire and frees you to move onto some other problem that needs
           solving.
          You could take the time to write a really cool sort function and learn
           lots about algorithms in the process but, let’s face it, life is far too short.
           If you want to write your own programming language, you’ll need
           to learn lots about algorithms. If all you want to do is use an existing
           programming language (like Python), you can worry less about
           algorithms and more about writing code, which is precisely how it
           should be (in our opinion).




















                                                                                      you are here 4    393
   423   424   425   426   427   428   429   430   431   432   433