The Big Programming Thread - Page 481
| Forum Index > General Forum |
Thread Rules 1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution. 2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20) 3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible. 4. Use [code] tags to format code blocks. | ||
|
Nesserev
Belgium2760 Posts
| ||
|
3FFA
United States3931 Posts
![]() Fixed Code as requested below. ![]() | ||
|
Nesserev
Belgium2760 Posts
| ||
|
Manit0u
Poland17496 Posts
![]() Hahahaha | ||
|
BungaBunga
Italy23 Posts
| ||
|
jtype
England2167 Posts
On May 18 2014 00:10 BungaBunga wrote: Are there any iOS developers around here? Do you have a question for them? | ||
|
Blisse
Canada3710 Posts
| ||
|
BungaBunga
Italy23 Posts
I've put a lot of effort into making an Android app. The app is doing ok and I can currently live off it. Now the question is if it makes sense to repeat the same thing for iOS. I cannot afford hiring another developer or designer. So I would basically have to do it all by myself. It would probably take me about 2 years to get the iOS app done. Here are the things that concern me: - I would need to buy all the Apple stuff (laptop, iPhone, tablet) - I'm not a designer myself. Even though the app looks ok for Android, I know that the bar for iOS is a lot higher. - On Android it is relatively easy to get steady downloads with good SEO. On iOS I've heard that you need to spend loads of money on marketing just to be visible. I'm wondering if anyone has some experience with that. | ||
|
Manit0u
Poland17496 Posts
On May 18 2014 19:03 BungaBunga wrote: Here is my question: I've put a lot of effort into making an Android app. The app is doing ok and I can currently live off it. Now the question is if it makes sense to repeat the same thing for iOS. I cannot afford hiring another developer or designer. So I would basically have to do it all by myself. It would probably take me about 2 years to get the iOS app done. Here are the things that concern me: - I would need to buy all the Apple stuff (laptop, iPhone, tablet) - I'm not a designer myself. Even though the app looks ok for Android, I know that the bar for iOS is a lot higher. - On Android it is relatively easy to get steady downloads with good SEO. On iOS I've heard that you need to spend loads of money on marketing just to be visible. I'm wondering if anyone has some experience with that. http://www.xda-developers.com/android/google-tool-helps-developers-port-android-apps-to-ios/ Maybe this can help... On another note, do you guys have an idea how can one access the private function of a parent class from one of its child classes? | ||
|
Deleted User 101379
4849 Posts
On May 18 2014 19:48 Manit0u wrote: On another note, do you guys have an idea how can one access the private function of a parent class from one of its child classes? You don't. Private: Only visible to the current class. Protected: Visible to the current class and any classes inheriting this class. Public: Visible to everyone. What you want is a protected method, not a private one. | ||
|
Manit0u
Poland17496 Posts
On May 18 2014 22:58 Morfildur wrote: You don't. Private: Only visible to the current class. Protected: Visible to the current class and any classes inheriting this class. Public: Visible to everyone. What you want is a protected method, not a private one. That much I knew, thought that maybe there's some hacks you could use that I didn't know of. The thing is, I have a big private function in one class in the big framework. I need to alter this function ever so slightly without having to rewrite a ton of stuff (the class containing the private function has lots of children). Simply changing it to protected won't work since I don't know if any of its children won't override it then. It's a poor design by the creator of this thing... Anyway, another question, this time about JS (of which I don't know much so I'll write it more in pseudo-code than anything):
Input/Output:
Any idea why it doesn't return the .length property? I know that it would be true in the past for array-like objects but I hear it isn't the case now... I'm confused. | ||
|
spinesheath
Germany8679 Posts
If you have access to the source code of the problematic class, you probably can introduce a level of indirection to safely lower the protection level to protected: First write a protected method that simply forwards to the private method you want to override. Then change all references to the private method to use the new method instead. If you made sure that the name of the new protected method won't clash with any method names of any potential subclasses, you now have a protected hook that nobody uses yet. | ||
|
berated-
United States1134 Posts
On May 18 2014 23:04 Manit0u wrote: That much I knew, thought that maybe there's some hacks you could use that I didn't know of. The thing is, I have a big private function in one class in the big framework. I need to alter this function ever so slightly without having to rewrite a ton of stuff (the class containing the private function has lots of children). Simply changing it to protected won't work since I don't know if any of its children won't override it then. It's a poor design by the creator of this thing... Anyway, another question, this time about JS (of which I don't know much so I'll write it more in pseudo-code than anything):
Input/Output:
Any idea why it doesn't return the .length property? I know that it would be true in the past for array-like objects but I hear it isn't the case now... I'm confused. what type would you say blahblah is? ![]() Your example isn't 100% clear to me, but hopefully some of this helps? If you are actually passing in an argument like args, then its possible in your example that args could be an object, not an array.
Above would be an example where you obj[1] would return a value but length would not be known. If you are actually trying to access the arguments of a function, then, the keyword is arguments and it isn't passed into the function, its just kind of there. Example of arguments | ||
|
Manit0u
Poland17496 Posts
On May 18 2014 23:39 berated- wrote: what type would you say blahblah is? ![]() Your example isn't 100% clear to me, but hopefully some of this helps? If you are actually passing in an argument like args, then its possible in your example that args could be an object, not an array.
Above would be an example where you obj[1] would return a value but length would not be known. If you are actually trying to access the arguments of a function, then, the keyword is arguments and it isn't passed into the function, its just kind of there. Example of arguments Trying to help some poor soul using stuff I didn't create with my (very) limited knowledge of JS. Can't get more specific since that's all I got from said person. | ||
|
phar
United States1080 Posts
Manit0u - the direct answer to your question is yes, you can do it. Spine is in the right direction with reflection, here is an example in Java: http://stackoverflow.com/questions/14398157/how-to-invoke-parent-private-method-from-child Morfildur is in the more correct direction though - even though it's possible, you really should not do this except under some very rare circumstances. You might need it in a very specific unit test to ensure the exact behavior of some type of configuration - but even then you should exhaust all other possibilities of designing your code in a way that doesn't force you to use reflection on private methods. | ||
|
Manit0u
Poland17496 Posts
On May 19 2014 04:24 phar wrote: On the comments on reflection above: Manit0u - the direct answer to your question is yes, you can do it. Spine is in the right direction with reflection, here is an example in Java: http://stackoverflow.com/questions/14398157/how-to-invoke-parent-private-method-from-child Morfildur is in the more correct direction though - even though it's possible, you really should not do this except under some very rare circumstances. You might need it in a very specific unit test to ensure the exact behavior of some type of configuration - but even then you should exhaust all other possibilities of designing your code in a way that doesn't force you to use reflection on private methods. Thanks, Reflection is what I needed. I can't change the design since I have to work with something designed by someone else that's already in production environment so I don't really have much leeway here. I'm not even sure I'm still going to use this (most likely not), just wanted to know if it was possible. | ||
|
phar
United States1080 Posts
| ||
|
Shield
Bulgaria4824 Posts
Edit: Or is this the superclass instance?
| ||
|
Nesserev
Belgium2760 Posts
| ||
|
teamamerica
United States958 Posts
On May 18 2014 22:58 Morfildur wrote: You don't. Private: Only visible to the current class. Protected: Visible to the current class and any classes inheriting this class. Public: Visible to everyone. What you want is a protected method, not a private one. Just as a useless tidbit, afaik protected is visible to any children classes as well as any classes in the same package. Apparently in Javaland, at some point they imagined the atomic units of code being packages? | ||
| ||

![[image loading]](http://asset-7.soup.io/asset/7296/2518_78d6_500.jpeg)