学习objective-c更有助于理解计算机架构

发布于 2024-09-06 20:01:10 字数 62 浏览 2 评论 0原文

比 Java C# 等更高级的语言... 这个论点有效吗?我是 iPhone 开发新手,有些人告诉过我这一点。

than higher level languages such as Java C#...
is this argument valid? I'm new to iPhone development and some people have told me this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

故事还在继续 2024-09-13 20:01:10

你会问,如果你驾驶手动变速箱而不是自动变速箱,你是否会对汽车机械有更好的了解 - 你会更多地感受到发动机在做什么,并且你会感到可怕的磨擦感如果你做错了,就会一团糟,但你也不会从任何一个中获得“幕后”的任何深刻理解。

C 语言的语义(objective-C 是 C 语言的超集)与它所创建的机器 - PDP-11 的体系结构相呼应。

如果你看看现代计算机体系结构 - 共享指令和数据内存、虚拟内存、L1 和 L2 缓存、总线速度限制、“北桥”和“南桥”、多核或多核 CPU、固态磁盘、图形处理器、FPGA 加速器 - 那么没有一种语言具有与所有变体相呼应的语义,C 语言也与它们没有任何关系。了解计算机体系结构的最佳场所是计算机体系结构教科书或讲座,或者阅读有关如何所有语言的现代建筑效果程序

C 将为您提供一个可移植的汇编器,因此代表了与架构相距几个步骤 - 它假设您有指向可以存储数据的区域的指针(可以实现为地址),并且它具有暗示数据可能会更改的关键字(易失性),并且 CPU 有寄存器而不是基于堆栈。但它不会真正告诉你太多关于机器架构的信息,它只会告诉你 C 内存模型,这是 40 年前机器的抽象。

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.

回首观望 2024-09-13 20:01:10

您编程的上方和下方总是有一个架构。 C#/Java 允许您对 CLR/JVM 虚拟机进行编程(从而了解),而较低级别的语言允许您了解较低级别的知识,而类似的高级语言(例如 SQL)将允许您对更高的体系结构进行编程。 取决于你想学什么。

一般来说,汇编器会让你熟悉大多数 CPU 架构,而像微编码这样的东西会教你底层的东西(如果你想了解的话)。相信我,还有更低的级别。

我个人推荐 C(及其子 C++ 和 Objective C)作为学习主流计算机架构以及以及 iPhone 架构的一个很好的中间点。

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.

善良天后 2024-09-13 20:01:10

如果你想做Iphone开发,它是唯一的选择,你不能使用Java或C#作为之一Apple新政策的说明

如果你不想做Iphone开发,当你与硬件密切相关时,学习C/Assembly也是不错的选择

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

浮生面具三千个 2024-09-13 20:01:10

我的一位大学老师曾经在性能优化的讲座中说过:

  • 编写操作系统——了解你的机器。
  • 利用安全漏洞?了解您的机器。
  • 优化性能?了解您的机器。
    等等...

要了解您的机器:学习组装。

然而,我相信 Objective-C 可能是学习一些编程基础知识的更好方法,你必须考虑内存管理,而在 Java 中你不必考虑那么多。尽管我必须同意前面发言者的观点,但 C 可能是更好的方法。

附注。在讲座结束时,这位老师还说:“学习汇编:了解你的机器”。一定要喜欢它。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文