News for hackers. Stuff that matters.
Re:Windows 8: HTML5 and AJAX/JavaScript == Modern UIs by richcollins on Sunday June 05, 2011 @02:54PM (#2622595)
Which is more cumbersome?

    //Objective-C
    
    #import <Foundation/Foundation.h>
    
    @interface Order : NSObject {
    	NSString *id;
    	Customer *customer;
    	NSDate *timestamp;
    	NSString *productId;
    }
    
    @property (nonatomic, retain) NSString *id;
    @property (nonatomic, retain) Customer *customer;
    @property (nonatomic, retain) NSDate *timestamp;
    @property (nonatomic, retain) NSString *productId;
    
    @end
    
    #import "Order.h"
    
    @implementation Article
    
    @synthesize id;
    @synthesize customer;
    @synthesize timestamp;
    @synthesize productId;
    
    - (void)dealloc
    {
    	[self setId:nil];
    	[self setCustomer:nil];
    	[self setTimestamp:nil];
    	[self setProductId:nil];
    	[super dealloc];
    }
    
    //Javascript
    
    Order = Proto.clone().newSlots("id", "customer", "timestamp", "productId");
Re:Windows 8: HTML5 and AJAX/JavaScript == Modern UIs by Derbasti on Sunday June 05, 2011 @04:30PM (#2622776)
I fully agree. I used to be a big fan of Objective-C and saw no need for a more expressive language.

Then I started coding in PyQt (a Python, Qt bridge). Now I know: Objective-C is not a high level language, even though it has some high level aspects. Also, coding in a high level language can improve productivity by a huge margin, even if you are coding against a low level framework.

On the desktop, this is a more than worthwhile tradeoff. Mobile devices still benefit from the performance advantage of Objective-C as opposed to, say, MacRuby.

Re:Windows 8: HTML5 and AJAX/JavaScript == Modern UIs by richcollins on Monday June 06, 2011 @01:28AM (#2623800)
Verbosity also promotes to poor design decisions. I often skip creating additional classes that would result in better factored code because it's too much work.
Re:Windows 8: HTML5 and AJAX/JavaScript == Modern UIs by Derbasti on Monday June 06, 2011 @04:54AM (#2624123)
"Because it's too much work" tends to be a bad excuse, though.
Re:Windows 8: HTML5 and AJAX/JavaScript == Modern UIs by richcollins on Monday June 06, 2011 @02:11PM (#2625690)
If creating a new class took an hour would it be a bad excuse? How about a day?

Getting rid of "Too much work" is the point of software.

Re:Windows 8: HTML5 and AJAX/JavaScript == Modern UIs by bonch on Sunday June 05, 2011 @03:06PM (#2622628)
Objective-C is always going to win the contest for Smalltalk-esque verbosity, but I would hardly consider the code you wrote to be cumbersome. In the modern Objective-C runtime using garbage collection, you can write this:

    // Order.h
    #import <Foundation/Foundation.h>
    
    @interface Order : NSObject
    @property (copy) NSString *id;
    @property (retain) Customer *customer;
    @property (copy) NSDate *timestamp;
    @property (copy) NSString *productId;
    @end
    

    // Order.m
    #import "Order.h"
    
    @implementation Article
    @synthesize id;
    @synthesize customer;
    @synthesize timestamp;
    @synthesize productId;
    @end
Apple engineers have confirmed that they're working on making @synthesize the default behavior for properties, so eventually you won't have to write that either. A real-world app would be using Core Data for its model objects, negating the need to write this class at all while adding automatic faulting, data integrity, and undo/redo:

    Order *order = [NSEntityDescription insertNewObjectForEntityForName:@"Order"
                    inManagedObjectContext:self.managedObjectContext];
Re:Windows 8: HTML5 and AJAX/JavaScript == Modern UIs by richcollins on Monday June 06, 2011 @01:27AM (#2623794)
Thank you for further solidifying my point.