7 ms·
I've noticed hackers/self taught prefer functional programming styles and CS degree holders prefer the more common style.
by brador 11y ago
I've noticed hackers/self taught prefer functional programming styles and CS degree holders prefer the more common style.
- thesimpsons1022 11y agoi think people probably just prefer whatever paradigm they used first or currently are comfortable with. I have a cs degree and we were taught scala at my school and now I use it everyday.
- peterfirefly 11y agoI used BASIC first, then Z80 machine code, then Pascal, then 8086 machine code, then C. I really like functional programming, especially in Standard ML and Haskell. I didn't learn ML until I'd been programming for about 15 years. Edit: beadder grammer.
- agumonkey 11y agoI woudln't say 'prefer' but it's a heavy influence on your view of the world. I think imperative programming fit our biological needs and reflex. We want to see results and effects. Functional programmers are up high in the world of platonic ideals. They delay effects by composing abstract logics and then ask for a result. No newbie wanna suffer that, but no newb want to suffer mutable state bug hunts either.. the learning excitement just shadow this issue for a while, and I bet somewhere deep inside, we're all mathematician in the closet.
- varelse 11y agoI'm self-taught and while I can see the formal appeal of functional programming, I'm a low-level coder that implicitly reduces state to bare-metal registers and cache in GPUs and embedded systems. Since I'm already sweating bits over state down to the byte-level, I just don't see what FP would improve on this.
- peterfirefly 11y agoThe big improvements often come from better algorithms and data structures. Using a function style or a higher-level language sometimes makes it easier to modify the program (and hence use a better algorithm). I remember people swearing by assembly language back in the 80's, thinking C would make their programs slow and bloated. In reality, it was usually the other way around because C code is much more malleable than assembly. You might want to give FP a second look.
- varelse 11y agoThere is a very active attempt to make GPUs FP-friendly called C++AMP. And for streaming transformation tasks, it's a nice abstraction. https://en.wikipedia.org/wiki/C%2B%2B_AMP https://en.wikipedia.org/wiki/C%2B%2B_AMP However, my best algorithms are stylistically equivalent to a map-reduce with combiners entirely in GPU-space. The map tasks themselves carry all the scope I need. They are independent units of work executed by independent warps (synchronized groups of 32 GPU threads) whose results need to be reduced to floating point numbers. That reduction is done with 64-bit fixed point atomic ops (my combiners) because: 1) This insures the sum is deterministic 2) Ever since Kepler (GK104), it's much faster than reduction buffers and uses a fraction of the memory 3) It's possible because I can precompute the expected dynamic range and adjust the fixed point exponent accordingly Now given that, do you see a functional programming equivalent that significantly improves on this design? I haven't yet.
- peterfirefly 11y agomap-reduce is already functional, isn't it? Who cares if you implement the combining with atomic ops or by sending data to a process that does the combining or whether you stuff the data in a buffer and then reduce it afterwards? (Of course you might care for performance reasons -- but conceptually it's the same thing.)
- varelse 11y agoYes, it is true conceptually, but: 1) "Who cares" is not the sort of thing you want to say to someone who cares about performance because: 2) Sending the data to buffers for subsequent reduction was the first implementation (2009). But it was a memory hog and a 5% or so slowdown to perform the reduction subsequently rather than concurrently with Atomic Ops and 64-bit Fixed Point (2012). But I guess what we're arriving at is that this is essentially a functional design using imperative code? I can live with that.
- throwaway999777 11y agoI thought functional programming[1] was associated with ivory tower CS researchers/enthusiasts? I guess it's been turned on its head for some reason. [1] At least the Haskell/ML kind.
- its_me_ken_lai 11y agoThe underlying concept will surface once you've had a chance to debug program states and that you realize you can't keep track of all program states. I had no idea about functional programming but soon realized that I was going for the same thing when trying my best to not keep instance variables in my objects.
- throwaway999777 11y agoYou misunderstand me. I wasn't trying to diss FP but rather the naysayers who try to associate people who like FP with certain groups.
- vezzy-fnord 11y agoSelf-taught programmers are far too diverse to make any value judgment like this. Hackers, and I'll assume all those vaguely tracing their lineage from MIT, have never been associated with FP. There has always been a fascination with Lisp, but that's the extent of it. In practice, most of their software legacy has been in firmly imperative and procedural languages, but with touches of a Lisp here and there. It's precisely CS and academia where functional programming has been thriving. John Backus' research on function-level programming, Robin Milner on ML, David Turner on Miranda from which Haskell is almost a direct successor, etc. So on the whole, I have the exact opposite impression that you do.
- glesica 11y agoMeh, maybe the people whose first-ever programming experience was CS 101 prefer OOP, at least at first, because it is all they may have ever seen [1]. But Haskell and Lisps, among others, are widely admired and used in academia. Even if it isn't taught directly, most reasonably engaged CS students come away with an appreciation for FP and its core concepts. I think this preference has more to do with the individual's past experiences and future goals than it does with his/her level of formal CS education. [1] Although even this varies greatly from school to school, the school where I got my MS used OCaml in the undergrad algorithms course for awhile. My undergrad algorithms course used C, so again no OOP.
- peterfirefly 11y agoA "CS degree" covers everything from a Java School to a proper (semi-mathematical) Comp Sci education. If you learn type theory and semantics you also learn functional programming (and will probably like it, even if you don't use it much in practice). If all the world is a Java VM to you, then... well, you might have a different view of the world.
- dpeck 11y agoreally? functional has long been the domain of computer scientists. Functional languages seems to be one of the hardest things for people without a CS background to pickup in my experience.
- ninjakeyboard 11y agoI think I disagree with this. It seems natural to start to code with a functional style as you become a better developer. I worked on scala for quite a while, and took a detour to write Java. The Java that I wrote was way more readable and testable than any of the imperative code I wrote before learning FP well.
- ninjakeyboard 11y agoI think I disagree with this. It seems natural to start to code with a functional style as you become a better developer. I worked on scala for quite a while, and took a detour to write Java. The Java that I wrote was way more readable and testable than any of the imperative code I wrote before learning FP well because I approached the imperative language from a functional perspective. If you look at Bloch's book Effective Java you'll see he describes functional approaches quite a lot (eg prefer immutability) - these are places you go when you see that they're better.
- rootlocus 11y agoI have a CS degree and I prefer immutable data structures and pure functions. If anything, I believe it might be the other way around, since holding a CS degree means you've had a FP course and you're more aware of the implications of multithreading, immutability and side effects. "Self taught"s are more likely to have an education from online tutorials, which are fairly shallow.