Back to rails
Frameworks and reuse
It's notable that when he explains this, the discussion of the 'hollywood principle' and hook-and-subclass (what I often call the "framework dual nature - both mould and conductor') seems to come as a consequence of the reuse constraints. I must admit I was somewhat puzzled by the mix of concrete and architectural levels in these three layers.
Another interesting point is the gradual exposition of API and that new API should be driven by existing client needs, or even better with existing replicated code. API design is hard. API design coming from hypothetic needs is harder -and- high-risk. The conclusion is also worthwhile: don't try to have everything in a big framework, build several smaller frameworks instead. I tend to agree, but this often comes with a new difficulty: mixing frameworks means mixing different ways of delegating control to hooked objects, which complicates interactions. And often, complex interactions are not that explicit or formalizable in code.
Something different: some notes from a conversation with LC. At class-level, the encapsulation principle is often viewed as a way to hide data and internals, but it should also be viewed as a way to encapsulate and control life-cycle for an instance. Data/behavior and dynamics equally important in encapsulation?
- The Universal Binaries guidelines. Includes information about the "fat binaries" executable, but also some bits about your matrix or vector-based code, byte swapping, architecture differences.
- WebKit is now OpenSource ! Check it out
- Many additions to the ADC sample code section: SOAP from Cocoa, using SyncServices with Carbon HTLB, AppKit and CoreImage, Core Video, new XCode 2.1 features, etc.
Helping a switcher (2: terminal tools)
Some OS X specific command line tools (see also this list by Amit Singh):
- Monitoring your system and apps:
latency. With Developer Tools installed, the Shark application is a must-try.
- Single most useful terminal command
/usr/bin/open. This command takes an argument and has the same effect than double-clicking the given file or directory in the finder. So you can type
open mypict.jpgand have it open in your default viewer application (as set in the Finder information preferences), or
open http://www.apple.comthat will trigger the default URL scheme handler. The
-aflag is quite useful, check the man page.
- You can also manipulate clipboard information from the shell with
screencapturecan also be useful.
- Lost in libraries ?
otool -Lis the equivalent of the beloved Linux
- Exploring the hardware ? There is command-lines alternative to the IOKit Explorer or Apple System Profiler:
ioreg. You can also check the manpage for
sysctlto fine-tune your system.
pmsetcan also be helpful to tweak power management settings. Check also
- Speaking about command-line equivalent for GUI tools,
hdituilis the terminal equivalent of the Disk Utility application. Unified tool to burn, create , convert, compact, segment, manipulate disk images (CD, DVD, ISO images...). Oh, and burn these, too.
- One little secret: the powerful Spotlight tool introduced in 10.4 is also available at terminal-level, and it's a really powerful tool. Think locate on steroids. It's
mdfind, check the manpage for detailed info.
- A very interesting addition in 10.4 is "launchd" the new unified daemon/agent manager. Check the manpages for
launchctl. This a very interesting replacement for cron/xinetd/rc.d etc. Might look weird when coming from a classic Unix background, but this brings very, very interesting features (fine job control, user/system unification, etc). There's a doc on ADC.
- X11 ? Why would you need X11 as you already have Quartz. Ok, ok, I installed it too. Note that for a few years, X11 is shipped by Apple in Mac OS X, but as an optional install. Think about it and click on the "customize" button when installing your OS. If you already have OS X in place, you can still install it. Open your installation DVD, the packages are usually in
/System/Library/Installationand there are two packages, X11User.pkg and X11SDK.pkg (headers and tools). A final trick: the
/usr/bin/open-x11is a nice shortcut to launch a X11 application, it will automatically start the X11 server is needed.
- The I/O Kit registry is the closest thing to the
/prochierarchy on Linux. The IOKit is the 'driver level' in OS X, a neat efficient, object-oriented driver model, architectured with energy management in mind. Try for instance
ioreg -lto display the whole registry with object properties.
Helping a switcher (1: GUI apps)
IRC client: Colloquy. The holy grail ? an IRC client that I find useful and nice to use, and I think I tried absolutely every IRC client on the platform. Really customizable, including the display styles, open-source, nice architecture.
Camino. If you're a regular Firefox user on another platform and a little uneasy with Safari, then you should try Camino. It is the Mozilla Gecko engine, embedded in a native GUI, including with what you would expect from an OS X browser (keychain integration, etc).
Adium: a multi-procol Instant Messaging client. I'm not -really - using this one (I'm an iChat user), but it looks quite nice and I often read good reviews about it.
Chicken of the VNC: a simple and cool VNC client. Note that with 10.4, every mac comes with a VNC server (in System Preferences, choose Sharing and then "Apple Remote Desktop", in the "Access Privileges" sheet, you'll find settings for VNC viewers).
DiskInventory X, a graphic disk usage tool. I'm using it a lot.
A really nice port of GraphViz to OS X
NetNewsWire: an excellent RSS aggregator. Freeware and shareware versions available.