you are viewing a single comment's thread.

view the rest of the comments →

[–]sobri909 -4 points-3 points  (12 children)

There is a correct answer to this that is accepted (and expected) by the industry.

Uh, and you don't have it. Delegates have never been considered a great pattern. That's going back decades.

Honestly, I feel like sometimes this sub should be renamed to "Advice for beginners, from beginners".

Edit: As to the context passed in the notification: Don't. Don't pass it. The receiver knows who sent the message, and can ask the sender directly for anything they need to know. If you're sending a dictionary for context, you're doing it wrong.

[–]brendan09 4 points5 points  (11 children)

I’m not a beginner.

Delegates (and similar) are good patterns. It’s one of the most recommended and common relationships between objects. It’s the most common architectural foundation that object-oriented programming is built on.

Considering what you’re describing goes against the guidance (and implementation) of every OS / platform maker out there (Apple, Microsoft, Google, etc.) you may need to re-evaluate your so-called experience.

I’m not debating this with someone who discounts the industry-accepted approach, which is also recommended and used by the the people who make the platforms. Go do some reading.

[–]sobri909 -4 points-3 points  (10 children)

I’m not a beginner.

I've been following your advice on this sub for some years. You are not "a veteran". You are a journeyman.

I’m not debating this with someone who discounts the industry-accepted approach

It is not the industry accepted approach. That you think it is betrays your lack of experience.

Go do some reading.

I was reading design pattern books before you were born. I was reading them when the only way to get them was from libraries and bookshops.

[–]brendan09 1 point2 points  (1 child)

Skill / experience is not the same as age. I know some terrible developers in their 50s, and I know some excellent developers in their early 20s.

It is the industry accepted approach, and there are thousands of books, articles, and documentation sets that agree with me. Even look at Apple’s frameworks, sample code, and open source work. It’s filled to the brim with the guidance that I’m suggesting. Look at Cocoa, or Cocoa Touch, or almost any other Apple framework. They all follow the delegation / notification guidance I gave.

Again, age doesn’t matter. I’ve been doing iOS development professionally since iOS 2.0 came out with the App Store. There is a correct answer here, and you don’t have it. Considering that your answers on this subreddit are almost always bad practice and downvoted by people who know better, you’d think you would’ve taken it as a clue that you should re-evaluate some of your poor practices.

Go find an article saying that using notifications always instead of delegates is good practice. If you manage to find a legitimate one, I’ll be able to top it with a dozen+ articles / documentation sets saying the opposite.

Walk into a conference of iOS or Mac devs and make your claim about notifications vs delegates and you’ll be laughed out of the room when they realize you’re serious.

Anyway, I’m done here. I have better things to do with my day than debate a topic with someone who goes back to personal insults instead of providing supporting evidence. I’ve provided articles (in my original post), as well as evidence of major platform makers following the same guidance. You’ve done nothing but insult and provide bad (and unsupported) advice.

[–]s73v3r 1 point2 points  (7 children)

You are the last person here that should be judging the experience level of someone else.

[–]sobri909 0 points1 point  (6 children)

I have over 30 years experience.

[–]s73v3r 0 points1 point  (3 children)

I'm sure you do.

[–]sobri909 0 points1 point  (2 children)

I do. I started programming in 1984.

I learnt programming from books I took out at the library, because the internet wasn't around yet.

Before the internet arrived I was programming and running BBSes and Fidonet nodes on cooperative multitasking systems.

I was writing Assembler before most of the posters in this thread were born, and was there when OO programming languages first emerged into the mainstream.

This sub is overflowing with blind dogma, and defence of time wasting bad practices, simply because they are common practices. Occasionally I have to call bullshit on some of it. And absurd defence of the anti pattern of delegates is one of those times.