DEV Community

Cover image for What programming concept did you struggle the most with?
Vitor Paladini
Vitor Paladini

Posted on

What programming concept did you struggle the most with?

Was it types, promises, or ternary operators?

Maybe async, testing, recursion?

Was it OOP, malloc, or decorators?

Or maybe compilers, data structures, or recursion?

Top comments (57)

Collapse
 
pj profile image
Paul Johnson

Early on in my career I think OOP concepts like inheritance polymorphism etc gave me the most trouble. After that I think Monads were probably the trickiest concept to grasp and one I don't fully grasp.

There's a wide variety of concepts I would like to learn e.g. dependent types.

Collapse
 
vtrpldn profile image
Vitor Paladini

I share the experience with OOP, it took me a lot of "this pen is an object, it has a method write() and an attribute color" example for me to finally learn it.

Considering monads, I have yet to step into FP for that sole reason, some concepts look real hard.

Collapse
 
pj profile image
Paul Johnson

I feel with monads experience using them in a variety of ways might be more useful than reading about it. My explanation of them would be "they're a reification of computation", which is totally useless unless you've already spent a bit of time with them practically.

Thread Thread
 
vtrpldn profile image
Vitor Paladini

Makes sense, oftentimes some concepts only "click" for me after a few weeks applying it naively.

GraphQL is a recent example, I was weeks into a project when I finally realized: "Oh, THAT'S why it is better than REST in this situation".

Collapse
 
austindd profile image
Austin • Edited

Monads aren’t nearly as complicated as people make it seem. It’s literally just a generic interface. Kind of like how you can have array.map, linkedList.map, or promise.map... all those types have a sort of common interface. Those are all “functors”. Monads are the same kind of thing, except in addition to map they have flatmap, which is basically just a different version of map which flattens nested results. This allows certain operations to be easily “chainable”. And that’s pretty much it.

Boom - monads!

Collapse
 
rad_val_ profile image
Valentin Radu • Edited

Monads are much easier to learn by example. If I tell someone: "Look, this is an Optional, this is how it works, the Optional is a monad. Now imagine you can apply this pattern to a whole lot of things, not just wrapping nullable values", they get it pretty fast and it's usually enough to get them rolling code using monads.

As for inheritance/polymorphism, I used to be somewhat confused about it too and I blame it on the myriad of articles and books that don't clearly differentiate between the two just because the easiest way to show polymorphic behaviour is through inheritance (which is by the way, something you usually want to avoid)

Collapse
 
ecognito profile image
E Cognito • Edited

Honestly, it would probably be garbage collection. My first job in the 90’s was writing C code and burning it on to EPROMs. By the time I came to learning Java some time latter, I had moved through C++, Delphi (also, does anybody remember Powerbuilder?) and even PHP and Javascript, but this was the first ‘serious’ language I’d picked up that used garbage collection.

The free-wheeling, devil-may-care attitude of just allocating memory offending my well worn sensibilities no end. I’ll give you my destructors when you pry them from my cold, dead keyboards.

Collapse
 
vtrpldn profile image
Vitor Paladini

It is incredible how diverse programming is, most of my experience is with web-focused languages like PHP and JavaScript so memory allocation is a concept that has never been part of my daily work. But I can understand the difference you must have felt when switching, haha.

Collapse
 
madza profile image
Madza

naming conventions 🙄

Collapse
 
vtrpldn profile image
Vitor Paladini

As the classic quote goes:

There are only two hard things in Computer Science: cache invalidation and naming things. -- Phil Karlton

Collapse
 
ecognito profile image
E Cognito

Acutally, I prefer Leon Bambrick’s version: “There are two hard problems in computer science: cache invalidation, naming things, and off-by-one errors.”

Collapse
 
madza profile image
Madza

Yup, I always refer to that quote, too 🤣🤣

Thread Thread
 
merri profile image
Vesa Piittinen

Too bad "time" was forgotten :D

Thread Thread
 
vtrpldn profile image
Vitor Paladini

Yeah, I've built quite a lot of WordPress websites with date queries and it never gets easier.

Collapse
 
yogiwisesa profile image
Yogi Wisesa • Edited

Event loop. Watch any videos explaining about it and end up thinking JavaScript is multi threaded.

Collapse
 
vtrpldn profile image
Vitor Paladini

This is a subject that I should look more into. Do you have any good resources on that?

Collapse
 
yogiwisesa profile image
Yogi Wisesa

I watch Philip Roberts talks at JsConf and think many videos referring to this talks and also he provide a tool that simulate how event loop works. youtu.be/8aGhZQkoFbQ

Thread Thread
 
vtrpldn profile image
Vitor Paladini

Fantastic, thanks! 😄

Thread Thread
 
yogiwisesa profile image
Yogi Wisesa

Sure 😀

Collapse
 
eelstork profile image
Tea

Now now, who will admit to struggling with programming concepts? However. Some 15~20 years ago I got overenthusiastic about generics in Java. Sent me down a deep, deep rabbit hole and I wrestled on and on until I hit the right answer: in moderation. Generify in moderation.

Collapse
 
vtrpldn profile image
Vitor Paladini • Edited

I have no experience whatsoever with Java but it seems that this piece of wisdom applies to a lot of paradigms. Thanks for sharing!

Collapse
 
gracrys profile image
Gracrys

Hands up for monads, but i saw some comment here talking about how you can try to understand them better using them, but dang, without knowing what they do, using them is just too hard, i was learning haskell at the time, and this was the harder concept i had to grasp from the language itself

Collapse
 
perpetual_education profile image
perpetual . education • Edited

Weirdest concept for us... was that there was a boss or creative - that had no idea what they were doing... and then they sold all these crazy ideas - and then we were supposed to somehow make all that crappy stuff - and fast / and have everyone get really rich and happy. Yikes. That part of the pipeline is broken! Then maybe Auth? Still don't know if we're using a monad ;)

Collapse
 
merri profile image
Vesa Piittinen

Does pixel count as a programming concept? Understanding it as a child was a challenge when you had to figure out the concept of it via CRT screen, manual in a language you didn't really comprehend, and no internet or other people to help you. Place white and black dots next to each other and you got cyan, or purple, or moire. And then you had all the bleeding with other colors.

Collapse
 
vtrpldn profile image
Vitor Paladini

I'm not sure, but it seems close enough, haha. Pixels can be hard to understand without some understanding of optics and color theory, especially for a child.

Collapse
 
rad_val_ profile image
Valentin Radu

Generics, covariance and contravariance.

It took me quite a bit to understand them, although not that complicated now that I think about it. Also, it didn't help Swift was riddled with generics related bugs when I first encountered them in practice.

Collapse
 
bassforce86 profile image
James King

the Mental shift from MVC, REST & HTTP to Event Driven Design and CQRS. That shift in thinking was a bit of a personal internal battle to start with!

Collapse
 
vtrpldn profile image
Vitor Paladini

I'm not so well versed with backend patterns but does it compare to learning the shift between imperative/declarative programming?

Collapse
 
bassforce86 profile image
James King

Yes, I'd say the shift is a similar thought process change

Collapse
 
dendihandian profile image
Dendi Handian

I'm still struggling to decode my beautiful imaginations into CSS

Collapse
 
vtrpldn profile image
Vitor Paladini

Yeah, CSS can be quite hard to master. One thing that I like it though, is how fast you get feedback from it.

Boot up a fresh codepen, add a few CSS lines, change some others, watch the UI change, bam you're learning.

Collapse
 
ericgeek profile image
EricGeek

The concepts themselves have never been a problem, it's been the "best practices" of the concepts that have been a problem. About two decades ago, I tended to suffer from NIH (not invented here). I still seriously overthink decisions like REST vs graphQL vs RPC, which component libraries or frameworks to use, etc., as I'm still highly opinionated, but I at least understand that outsourcing the work to someone for whom the library/framework is their primary mission is more likely to produce a quality product than rolling my own in between or in support of my real tasks.

Collapse
 
nexusdenim profile image
Nexus Denim

The Objected Oriented Programming, back at when i started learning Programming, the first thing that set me off was setters and getters, I was like why build setters and getters if one can initialize it in Constructors and can access it through the class. That was the most difficult, But still now the OOP methods and properties confuses me a little time by time.

Collapse
 
swagwik profile image
Sattwik Sahu

Django routing
Redux
Redux thunk

Collapse
 
vtrpldn profile image
Vitor Paladini • Edited

Ugh, I know that pain. Once I spent a whole week fighting Redux, Redux Thunks, and Redux Saga to make some async stuff that would've been much easier if I simply used default state or the Context API. 🥴

Collapse
 
swagwik profile image
Sattwik Sahu

Ya even connecting Firebase and Redux. All these exceedingly misleading tutorials on the internet tell me to use a TON of libraries but then I realized I could simply do it all with redux and Redux thunk. 😂😂😂

Collapse
 
wilsongramer profile image
Wilson Gramer • Edited

I was learning Go and struggled a lot with channels and buffered channels, after using promises for everything in JavaScript. I kept getting deadlocks trying to wait for multiple goroutines to all finish!