开发电子商务应用良好的指引 [英] Good guidelines for developing an ecommerce application

查看:142
本文介绍了开发电子商务应用良好的指引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在做Android上的电子商务应用程序和,因为这是我的第一次严重的项目,我试图找出事先最好的办法做到这一点。

I'm making an ecommerce application on Android and, as it is my first serious project, I'm trying to figure out beforehand the best approach to do this.

应用程序会谈到Web服务(Magento的API,这意味着SOAP或XML RPC遗憾的是),并得到所有的手机上的内容(产品类别,产品细节,用户凭证等)。我认为它应该做延迟加载或类似的东西。

The application talks to a web service (magento api, meaning soap or xml rpc unfortunately) and gets all the content on the phone (product categories, product details, user credentials etc.). I think it should do lazy loading or something like that.

于是,我就在想,以保持在自定义对象的用户凭证将被保存在一个共享preferences 让每一个活动C和方便地访问它。我会用一对夫妇的ListView S与展示的内容和的AsyncTask 来获取所需的数据。我应该保存在内存中的所有数据对象或我应该使用某种形式的缓存或本地数据库的?另外,我打算使用的HashMap SoftReferences 持有我下载的位图。但是,这是不是吃了很多的内存?

So, I was thinking to keep the user credentials in a custom Object which will be kept in a SharedPreferences so that every Activity cand easily access it. I'll use a couple of ListViews to show the content and AsyncTask to fetch the data needed. Should I keep all the data in memory in objects or should I use some sort of cache or a local database? Also, I'm planning to use a HashMap with SoftReferences to hold the bitmaps I am downloading. But wouldn't this eat a lot of memory?

如何C和所有的活动,有机会获得所有这些对象(电子商务篮等)?我想用意图通过他们,但是这似乎并没有我的权利。可用于大量的对象共享preferences以及是否有任何并发​​问题?

How cand all the activities have access to all these objects (ecommerce basket etc.)? I'm thinking of passing them using Intents but this doesn't seem right to me. Can SharedPreferences be used for a lot of objects and are there any concurrency issues?

任何指针将是真正的AP preciated。有什么好的指导原则?我应该考虑什么课?你知道互联网上的任何资源为我检查出来吗?

Any pointers would be really appreciated. What are some good guidelines? What classes should I look into? Do you know of any resources on the Internet for me to check out?

推荐答案

一个非常详细的问题,我会尽我所能来回答这个问题。 我用下面的方法在我的应用程序:

A very detailed question I will do my best to answer it. I used the following approach in my application:

  • 我保存在共享preferences用户凭据。在preferences只能保存自定义的对象,如果他们是序列化和写作,并从闪存中读取需要花费大量的时间。所以我加载preferences上启动,并将其存储在内存中。

  • I save the user credentials in the shared preferences. The preferences can only hold custom objects if they are serializable and writing and reading from flash memory takes a lot of time. Therefore I load the preferences on startup and store them in memory.

我尽量保持在内存中,它通过序列化到JSON和通过的意图需要在很多地方和一致的状态,所有其他的内存通过了所有的数据,或者我通过唯一的ID和我重新从网上获取它。 (有明确可能为兑现在本地数据库中,但为了保持它最新的就是目前大量的工作。)来存储需要长期从内部存储器或网络重新载入和重新对象分析它,我用自定义应用持有引用到管理缓存一些控制器对象。该应用程序将保存在内存中,直到您的应用程序被关闭。这是方便,但可能会导致需要的方式来多的内存,如果你不小心。

I try to keep all the data in memory that is needed in many places and in a consistent state, all the other memory is passed via serializing to json and passing through an intent or i pass only ids and I re fetch it from the net. (There is definitively a possibility for cashing in a local database but the effort to keep it up to date is to much work at the moment.) To store objects that take to long to reload from internal memory or network and re parse it I use a custom application that holds the reference to some controller objects which manage the caching. The application will stay in memory until your app is closed. This is convenient but can result in needing way to much memory if you are not careful.

这是由我的程序下载的位图缓存在两层。在我第一次想要访问创建里面我的活动范围图像管理器对象的图像。该对象将设法找到在内部映射位图。如果它不存在,它会尝试从手机内存中加载它,如果它不是在手机内存会从网上下载它,它存放在我的应用程序的缓存文件夹,并把它在地图上。以这种方式,位图是可访问的,只要活动运行和被清除的时刻在用户改变到另一个屏幕。到现在为止,这是够我。

The bitmaps that are downloaded by my program are cached on two layers. At the first time I want to access an image I create a image manager object inside my activity scope. That object will try to find the bitmap in an internal map. If it is not there it will try to load it from phone memory if it is not in the phone memory it will download it from the net, store it in the cache folder of my app and put it in the map. In this way the bitmap is accessible as long as the activity runs and is cleaned up at the moment the user changes to another screen. Until now this is sufficient for me.

在年底才开始编程,然后回来,如果你遇到其他问题或错误,并发布一些更具体的问题。

At the end just begin programming and come back if you encounter other questions or errors and post some more specific questions.

这篇关于开发电子商务应用良好的指引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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