Héllo, I have no definitive answer regarding the OOP/functional mismatch.
2014-04-24 18:53 GMT+02:00 <tim.thel...@gmail.com>: > > A reasonable compromise might be to keep the *data* assocated > > > > with a SubuserProgram in a class, maybe together with a few > > > > methods that are tightly coupled to it, but have the major > > > > pieces of functionality such as install() implemented by > > > > separate functions that operate *on* the class, rather than > > > > being inside it. > > > > I think this is sound advice. I'm still not sure what I'll come up with. > > One of the other reasons why an OOP model might be right for me is that of > caching. I currently load a lot of attributes regarding programs from > disk, and I do so multiple times, I could either pass those attributes > around, OR, using a class, I could store those attributes in the object > after loading them just once. You could also use a generator with a somekind of memoization/cache. > I have no experience with OOP except in the domain of GUIs (where it seems > inescapable, all major toolkits use OOP) I have some experience in GUIs with Python in a proprietary framework. I have a bias for OOP and Python in particular. I started exploring Scheme through Guile and other languages more or less. I am asking myself the question "what is the interest of functional programming or so called". Scheme doesn't enforce functional code or immutability. It's actually "more open" somewhat because of the macro system among other things. Outside any performance considerations or implementations details like GIL. Scheme and (all?) *LISP don't use the infix notation*. probably because you can work around it but IMO not fully. The infix notations allows to write things like: people.move_to(paris). It's easy to read, as «Subject Verb Complement»... Class based OOP is prefered because of that, in a lot of situations. IMO, if OOP won, it's because of readability, and in particular Class based OOP. JavaScript OOP is useless in asynchronous context, see http://repl.it/Rrf/2. Maybe you can work around this feature with JavaScript descriptors easly, I did not try that. so I'm not yet sure how this will turn out. > I skimmed through the code, but it's very superficial reading, like I installed pycharm to ask for help...: - CamelCase is usually for class names. That said, sometime variable holding classes are called my_object_class or my_object_factory - I think permissions.py would be easier to read with a class... or a function that initialize the dictionary as intented and just use dict methods onward. - To I read code, I have a systematic method I call gunshot/destructive/production rules/function inlining/develop (as the dual of factorize). I started with subuser.py, I got: http://dpaste.com/1797075/ def getSubuserCommands(): """ Returns a list of commands that may be called by the user. """ def isPathToSubuserCommand(path): directory, executableName = os.path.split(path) return executableName.startswith("subuser-") externalCommandPaths = queryPATH(isPathToSubuserCommand) externalCommands = [] subuserPrefixLength=len("subuser-") for externalCommandPath in externalCommandPaths: commandDir, executableName = os.path.split(externalCommandPath) commandName = executableName[subuserPrefixLength:] externalCommands.append(commandName) external_subuser_commands = list(set(externalCommands)) return list(set( os.listdir(paths.getSubuserCommandsDir())).difference(nonCommands)) + external_subuser_commands It's kind of easier to read. Gremlin is a DSL that allows to navigate a graph. That's exactly what happens here (and all the time<http://en.wikipedia.org/wiki/Transderivational_search> long now<http://en.wikipedia.org/wiki/Kundalini_syndrome#The_Physio-Kundalini_Syndrome_Index> ).wrapped_ <http://en.wikipedia.org/wiki/Net.art>in(tesseract<http://en.wikipedia.org/wiki/Tesseract_%28disambiguation%29>). I'd like to write the above as: >>> subuser.commands = (subuser.path.directories + subuser.user.path.directories).filter(is_command).distinct().memoize() I think it's possible in Ruby. I'm quite interested by the subject. Elm language (see reactconf<http://reactconf.com/>) and your graphical IDE<http://thobbs.cz/works/2013/graphical-elm/Intro.html>is very interesting, do you know about Domain Specific Modeling Forum <http://www.dsmforum.org/>? I started to put some thinking grouped together. Also I started proto-py to gather code ideas, but it's still offline. My plan is to mimick subuser to see, what happens. Can be of interest Scala @ Systems @ Twitter<https://news.ycombinator.com/item?id=7618969> Nice project by the way, with a better "see also" section that I could do :)
-- https://mail.python.org/mailman/listinfo/python-list