English 中文(简体)
继承费用 Java (Android)
原标题:Cost of Inheritance Java (Android)

我正在把ORMLite延伸到安的安托。

www.un.org/Depts/DGACM/index_spanish.htm 我想做的是。

I want to reproduce one of the behavior that Doctrine and Symfony are achieving in PHP with models. In a word:

  • From a yml file generate a bunch of BaseModel class with accessors and things that won t change.
  • Let the real model inherits from this BaseModel so that the user changes could persist even if they regenerate the models from the yml.

My question

我很想知道,这在实践中是否好,能否试图在安乐施上实现这样一个目标,或者这是否会在业绩(大量使用继承)方面带来风险。

If you think that it is clumsy, how can I allow the user to change the .yml file, generate the model and do no start from scratch rebuilding the customized aspects of his model. I know this can be done by some "trick" but I really would like not to reinvent the wheel.

EDIT

Sorry, I forgot to add: I am using python to do this.

增 编

最佳回答

这种做法是正确的,很可能只是 Java。 在 Java,除非你使用<代码>final,否则所有电话都是虚拟的。 但这意味着你甚至可以使用接口。 因此,大多数电话很可能是几乎发送了你的一切。 继承不会受到任何其他重要惩罚。

Besides, Android devices are generally so powerful that trying to sqeeze out tiny bits of performance at the cost of readability and maintainability of the program is almost certainly not needed. In fact, most android devices are almost as powerful as web servers that do the same things in much slower PHP and still manage thousands of users while the Android device serves one.

问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签