Tagged: C++ Toggle Comment Threads | Keyboard Shortcuts

  • Michael Krakovskiy 5:17 am on February 18, 2005 Permalink | Reply
    Tags: C++, , , , Functional languages, functional programming, , , , Procedural programming, , , , Source code, Subroutine, Variable,   

    Side Effects Of Programming 

    “Nelson: Ah, he’s the greatest showman since that kid who eats worms!
    Kid Who Eats Worms: My 15 minutes of fame are over!”
    The Simpsons, Episode 3G02

    The post about Durian seems to have been the most popular one in the recent history of deadprogrammer.com . This once again proves that eating gross things is entertaining to the masses. To prevent the surging popularity of my blog I absolutely must write a little bit about something that I almost never write about. Programming.

    My co-worker who could not understand why he could not increment a variable in XSLT found an amazing piece of technical writing in an O’Reilly book about XSLT. Here it is:

    “Although these XSLT variables are called variables, they’re not variables in the traditional sense of procedural programming languages like C++ or Java. Remember that earlier we said one goal behind the design of the stylesheet language is to avoid side effects in execution? Well, one of the most common side effects used in most procedural languages is changing the value of a variable. If we write our stylesheet so that the results depend on the varying values of different variables, the stylesheet engine would be forced to evaluate the templates in a certain order.

    XSLT variables are more like variables in the traditional mathematical sense. In mathematics, we can define a function called square(x) that returns the value of a number (represented by x) multiplied by itself. In other words, square(2.5) returns 6.25. In this context, we understand that x can be any number; we also understand that the square function can’t change the value of x.

    It takes a while to get used to this concept, but you’ll get there. Trust me on this.”

    (full text here)

    The quote that I highlighted in bold absolutely gets me. Yeah, that’s one good side effect. I get the feeling that XSLT was committee designed with the specific purpose to make life miserable for programmers. Also that committee must have had some really good stuff to smoke.

    Uh, see, now this is what happens when you try to write programs without actually understanding computer science fundamentals. I did not realize that XSLT was functional, not procedural. Like most mediocre programmers out there I was not exposed to much functional programming (I did try to teach myself Lisp, but quickly gave up). Having to do a lot of SQL(which is near-procedural) over the years improved my understanding of functional programming, but not enough to realize what the XSLT book was talking about (reading it from beginning would have been helpful too). Now hardware XSLT accelerators, which made me laugh when I first heard about them, make sense too.

  • Michael Krakovskiy 3:53 am on July 8, 2004 Permalink | Reply
    Tags: Array programming, C++, Comma, , , Data types, Pinko, , Socialism, , String, Value   

    Lvalue and Rvalue 

    Seems like there is no stopping with political stuff trying to get into my life today.

    Here I am, reading through code. Programming, one might say. And then I come across this. What do you think does a function commify() do to a staunch conservative, all American array? That’s right. It turns it into a left-wing, pinko communist comma delimited string.

  • Michael Krakovskiy 1:04 pm on March 2, 2004 Permalink | Reply
    Tags: 47-50th Street IND subway, , 50th Street Station, , , C++, , , E, , , , Max Cohen, , ,   

    47 – 50 

    Max Cohen is having a bad day.

    My friend and co-worker at 47-50th Street IND subway station (the station featured in the movie “Pi“).

Compose new post
Next post/Next comment
Previous post/Previous comment
Show/Hide comments
Go to top
Go to login
Show/Hide help
shift + esc