核心数据VS SQL语句,哪一个是gd for iphone开发? [英] Core Data VS SQL Statement, which one is gd for iphone development?

查看:78
本文介绍了核心数据VS SQL语句,哪一个是gd for iphone开发?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

iPhone 3.0支持Core Data,它似乎是开发人员的一个很好的工具。但SQL语句似乎更容易得到启动,但核心数据更容易维护db。但我正在考虑SQL语句,因为它似乎有更好的性能。我认为哪一个是更好的iPhone开发,任何建议?

解决方案

答案实际上比任何一个博客帖子使它出现。规则是:


  1. 如果您正在开发任何OS X平台;

  2. 不访问专有格式;和

  3. 如果您的持久性文件不需要在非OS-X平台上读取

那么你应该使用Core Data。就是这么简单。核心数据为您提供了这么多的功能和易用性相比,直SQL使选择简单。至于表演,这是一个红色的鲱鱼。在这里,Core Data可以并且轻松地执行访问SQLite数据库的自定义代码。但是,Cocoa Touch的性能实际上是次要的关注。



主要关注的是内存。你有一个微小的内存,在其中使用Cocoa Touch和你的数据模型可以很容易地打破这一点。核心数据解决该问题。它会监视它使用了多少内存,并会在收到内存警告时自动将对象从内存中删除 。所有这些相当复杂的代码,如果你直接使用SQLite,你必须自己写。



减少编写你的数据模型的时间意味着你有更多的时间使你的应用程序更好。 / p>

iPhone 3.0 support the Core Data, it seems a great tool for developer. But SQL statement seems it is easier to get start, but core data is easier for maintaining db. But I'm considering the SQL statement, because it seems have better performance. I am consider which one is better for iPhone development, any suggestion?

解决方案

The answer is actually much simpler than either of those blog posts make it appear. The rule is:

  1. If you are developing for any OS X platform;
  2. If you are not accessing a proprietary format; and
  3. If your persistence file does not need to be read on a non OS-X platform

Then you should go with Core Data. It is that simple. Core Data gives you so many features and the ease of use compared to straight SQL makes the choice simple. As far as performance, that is a red herring. Where it counts, Core Data can and does easily out perform custom code accessing a SQLite database. However, performance on Cocoa Touch is actually a secondary concern.

The primary concern is memory. You have a tiny amount of memory in which to work with on Cocoa Touch and your data model can easily blow that out. Core Data solves that issue. It watches how much memory it is using and will drop objects out of memory automatically when it receives a memory warning. All of that fairly complex code you would have to write yourself if you used SQLite directly.

Less time coding your data model means you have more time making your application great.

这篇关于核心数据VS SQL语句,哪一个是gd for iphone开发?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆