I am all for developers pushing themselves, learning new things and refining their skills, but the one thing that really annoys me about front-end development right at this moment, is the opinion terrorists who are raving about functional programming.
A few examples of the pro functional movement can be seen; here, here, here, here and here is a TypeScript oriented one. There are more out there though.
I am a firm believer in using whatever it takes to get things done. Whether you still use jQuery or you prefer to write things from scratch without libraries or frameworks.
You’ll always encounter developers (usually younger ones) who want to use React or the latest Trend.js library. When you’re on the cutting edge though, you’re always playing catch up to an extent.
And let me make this one thing clear: there is a difference between not caring about what people think of your code and writing bad code.
You should always put love and care into the code you write, but fixating on what methodologies and specific styles to use (especially if they’re new to you) is wrong. Write great code, but write it on terms that you understand.
As shown earlier, most of these opinions are opinionated Medium articles. But this isn’t a new argument, some have been advocating for functional programming for years.
There are benefits to adopting a functional programming style, one of those being the lack of state, I am not saying I am against it. However, if you’re only switching to it because it’s the popular thing to do right now, then I feel bad for you son.
Let’s be honest with ourselves: functional programming is hard and you rarely see it in the front-end development space being done right.
Developing an application using a functional programming style requires immense discipline. If you don’t come from a background in working with functional programming concepts, it will be an uphill battle for you to unwire how your brain has learned to work (especially if you’re senior level).
While functional programming is touted as the best thing since sliced bread and inheritance is the root of all evil, if you’re a shitty developer, it isn’t going to make you better. It won’t stop you from writing stupid, buggy and unoptimised code. No style, methodology, framework or library will make you a better developer.
I have seen quite a few attempts from developers trying to switch to a functional programming style and I have never seen it done right. Developers are inherently lazy, always trying to automate things and jump on the latest tools to streamline their development workflow.
You might start out with the best intentions, but once the weight of an impending deadline starts crushing you, we both know you’ll start to cut corners. We both know that desire to adhere to that new-fangled functional programming style will wain.
I realise that this article might come across as being just as bad as those articles. I am not telling you to use or not use a functional programming style, but I am telling you to think for yourself and see if that kind of approach will even benefit you.
As it currently stands, I use ES2015 classes in my Aurelia applications (yes, cue the boo’s from the inheritance haters). I also use functions as well to break different tasks up into tasks, but I don’t stick to one style. I write whatever gets the job done.
Front-end development is hard enough already with a sea of mixed specifications from ECMAScript, W3C and WHATWG, the goal posts are always moving.
Why are we as developers always making things so hard for ourselves? Tooling is already the bane of my existence without needing to worry whether or not my function is “pure”.
Choose a functional programming style for your own reasons, not because someone on Medium told you.
Amen to the remark about mixed specifications and WHATWG in particular. XmlHttpRequest is consistently implemented across all major browsers, stable, widely understood, well supported and a functional superset of Fetch. WHATWG “solved” an imaginary problem by creating a real one.
Thank you for your insight. Don’t be to mean to guys who try to do it in a functional way. Hypes are real and frameworks like elm profit heavily by peak popularity.
From a programmers perspective it’s like always: use the right tools for your needs. There are requirements that can be done better using a functional design and visa versa.
Especially senior devs should know when to use what. Functional programming is not new. Getting used to fundamentals is what you should target for.
A good write up. I agree with a lot of things you bring up. However you don’t mention probably the most important thing in development – testing.
Functional programming helps with testing in the first place. I agree that mainly business does not care about how a developer gets things done, but business always wants to be secure.
So, the trend towards functional programming in front-end IMHO is because front-end is becoming more and more important in business and thus it requires a piece of mind which is provided by a test coverage.
While I sympathize with not wanting to be forced to learn new ways of doing things (that’s painful and sucks), it does seem quite a bit like you’re just hand waving the real and measurable benefits of functional programming for the UI. I agree wholeheartedly that rarely is functional style implemented correctly in an academic sense, but I think at the end of the day the real reason some developers fight so hard against it is this: “Developing an application using a functional programming style requires immense discipline.”