[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [rhel6-branch 2/2] memory: increase the RAM limits, check for URL installs (#549653).



On 05/05/2010 07:58 PM, Brian C. Lane wrote:
-def checkMemory(opts):
-    if iutil.memInstalled()<  isys.MIN_RAM:
+def check_memory(opts, display_mode=None):
+    def within_available_memory(needed_ram):
+        # kernel binary code estimate that is
+        # not reported in MemTotal by /proc/meminfo:
+        epsilon = 15360 # 15 MB
+        return needed_ram<  (iutil.memInstalled() + epsilon)

Putting methods inside methods really bugs me. I don't see any reason
for this.


Hi Brian,

thanks for the review.

I sometimes like inner methods, particularly in situations like this.

1) I introduced this just not to repeat the small snippet with epsilon two times in the big function. It probably doesn't make a lot of sense for the anaconda module as a whole.

1) I don't want anyone else calling this method. It's sort of private for check_memory. If the memory checking process changes I want to be able just to remove it or change it without having to look around whether someone else hasn't started calling it. (if on the other hand someone finds the inner method useful, it's simple enough thing to break it out to the top level).

3) It's in the spirit of functional programming (msivak's comment), which is generally a friend of maintainability.

4) if it's inner it doesn't confuse someone just quickly skimming methods available in the module.

Nevertheless, I wanted to push this asap so I broke it out to deserve the ack.

Ales


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]