Xcode 4 public preview - Single window, LLVM 2.0, streamlined editing
developer.apple.com
developer.apple.com
So far as I know, the only way to get gcc (or any other compiler) initially onto a Mac is by accepting the entire Xcode package. I'm posting this here because you mentioned the 3GB download, which always makes me cringe. I'm curious to see if anyone knows a better way. (I've had this conversation online in a number of places in the last few years, but never received an alternative.)
I don't see any reason why you can't compilers. Here's the instructions for Clang [1] and LLVM [2].
You can't really do a lot without the system headers and libraries, though, which are installed via the Xcode Dev Tools.
[1] http://clang-analyzer.llvm.org/installation.html [2] http://llvm.darwinports.com/
1. Essentials (1.75GB)
2. System tools (56.8MB)
3. UNIX Dev Support (563.7MB)
4. Documentation (Zero KB - sic! More seriously, it's a download at next boot, hence zero KB of stuff is installed immediately from the disc. Why they don't report the size of the later download, I don't know.)
5. Mac OS X 10.4 Support (Zero KB - again, sic!)
By default, 1-4 are selected and 5 is deselected. But here's where it gets interesting: you can only deselect 2-5 manually. 1 is a must. Care to guess where Xcode lives?
Here's how Apple describes "Essentials":
> Installs Xcode, Interface Builder, Instruments, Dashcode, Quartz Composer, GCC 4.0.1, GCC 4.2.1, llvm-gcc 4.2.1, GDB, and other developer tools. Also installs the Mac OS X 10.5 and Mac OS X 10.6 SDKs. All content is placed inside a location chosen by the user (default is /Developer on the boot volume).
I feel like John Belushi in the old "All I wanted was a pony, but nooooooooo" skit.
And it was difficult to tell if the updating application froze or was still working. So while patching is nice, it is a huge effort to get it done cleanly.
Using .NET as an example, the SDK patches would include: Drivers DirectX XNA WPF BackOffice SQL Server (or Express or Lite or whatever they call it) System libraries ASP.NET C# F# ILR C++ .NET VB.NET
And the list goes on.
Apple's developer kit has a similarly vast suite of libraries and services, I just don't know all of their names. Each one in isolation wouldn't be all that big a deal, but combine them and you have the option of massive downloads or a nightmarish dependency management problem.
VS2008 runs some SQLserver, PDBserver, and who knows what else (run ProcExp and see)
I've never been a fan of single-window IDEs, going all the way back to Visual C++ 6, and I don't think XCode 4 is going to be the one to change my mind. And god damn it, all the keyboard shortcuts have changed! This is going to be painful.
It's clear they've put a lot of work into it. It looks slick, and the organization of the menu and commands is much more thoughtful. The biggest problem with current version of XCode is that it's very difficult for newcomers to learn, and this new version will go a long way to correct that.
But none of that matters to me. I can't touch this software until I'm forced to use it, because when that happens I'm going to have to un-learn everything I currently know, start from scratch, learn all new habits, etc. Can't say I'm looking forward to it.
I do have a question for the compiler geeks, though: how was LLVM able to so quickly surpass GCC in both compiling source and binary performance, considering gcc had a two decade head start?
While there's a lot of win in terms of code readibility and the great interfaces it exposes if you're going to write an IDE that understands the code, I'm not convinced it's there yet in terms of binary performance.
My apps run around 5%-15% slower, on average, than the GCC -march= setting.
I'm more interested in using LLVM on FreeBSD or Linux than on OS X, but I'm happy to see Apple pushing its development.
GCC isn't a particularly high bar to hit ICC and MSVC have been killing it for years.
It's largely the same reason that the ZFS codebase is drastically smaller than the UFS codebase. You don't think of the fastest / shortest way to do X the first time.
Not all the code works with LLVM, for example if you use LLVM to compile the linux kernel it won't boot.
FreeBSD however will actually compile and boot. http://wiki.freebsd.org/BuildingFreeBSDWithClang . It's not completely foolproof yet. I think the BSD community has welcomed LLVM a little more warmly than GNU/Linux.
The thing is that most compilers these days are limited by the performance of the CPU itself, as they're getting within a few percent of the best you can do.
I am curious as to what you don't like abou it?
- It's incredibly brittle. Good luck if you need to make significant changes to your hierarchy, or change that NSOutlineView of yours to an NSTableView. You'll have to rebuild and re-hook up all of the connections on an object. With no warnings or errors if anything is wrong. In HTML, you can just copy and paste, change some tags, and make some adjustments. Now HTML isn't ideal for application layout - but another markup language could be (MXML isn't bad).
- Doesn't play well with source control. Only one user can work on a .nib at once. Just yesterday another programmer and I both made changes to UI. Of course, it was completely unmergeable by machine or by hand - what do you expect when you have GUI generating a 7000-line file for relatively simple UI. So one of us had to re-do several hours of work. This isn't a problem with, say, HTML.
- Most significantly, it only solves a small part of the problem. It completely falls down when you're dealing with dynamic / variable UI - you'll have to resort to code anyway. And a lot of the layout you need to do is actually inside cells - say, trying to build a source list like iTunes, or a table view with icons inside of it. IB can't help here at all. Then, you end up laying out the actual UI in code. And what code it is:
NSDivideRect(cellFrame, &imageFrame, &textFrame, ICON_INSET_HORIZ + ICON_TEXT_SPACING + imageSize.width, NSMinXEdge); imageFrame.origin.x += ICON_INSET_HORIZ; imageFrame.size = imageSize;
textFrame.size.width -= ([self sizeOfBadge].width + ROW_RIGHT_MARGIN);
Are you serious? This is 2010. You should not need to be manually calculating the positions of UI elements. There should be a layout language. HTML, MXML, whatever.IB encourages you to use a very low level of abstraction. There's a lot of repetition, and the closed nature of the tool means it's very difficult to build up higher levels of abstraction. But then again, I guess Objective-C loves loves making programmers repeat themselves.
There's a reason most professionals don't use dreamweaver to make websites, either. And they are much the same.
So, when will it be done? :D
That's understandable. Most other IDEs handle GUI development by simply mashing the view and the controller together into a single unit. That is fine if you just have a simple window with some buttons and text fields, but this approach quickly falls apart when applied to larger, more sophisticated software.
The Cocoa approach is different in that it completely separates the view (the NIB or XIB) from the controller(s). You're free to design your views, controllers, models as you see fit, and Interface Builder is there to help you realize that design.
But you actually have to design your software; XCode is not going to hold your hand and shoehorn you into a specific design, like most other IDEs.
A NIB is still a NIB. That's not going to change just because XCode and IB are now a single application. You will still have to design your software, and you will have to understand that design.
But software design is hard, so don't be discouraged. It will come with experience.
And this is why I am still soldiering on with my little app (which is really just a learning opportunity for me rather than anything I plan on capitalising on, so it's okay for me to make mistakes :). I'd like to learn how to do it better, and you're right, that comes with experience. That said, I think the new XCode will help people like me a bit more because it will probably be easier to see the links between the UI and the code. :)
I find the mechanism of connecting UI elements to outlets by dragging around to be gimicky and pointless.
Why can't the runtime auto-bind them by matching names? Doesn't ruby work this way?
There seems to be a bit of pointless work that you have to do to get a new controller and view connected and up-and-running.
Why can't the runtime auto-bind them by matching names? Doesn't ruby work this way?
The whole point of having the action/outlet system is that it provides a layer of indirection and lets you write less code. There's no need to write an event handler for a button to make it print a view. You just drag an action from your NSButton to your view, and set its selector to print:. The same goes for outlets.
I'm not sure what you mean by "auto-binding by matching names". The only way I could see that working, is if you gave the control and the target names, then inputted the action as (control name, target name, action). IMO this would be a lot more work than the current UI.
Well, I was referring more to linking IBOutlets as opposed to IBActions.
I think Visual Studio's way is superior - ie, from the UI Designer, you can autogenerate and link the action for a button as well as having the option to link an existing action.
You still have the problem of selecting the object owns the outlet. You may want to connect a text field to an outlet on a view nested down a few levels. You'd have to give both the text field and the view names, which again takes time and effort.
I think Visual Studio's way is superior - ie, from the UI Designer, you can autogenerate and link the action for a button as well as having the option to link an existing action.
I haven't used VS for quite a while. IIRC there is always a user class associated with the UI. This is not the case in Cocoa. It's common for file's owner to be, say, a plain NSWindowController, and there to be no user classes in the nib at all.
It's tempting to think of an "action" in Cocoa as being synonymous with a method. But this isn't the case. When you click a button, it doesn't directly call it's action on its target. The actual process is more complex, and provides a lot of room changing where the action message is sent. This is what makes insane magic that is first responders work.
But software design is ever improving, so don't be discouraged when the world passes you by because you've stuck with your antiquated ways.
This is a totally independent issue from view/controller separation. The right way to do UI development is through a layout language, like HTML/MXML, not through a GUI tool. The web world learned this a long time ago.
Apple thank you for listening.
http://www.bernard-web.com/pierre/code.html
This thing has saved me hours of aggravation. You highlight a line in the struct part of the Obj-C class definition, and it generates the @property, the @synthesize, and a line in dealloc. You can also highlight multiple lines, and it will generate multiple properties. It is even smart enough to know that ints are assign, NSStrings are copy, and other objects are retain.
While I'm sure it's not an issue for most, I've always wondered whether that sort of thing breeds dependency. What happens when you don't have the IDE? Do you forget how to scan and fix minor issues? I've seen much worse... I've seen "professional developers" not know how to code or run projects without their all knowing IDE. Although I don't want to point any particular group out, many users of Visual Studio suffer from this issue.
I also can't speak highly enough about quickfixes. The ide presents me with a problem, and then makes it very easy to fix without having to think about all the crappy mechanics of doing so. If it's a common issue I can fix it all through my file, or all through my project. What is really amazing about this (as well as all the syntax-aware editing functionality) is that once you're good at it, you're no longer editing text, you're directly manipulating the AST at a very semantic level - and not just of a single file, but of your whole project. At the risk of gushing a little, this raised level of editing really contributes to my joy of programming because I'm actually directly manipulating turning my mental design into code. I would like to humbly suggest that people who say that you only need this functionality with crippled languages really don't know what they're missing out on.
Has this removed my ability to program Java in, say, Textmate or vi? No, although I'd have to re-learn so many basic, low level manipulation tasks that there's no way I could stand it. It doesn't remove my ability to develop using these editors, it removes my desire to.
I've been using a manual transmission ever since I took my driver's license 10 years ago. At first I also drove a shitty car ... gears wouldn't shift unless you knew how to touch the gearstick :)
Now I can drive just about anything, with no accommodations necessary. Changing gears is also in my reflex and it doesn't bother me ... I just don't think about it. I can also eat a sandwich or talk to the phone with no hands-free while driving, although that's considered a bad practice that's also illegal :)
People who never drove a stick-shift may have no idea how to operate one. Whereas someone switching from an IDE to a text editor would still be able to work - just less productive.
I have my doubts about that as I have seen many evidence to the contrary.
Technology is great. Embrace the future!
With any (good) technology it becomes easier to do things and we gradually forget how to do the old, more complex way. I remember power going out at a big box (forgot which one) store once. None of the checkers had any idea how to figure out how much the items would cost by hand so the store was forced to simply not do business until power was restored. Was that embarrassing? Perhaps, but who cares? They can serve vastly more customers with the systems they have now than they ever could have with the old manual way.
With a big IDE you can manage vastly bigger projects quickly than you could with a text editor and a make file. You might point to the Linux kernel but most people who work on that just touch one area at a time [1]. With my big fancy IDE I can work on projects of at least that size and make big sweeping refactorings in seconds with complete confidence that nothing got missed.
[1] With the possible exception of Linus but if you're going to require that each of your devs be a Linus (or even that you have one for that matter) then you're probably not going to go far.
The problem is, C is a language where = vs == is actually something you have to think about. It's natural that IDEs arise to address this.
XCode is fixing what is really a problem at the language level. So it's the wrong place to fix the problem. At the same time, trying to fix the problem at the programmer level (by forcing programmers to check = vs ==) is equally the wrong place to fix it.
It's a language issue, and that's the place it really should be addressed. But it will never be addressed there, because it would break backwards compatibility since decades.
Uhh, what? In Lisp's case, most people use emacs and coding Lisp in Notepad is mostly IMPOSSIBLE because trying to balance parentheses and navigate and indent s-expressions manually (and correctly) is idiotic.
There, problem solved.
I would solve the problem in Obj-C by introducing a directive on the file-level for the newer syntax, like how they did it in F# with the "#light" directive. And when a file is compiled with that directive, the compiler could trigger compile-time errors for those obviously dangerous constructs.
x = Post.first ? do_foo(x) : do_bar # does the assignment, then evaluates the result
A nice shorthand in my opinion, so the python way isn't a cure-all :)
(x = Post.first) ? do_foo(x) : do_bar
http://developer.apple.com/technologies/tools/whats-new.html...
(This is probably a side effect of PR people preparing the website; there is no reason why LLVM should not be able to detect this particular kind of NULL-dereference.)
btw, the wwdc videos have been public for a while. Take a look at them if you're itching for more infos: http://developer.apple.com/videos/wwdc/2010/
No official release date for the final release is known, but judging from Apple's history with developer previews you can expect it to be out within 6 weeks.
Not enrolled in the iPhone Developer Program? Learn More" => "[pay $99]"
So, not quite yet.
And make sure to review the Xcode 4 WWDC sessions before you dive in!
Of course, I would hope that there are still options for breaking things into their own window for those who want to.
Forgive the meta-comment, I'm just curious.
Now tree view has been limited to be a file browser. Targets and build steps are now hidden deeper in settings windows and tabs.
To me old way was simpler and felt more elegant.
I'm not fond of "mystery meat navigation" — tabs have icons instead of text labels. I'm sure I'll learn that quickly, but it makes learning curve higher and on first impression UI looks more overwhelming.
Can you bind shell scripts to the run button? Code folding?
I'd also expect navigation based on the semantics: 1. Find classes that implement an interface. 2. From a method in an interface find implementations of that method. 3. From a class easy navigation to the interfaces it implements. 4. Find usages of a particular method, either from the concrete instance or the interface equivalent that it implements.
I'm not very familiar with Objective-C but I'm sure that there's tons of related navigation that could make use of Posing and Categories, for example.
Also it is time to realize that LLVM-based tools are much more effective than JVM-based. (at least they can run or ARM) ^_^
Do not tell me that Dalvik VM is the same as VM from JRE.
How could I run, as declared by marketers - "Code once run everywhere!" a typical Spring + Hibernate + 100 another dependencies poorly designed crap on Dalvik VM?
Thanks.