helper module

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

helper module

bader
hi
i have finished the exercise, i wanna know:  is it good to have a helper module
that contains helper methods such as : parse1, parse2, assemble.??

i just want to make the assembler module (manager) contain less code as possible for readability issues ..
what do you think ?
if this is not a good idea, which module is best for such methods.


thanks,
bader.
Reply | Threaded
Open this post in threaded view
|

Re: helper module

cadet1620
Administrator
It is generally a good idea to keep source files small and containing related routines. Generally I use one file for each object class. If that file gets too big I then split off related methods into their own files.

In my Hack Assembler, I have main(), pass1() and pass2() in the same source file because they are all fairly short functions.

If the Assembler had to handle multiple source files or all files in a directory I would have had separate main and assemble sources.  (My VM Translator and Jack Compiler are structured with a separate main source and translate/compile sources.)

--Mark

Reply | Threaded
Open this post in threaded view
|

Re: helper module

bader
nice, thank u.