I'm learning about the &quot;coding to an interface to hide implementation details&quot; design principle, and I'm confused over this idea. In my example, I have a WorkoutRoutine class that has a List of RoutineStep. By following the coding to an interface principle, my getWorkoutRoutine() method will return the List interface so that the implementation details of which list is used is hidden from the client. What if I decide to change the implementation from a List of RoutineStep to an array of RoutineStep, won't disclosing the return type as List reveal to the client that a list was implemented and not an array, tree, graph, or any other data structure? How can I best encapsulate my data structure for holding a collection of RoutineStep, such that I can change the implementation of the data structure without the client code breaking if the List was changed to an array, tree, graph, etc? public class WorkoutRoutine {            private List&lt;RoutineStep&gt; workoutRoutine;       public List&lt;RoutineStep&gt; getWorkoutRoutine() {          //What if I later decide to change the data structure from a List to an array, tree,               //graph, set, map. What approach should I take so that the client code doesn't break          //as they would have already coded to receive a List but after changing the           //implementation from a list to an array or any other data structure, their code would           //break.      } }
I have seen this mentioned a few times and I am not clear on what it means. When and why would you do this?   I know what interfaces do, but the fact I am not clear on this makes me think I am missing out on using them correctly.   Is it just so if you were to do:  IInterface classRef = new ObjectWhatever()   You could use any class that implements IInterface? When would you need to do that? The only thing I can think of is if you have a method and you are unsure of what object will be passed except for it implementing IInterface. I cannot think how often you would need to do that.   Also, how could you write a method that takes in an object that implements an interface? Is that possible?
I have watched the series of Two and a Half Men two times now till the latest episode, but can't understand why either Charlie or Walden just don't kick Alan out? I mean it is a bit cruel but they are shown to put up with him even though he gets up on their nerves (even got on my nerves).    Some examples off the top of my head:   He became the reason of his first engagement with Mia to be broken up.   He once set up his curtains on fire after ruining his day.   He invited his girlfriend/assistant to move in without his permission and started acting like he owned part of the house when he didn't even pay rent. He acted sickly and dying (Walden's time) and tricked him out of money for his care and comfort.   He deliberately tried to break his relations (Walden's) just so he can keep sponging off.   I know not the best examples, but if not in every episode then in every alternate episode he is shown to getting up on their nerves and they just keep on telling him to leave. Why don't they just kick him out? Why put up with such a leach? Benefits of using backtick (`) in MySQL queries? In MySQL we can create queries with or without the backtick (`) symbol. Example:   SELECT * FROM TEST; SELECT * FROM `TEST`;   Both works fine in mysql-console.  Is there any technical difference between them?  Is there any benefit using (`) over over simple queries? Is there a word that describes a parent whose child has died?   Along the lines of "orphan", "widow", and "widower", is there a single word for a parent who has lost a child (of any age)? I am looking for an intuitive explanation as to why/how row rank of a matrix = column rank. I've read the proof at  and I understand the proof, but I don't "get it". Can someone help me out with this ?   I find it hard to wrap my head around the idea of how the column space and the row space is related at a fundamental level. Automatically logging into Windows XP Formula for the $n$th term of $1, 2, 2, 3, 3, 3, 4, 4 ,4, 4, 5, ...$ There exists a formula for the $n$th term of this sequence  from the OEIS ("$n$ appears $n$ times") $$1, 2, 2, 3, 3, 3, 4, 4 ,4, 4, 5...$$ which is $$\left \lfloor \frac {1+\sqrt{1+8n}}{2} \right \rfloor.$$  Is there a better formula for the $n$th term? A formula that isn't a 'magic' one that just happens to work but one that comes from a well-founded observation. Preferably one not using the floor function. I also have suspicions about the sustainability of the above formula as I feel with very $n$ it may not function properly. example.com is hosted on IP address c.c.c.c at host1, no access any windows server admin at all blog.example.com is  on IP a.a.a.a at host2, full access to Linux server admin, using WordPress   So basically, I can fiddle with subdomain all I want.  I can't 301 redirect because the content on host 1 is an eCommerce site that I have no server control over. Can't put WordPress on it, can't run scripts, can't do anything on the server period.  Is there a method to "mask" all the URLs on root blog.example.com so they appear as example.com/blog/ folder?  They can't actually be sent to example.com/blog/ as that doesn't exist. It just needs to look to the surfer as if they are there.  Can this be done with some kind of masking or something?  Will this be better for SEO as hopefully search engines will see the blog in a directory on the main domain? How to get a function name as a string? In Python, how do I get a function name as a string, without calling the function?  def my_function():     pass  print get_function_name_as_string(my_function) # my_function is not in quotes   should output "my_function".  Is such function available in Python? If not, any ideas on how to implement get_function_name_as_string, in Python? Describing integral closure of quadratic number fields I'm facing the following problem.      Let $p$ be a prime and $ K=\mathbb{Q}(\sqrt{p}) $. I'm trying to find the integral closure of $ \mathbb{Z} $ in $ K $.   I don't really know where to start. I've managed to prove that $ \mathbb{Z}[\sqrt{p}] $ is in the integral closure and I'm almost sure $ \mathbb{Q} $ is not.   I can't think of a systematic way to approach this. I would appreciate any help. Can every even integer be expressed as the difference of two primes? If so, is there any elementary proof? Functions satisfying $f\left( f(x)^2+f(y) \right)=xf(x)+y$ I need this date format in a visualforce page: "December 14, 2013". I can't seem to find the format options for visualforce. I read that it's the same as the java messageformat class options, but I cannot find a list for that either.  A little help would be much appreciated Derivative of $(y-XB)' h(y-XB)$ with respect to $B$ If a drive doesn't know about partitions and files systems why moving a file from one partition to another takes relatively long time, unlike the instantaneous move on the same partition? Is that file system inefficiency? In this case, NTFS. It seems like the file is being copied and then original is erased, instead of removing the entry about that file in one partition and making it in another? How to prove this inequality $\left|x\sin{\frac{1}{x}}-y\sin{\frac{1}{y}}\right|<2\sqrt{|x-y|}$? For any real numbers $x,y\neq 0$,show that $$\left|x\sin{\dfrac{1}{x}}-y\sin{\dfrac{1}{y}}\right|&lt;2\sqrt{|x-y|}$$ I found this problem when I dealt with . But I can't prove it. Maybe the constant $2$ on the right hand side can be replaced by the better constant $\sqrt{2}$? Thank you. What are the current travel restrictions on individuals entering the United States from regions affected by Covid-19? Why Integer.getInteger does not work? Where to get QGIS toolbar icons? Does anybody know where to download the QGIS toolbar icons? How do I bake multiple texture maps into 1 UV, In Blender Cycles? Using:  Blender V2.79 Cycles Render Engine  After creating a complex interior scene consisting of 3 different texture types, each having 3 associated maps (Diffuse, Gloss, Normal) I noticed the texture and baking options will not successfully combine to create a texture for the exported mesh once I bring it into Unity 3D. The mesh is a single object with the different textures assigned to specified faces.  I've played around with a default cube mesh for testing purposes, using the same 3 textures split among the 6 sides, but have only been able to successfully pull over the color info by baking a diffuse map to my UV and saving the image. When using the other baking options, Blender does not successfully create a map for either my Glossy textures, nor my normal map. Even using the "Combined" baking option, I am provided a flat dull diffuse image for my mesh, no gloss or normal info is saved.  My Node process for textures is displayed here  Here is the result of baking my textures as a Normal  The result of adding other textures made from Blender's baking, results in flat gloss at best.  What can I do differently in Blender, to have my assigned UV Diffuse, Normal, and Gloss maps all appear in a single object in Unity? Is there a printable version of a reference manual for all TeX primitives?