DEV Community

Discussion on: It's Just Syntactic Sugar

Collapse
 
alexgwartney profile image
Alex Gwartney

You make a good point. About how when things are made with this "syntactic sugar its put there to make things easier". Which I agree with at the same time I feel like there are times where that syntactic sugar can lead people down the wrong road.

I would say the most common example of this would have to be with javascript Class method in ES6. Its syntactic sugar to make it as you said easier for others to come into the language. As well as making it easier to write inheritance in javascript. But at the same time, I feel like this syntactic sugar can complicate learning the language as for one javascript isn't a class-based language.

So I feel like if this syntactic sugar is going to be placed for one it should at least match what the language is actually doing. Not trying to make it look like something it's not.

Lastly, I also don't think its always bad to understand the things going on behind the syntactic sugar because it can actually help understand the reasoning behind the black box. But as you mentioned at the same time we write the code for each other and our future self. So while understanding the black box is good it's important to still make sure to choose whether or not using the syntactic sugar is a better solution than writing out the entire solution.

Collapse
 
tiffany profile image
tiff

Ruby and Rails are beautiful examples of syntactic sugar. The whole language is easy to read. Rails does some magical things that has tripped me up a couple times. Digging into that black box is something I always want to do. Sometimes it's necessary. Other times it just slows you down. While learning I think it is useful to understand things.