learning objective-c is better for understanding computer architecture
than higher level languages such as Java C#... is this argument valid? I'm new to开发者_如何学Python iPhone development and some people have told me this.
You're asking whether you get a better idea of car mechanics if you drive a manual transmission rather than a automatic - you'll kind of get a bit more of a feel what the engine is doing, and you'll get a horrible grinding mess if you do it wrong, but you won't get any deep understanding of what is 'under the hood' from either.
The semantics of the C language, of which objective-C is a superset, echoes the architecture of the machine it was created for - the PDP-11.
If you look at modern computer architectures - shared instruction and data memory, virtual memory, L1 and L2 cache, bus speed limits, 'north' and 'south' bridges, multi-core or many-core CPU, solid state disk, graphics processor, FPGA accelerators - then there isn't one language which has semantics which echo all of the variants, nor does the C language have anything to do with them. The best place to learn about computer architecture is a computer architecture text book or lecture, or read about how modern architecture effects programs in all languages.
C will give you a portable assembler, so represents a couple of steps away from the architecture - it assumes you have pointers (which may be implemented as addresses) to areas you can store data, and it has keywords which imply that data may change (volatile) and that the CPU has registers rather than being stack based. But it won't really tell you that much about the architecture of your machine, it will only tell you about the C memory model, which is an abstraction of the machines of 40 years ago.
There is always an architecture above and below where you program. C#/Java allows you to program (and thus learn about) the CLR/JVM virtual machines, while lower level languages allow you to learn about lower levels, and similarly higher level languages (e.g. SQL) will allow you program to higher architecture. Depends what you want to learn about.
Generally assembler will ground you in most cpu architectures, while things like microcoding will teaching about lower stuff (if you care to learn about that). Trust me there are levels lower.
Personally I recommend C (and it's children C++ and Objective C) as a good mid may point to learn about mainstream computer achitectures aswell as the iPhone architecture.
If you want to do Iphone development, it is the only choice, you can't use Java or C# as one of the new policy of Apple
If you don't want to do Iphone dev, learning C/Assembly is also good when you working closely to hardware stuff
A teacher of mine in collage once said under a lecture in Performance Optimization:
- For writing an OS - Know your machine.
- Exploiting security holes? Know your machine.
- Optimizing performance? Know your machine. etc...
To know your machine: Learn assembly.
However, I believe objective-c might be a better way to learn some fundamentals of programming, you do have to think about the memory management, which you don't have to think about that much in Java. Though I must agree with earlier speakers, C might be a better approach.
A side note. In the en of the lecture, same teacher also said: "To learn assembly: Know your machine". Got to love it.
精彩评论