loading...
Cover image for What programming concept did you struggle the most with?

What programming concept did you struggle the most with?

vtrpldn profile image Vitor Paladini ・1 min read

Was it types, promises, or ternary operators?

Maybe async, testing, recursion?

Was it OOP, malloc, or decorators?

Or maybe compilers, data structures, or recursion?

Discussion

pic
Editor guide
 

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.

 

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.

 

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.

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".

 

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!

 

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)

 

naming conventions 🙄

 

As the classic quote goes:

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

 

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

 

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

Too bad "time" was forgotten :D

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

 

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.

 

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.

 

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

 

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

 

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

Fantastic, thanks! 😄

 

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.

 

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

 

Definitely pointers (and therefore explicit memory allocation) was a concept I did struggle with the most... but got there eventually.

Monads I've given up on :-)

 

Ah yes. Pointers, relatively easy to understand and use, and extremely easy to screw up and thereby sending you into an abyss where you don't understand any of it.

 

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

 

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.

 

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.

 

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 ;)

 

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!

 

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.

 

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

 

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.

 

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.

 

Django routing
Redux
Redux thunk

 

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. 🥴

 

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. 😂😂😂

 

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.

 

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!

 

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

 

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

 

Tree, Graph, Async, Recursion (sometimes), Decorators, Virtual class

 

I got my head around async eventually but recursion is something that I always have trouble with, even after all these years

 

python has been my main programming language and it has been little tough

 

Still fighting with oop. Lol

 

Algorithms and Data Structures. Even now I still don't have a complete understanding of it and its always required prep for many interviews these days...

 

I also struggle quite a bit with algorithms and data structures. This series of videos helped me a lot youtube.com/watch?v=bum_19loj9A

 
 

Any in particular? I find matrices especially hard to grasp.

 

MVC, MVVM

And, currently, state management.

Also, geospatial statistics and AI are a very big group...

 

MVVM is also not very clear to me and it has been years since I've first heard of it.

My experience with state management, at least in Reactland, is that you probably don't need an external solution do deal with it most of the time.

 

Pointers and generic delegates. If I'm being honest, I still don't really understand generic delegates.

 

Y'all are making me realize that there are parts of programming town that I have never been to before. I have no idea what is a generic delegate and will surely struggle if I need to come up with one in the future 🤣

 

Global state management in react. I really don't like any option.

 
 

I took me some time to take the time to understand covariant types

 

To this day I cannot understand how recursion works. I used to find OOP concepts confusing but now I'm used to it.

 
  • Concurrency
  • Distributed transactions
  • The above two combined

Not to understand, but to get it right.

 

Hmmm... pointers which made it tough to learn C because of it.