information-hiding

Command Pattern seems needlessly complex (what am I failing to understand?)

流过昼夜 提交于 2019-11-29 09:21:26
I've read up on the Command Pattern, and I think I'm missing something. The Command object exists to abstract away the details of the Receiver object. It seems to me that we could simply stop here, and hold references to Command objects to execute the appropriate method at the appropriate time. Why, then, is the Invoker needed? What advantage does this additional indirection provide? We've already hidden the details of the Receiver behind the Command, what's the motivation for the Command to then be hidden from the client as well? Well, if you put it that way, it seems quite complex, but often

Encapsulation vs Information hiding

旧城冷巷雨未停 提交于 2019-11-28 17:57:57
What exactly are the differences between Ecapsulation and Information Hiding? Well i know that making fields private and then making setter and getter of the fields is ecapsulation.However does encapsulation mean just this? suppose i have a class as described below. public Class IsThisEncapsulation { public int age; public void setAge(int age) { this.age=age; } public int getAge() { return age; } } Now is the class IsThisEncapsulation an example of Encapsulation? Now would making the field 'age' in the above class private achieve informaton hiding? Could you please give me clear examples that

Reducing the visibility of a static method

本小妞迷上赌 提交于 2019-11-28 11:43:05
I know that a child cannot reduce the visibility of a non-static method and I understand why it is so. I've read however that "static method can be hidden through its redeclaration". I however do not understand how this could be achieved in Java. Is this really possible? If yes, how to do that (code example) and why was it introduced (it seems to contradict the principle of non-reducing the visibility of the interface)? The short answer is: no, it is not possible. You have mixed up some terminology. Hiding has nothing to do with accessibility (which is what you are really asking about, not

Best way to hide a form input field from being accessed using firebug?

独自空忆成欢 提交于 2019-11-28 09:34:45
问题 I have a form which is posted to an external API. There is a parameter called customer_token which is passed as an input field. It is used for authentication by the API and every customer is assigned one token. The input field is visible in Firefox's Firebug (even though it is a hidden field). How do I hide it? Options Using javascript as I thought initially I think using javascript to create that input field at the run time before submitting the form and immediately removing the field will

Best way to store data between program runs in java?

前提是你 提交于 2019-11-28 09:26:21
What is the best way to store data between program runs in Java? I already know that you can use a text file and store the information that way, but I was wondering if there is a better way to store the information that is generated by the program between runs of the program. Also, is there any way to do it so as to keep the information secure? Specifically, I want to keep the end user from being able to access it. I was wondering if there was any way other placing the information that is genereated by the program between runs of the program? Simply use an ObjectOutputStream to serialize it

Command Pattern seems needlessly complex (what am I failing to understand?)

…衆ロ難τιáo~ 提交于 2019-11-28 02:49:33
问题 I've read up on the Command Pattern, and I think I'm missing something. The Command object exists to abstract away the details of the Receiver object. It seems to me that we could simply stop here, and hold references to Command objects to execute the appropriate method at the appropriate time. Why, then, is the Invoker needed? What advantage does this additional indirection provide? We've already hidden the details of the Receiver behind the Command, what's the motivation for the Command to

Reducing the visibility of a static method

£可爱£侵袭症+ 提交于 2019-11-27 19:21:31
问题 I know that a child cannot reduce the visibility of a non-static method and I understand why it is so. I've read however that "static method can be hidden through its redeclaration". I however do not understand how this could be achieved in Java. Is this really possible? If yes, how to do that (code example) and why was it introduced (it seems to contradict the principle of non-reducing the visibility of the interface)? 回答1: The short answer is: no, it is not possible. You have mixed up some

Encapsulation vs Information hiding

眉间皱痕 提交于 2019-11-27 10:34:47
问题 What exactly are the differences between Ecapsulation and Information Hiding? Well i know that making fields private and then making setter and getter of the fields is ecapsulation.However does encapsulation mean just this? suppose i have a class as described below. public Class IsThisEncapsulation { public int age; public void setAge(int age) { this.age=age; } public int getAge() { return age; } } Now is the class IsThisEncapsulation an example of Encapsulation? Now would making the field

How can you hide information inside a jpg or gif photo?

最后都变了- 提交于 2019-11-27 07:07:20
How can I write some information inside a photo file like jpg or gif without destroying the image? and of course without showing it on the photo since the whole idea is to send information in the file of photo undetected by anyone (to provide security/privacy to some extent)! You can store some information in image metadata. In fact that's how man digital cameras 'tag' the photos their making (camera model, date and time, GPS coords etc.). This data format is called EXIF (Exchangeable Image File Format). There are a lot of examples how to use it in programming languages. Here's the example in

Best way to store data between program runs in java?

廉价感情. 提交于 2019-11-27 02:53:35
问题 What is the best way to store data between program runs in Java? I already know that you can use a text file and store the information that way, but I was wondering if there is a better way to store the information that is generated by the program between runs of the program. Also, is there any way to do it so as to keep the information secure? Specifically, I want to keep the end user from being able to access it. 回答1: I was wondering if there was any way other placing the information that