Re: Is it safe to use NSDictionary as the objects in a (WO/ERX)DisplayGroup?
Re: Is it safe to use NSDictionary as the objects in a (WO/ERX)DisplayGroup?
- Subject: Re: Is it safe to use NSDictionary as the objects in a (WO/ERX)DisplayGroup?
- From: Ramsey Gurley <email@hidden>
- Date: Tue, 09 Apr 2013 19:53:01 -0700
On Apr 9, 2013, at 7:51 PM, Chuck Hill wrote:
>
> On 2013-04-09, at 7:23 PM, Ramsey Gurley wrote:
>
>>
>> On Apr 9, 2013, at 5:50 PM, Chuck Hill wrote:
>>
>>>
>>> On 2013-04-09, at 5:48 PM, Ramsey Gurley wrote:
>>>
>>>> displayGroup.setObjectArray()?
>>>>
>>>> Also, NSDictionaries? Gross. It sounds like your gut is telling you something. Listen to it. Java has Objects and Interfaces. Use them.
>>>>
>>>> I despise looking at Java code when all I see is an array of dictionaries which holds more arrays which have yet more dictionaries full of arrays and so on. Dictionaries are opaque. You don't know what's in them. Magic keys, magic values, and zero javadoc to explain any of it. In the end, it results in the least maintainable and most confusing code imaginable.
>>>
>>> aka Direct To Web :-P
>>
>> I lol'ed. But I was thinking more like this:
>>
>> http://stackoverflow.com/questions/3826891/java-map-anti-pattern
>
> I am with you there, but that was just too funny of a reply for me to pass it by.
Believe it or not, I was about to fire back with touché when Pascal beat me to it :D
>
> Chuck
>
>
>>
>> I consider a d2wmodel to be not much different from an eomodel. Both are dictionaries. The keys are pretty well defined by the objects that use them. Both models provide a place for documentation. And with d2w, it's generally unadvisable to push the d2wContext, so your keys are almost exclusively defined in a rule model.
>>
>> Watching java code pass around NSMutableDictionary makes me want to gouge my eyes out. Oh look, the key IS an array. How nice. I don't even know what's in the array either. Where did that come from? Well, that mutable dictionary is available via a public method called by 17 different classes. Fantastic. Let's all play "Hunt through the spaghetti code."
>>
>> Seriously. Gross.
>>
>> Ramsey
>>
>>>> On Apr 9, 2013, at 5:10 PM, Paul Hoadley wrote:
>>>>
>>>>> Hello,
>>>>>
>>>>> I needed to display the content of an array of NSDictionary objects, and without thinking I just loaded them into an ERXDisplayGroup via an EOArrayDataSource:
>>>>>
>>>>> EODataSource ds = new EOArrayDataSource(EOClassDescription
>>>>> .classDescriptionForClass(NSDictionary.class), editingContext());
>>>>>
>>>>> Two observations followed:
>>>>>
>>>>> 1. This works. I guess that pretty much answers my question, but are there any undesirable side-effects? (I probably shouldn't be specifying the component's EOEditingContext up there. I should change that to ERXEC.newEditingContext().)
>>>>>
>>>>> 2. Not surprisingly the code throws an exception at runtime:
>>>>>
>>>>> ERROR ERXEntityClassDescription - Unable to register descriptions for class: com.webobjects.foundation.NSDictionary
>>>>> java.lang.RuntimeException: Dummy
>>>>>
>>>>> Can I safely catch and/or ignore that?
>>>>>
>>>>> In short, I'd like to use all the nice ERXDisplayGroup machinery, but the objects are NSDictionaries. Am I likely to regret this in the future?
>>>>>
>>>>>
>>>>> --
>>>>> Paul Hoadley
>>>>> http://logicsquad.net/
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Do not post admin requests to the list. They will be ignored.
>>>>> Webobjects-dev mailing list (email@hidden)
>>>>> Help/Unsubscribe/Update your Subscription:
>>>>>
>>>>> This email sent to email@hidden
>>>>
>>>> _______________________________________________
>>>> Do not post admin requests to the list. They will be ignored.
>>>> Webobjects-dev mailing list (email@hidden)
>>>> Help/Unsubscribe/Update your Subscription:
>>>>
>>>> This email sent to email@hidden
>>>
>>> --
>>> Chuck Hill
>>> Executive Managing Partner, VP Development and Technical Services
>>>
>>> Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
>>> http://www.global-village.net/gvc/practical_webobjects
>>>
>>> Global Village Consulting ranks 13th in 2012 in BIV's Top 100 Fastest Growing Companies in B.C!
>>> Global Village Consulting ranks 76th in 24th annual PROFIT 200 ranking of Canada’s Fastest-Growing Companies by PROFIT Magazine!
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> Webobjects-dev mailing list (email@hidden)
>>> Help/Unsubscribe/Update your Subscription:
>>>
>>> This email sent to email@hidden
>>
>
> --
> Chuck Hill
> Executive Managing Partner, VP Development and Technical Services
>
> Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
> http://www.global-village.net/gvc/practical_webobjects
>
> Global Village Consulting ranks 13th in 2012 in BIV's Top 100 Fastest Growing Companies in B.C!
> Global Village Consulting ranks 76th in 24th annual PROFIT 200 ranking of Canada’s Fastest-Growing Companies by PROFIT Magazine!
>
>
>
>
>
>
>
>
>
>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden