software-design

Why encapsulation is an important feature of OOP languages? [closed]

試著忘記壹切 提交于 2019-11-26 13:10:29
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 5 years ago . I came across different interview where question was asked to me why encapsulation is used? Whose requirement actually is encapsulation? Is it for users of program? Or is it for co-workers? Or is it to protect code from hackers? 回答1: Encapsulation helps in isolating

What is the benefit of using Fragments in Android, rather than Views?

落爺英雄遲暮 提交于 2019-11-26 08:45:17
问题 When developing for Android , you can set your target (or minimum) sdk to 4 (API 1.6) and add the android compatibility package (v4) to add support for Fragments . Yesterday I did this and successfully implemented Fragments to visualize data from a custom class. My question is this: what is the benefit for using Fragments as opposed to simply getting a View from a custom object, and still supporting API 1.5? For example, say I have the class Foo.java: public class Foo extends Fragment { /**

What is a software framework? [closed]

那年仲夏 提交于 2019-11-26 07:50:57
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . Can someone please explain me what a software framework is? Why do we need a framework? What does a framework do to make programming easier? 回答1: I'm very late to answer it. But, I would like to share one example

Avoiding Circular Dependencies of header files [duplicate]

点点圈 提交于 2019-11-26 05:23:47
问题 This question already has an answer here: Resolve build errors due to circular dependency amongst classes 11 answers Do you have any good advice on how to avoid circular dependencies of header files , please? Of course, from the beginning, I try to design the project as transparent as possible. However, as more and more features and classes are added, and the project gets less transparent, circular dependencies start happening. Are there any general, verified, and working rules? Thanks. 回答1:

What does “program to interfaces, not implementations” mean?

为君一笑 提交于 2019-11-25 23:16:09
问题 One stumbles upon this phrase when reading about design patterns. But I don\'t understand it, could someone explain this for me? 回答1: Interfaces are just contracts or signatures and they don't know anything about implementations. Coding against interface means, the client code always holds an Interface object which is supplied by a factory. Any instance returned by the factory would be of type Interface which any factory candidate class must have implemented. This way the client program is