|
\renewcommand{\raggedright}{\leftskip=0pt \rightskip=0pt plus 0cm}\raggedrightModern software systems are usually running at various external environments, and are required to automatically maintain their behaviors to adapt the changed surrounding environments. To deal with the problem, Granule oriented programming was proposed and GranuleJ built top of Java was designed and implemented by language extensions. However, such static language infrastructure implementation often has an expensive cost and a petty high performance overhead in granule substitution, where granules as compositional code units are to be composed at runtime. In this paper, we propose an extension language called GranuleJS based on dynamic language JavaScript by fully leveraging dynamic nature of JavaScript's behaviors. We design granule tree for granule substation in two optimized ways, lazy chain approach and marking approach respectively. Moreover, since the dynamic feature of granule tree can cause the dissatisfaction of the invariance of context variable string path, we designed a fast similar granule search algorithm. The performance evaluation has shown that GranuleJS have fairly low performance overhead. |
|
Keywords:Programming language implementation; Granule-oriented programming;Javascript; JavaScript interpreter; granule, granule tree, similar similar substitution |
|