maintainability

Angular directives - element or attribute?

人走茶凉 提交于 2019-12-17 18:10:59
问题 I'm part of a team with about 6 UI devs, of varying quality and next to no Angular experience. Many are contractors, with little experience with the code base. The app has a very fancy (complicated) UI. It supports IE8+ (soon hopefully IE9+). We're introducing Angular for a major extension to the app, and I've been asked to write guidelines on the use of Angular for the team. We'll use directives to create fancy UI elements, all prefixed with "ipwr" to avoid name clashes. I'm trying to decide

Angular directives - element or attribute?

天涯浪子 提交于 2019-12-17 18:08:47
问题 I'm part of a team with about 6 UI devs, of varying quality and next to no Angular experience. Many are contractors, with little experience with the code base. The app has a very fancy (complicated) UI. It supports IE8+ (soon hopefully IE9+). We're introducing Angular for a major extension to the app, and I've been asked to write guidelines on the use of Angular for the team. We'll use directives to create fancy UI elements, all prefixed with "ipwr" to avoid name clashes. I'm trying to decide

Adjust colors in vimrc or rather in the color scheme itself

天大地大妈咪最大 提交于 2019-12-13 06:20:17
问题 In my case I do use the solarized color scheme. Until now I used to override certain color properties in my vimrc. But the number of adjustments seems to grow over time. Especially I tend to adjust colors used for UI elements, e.g. line numbers, highlighted search, highlight groups, etc. Now I asked myself if it makes sense to maintain color settings in my vimrc at all or if I should rather fork the color scheme and merge my changes directly with the color scheme file? 回答1: Don't pollute

How can I access sibling packages in a maintainable and readable way?

假装没事ソ 提交于 2019-12-13 04:35:25
问题 I often end up in a situation where one package needs to use a sibling package. I want to clarify that I'm not asking about how Python allows you to import sibling packages, which has been asked many times. Instead, my question is about a best practice for writing maintainable code. Let's say we have a tools package, and the function tools.parse_name() depends on tools.split_name() . Initially, both might live in the same file where everything is easy: # tools/__init__.py from .name import

how to adhere to the Don't-Repeat-Yourself (DRY) principle when there will be too many if-then-else making the code unreadable?

无人久伴 提交于 2019-12-12 10:17:04
问题 I'd like to adhere to the Don't-Repeat-Yourself principle, but sometimes when I write PHP together with HTML and CSS, if I re-use the same code for different situations, my code soon will have so many if-then-else that the code is not easily maintainable. This may be a bigger issue if Smarty, the templating engine is used, because most code editor won't match up {if} {else} {/if} So the programmer needs to look for the matching tag visually, and is not easy when there are 3 or 4 levels of

Usefulness of Toggle functions

江枫思渺然 提交于 2019-12-10 20:02:55
问题 Is it better to write functions that explicitly do something (i.e. HideForm/ShowForm etc...) or is it better to write 'Toggle' type functions (i.e. ToggleVisibility)? I find Toggle type functions awkard because it's hard to track the state by reading the code. In what situations is a toggle type function useful? 回答1: I use it sometimes in JavasScript to handle buttons( checkbox like ) and visibility, but mostly I avoid it, because it makes a little harder to control the state of the think you

Speed Comparisons - Procedural vs. OO in interpreted languages

不打扰是莪最后的温柔 提交于 2019-12-10 00:48:18
问题 In interpreted programming languages, such as PHP and JavaScript, what are the repercussions of going with an Object Oriented approach over a Procedural approach? Specifically what I am looking for is a checklist of things to consider when creating a web application and choosing between Procedural and Object Oriented approaches, to optimize not only for speed, but maintainability as well. Cited research and test cases would be helpful as well if you know of any articles exploring this further

How to self-document a callback function that is called by template library class?

六眼飞鱼酱① 提交于 2019-12-09 07:57:14
问题 I have a function User::func() (callback) that would be called by a template class ( Library<T> ). In the first iteration of development, everyone know that func() serves only for that single purpose. A few months later, most members forget what func() is for. After some heavy refactoring, the func() is sometimes deleted by some coders. At first, I didn't think this is a problem at all. However, after I re-encountered this pattern several times, I think I need some counter-measure. Question

How to deal with code duplication in puppet modules?

帅比萌擦擦* 提交于 2019-12-08 03:43:46
问题 I have implemented two puppet modules to setup and configure two components - A & B. The directory structure of the modules folder looks like below: modules modulea manifests init.pp install.pp config.pp service.pp templates 1.properties.erb (This one is also needed by moduleb) 2.properties.erb (This one is also needed by moduleb) moduleb manifests init.pp install.pp config.pp service.pp templates 1.properties.erb (same as in modulea) 2.properties.erb (same as in modulea) 3.properties.erb 4

How to deal with code duplication in puppet modules?

一个人想着一个人 提交于 2019-12-06 22:26:57
I have implemented two puppet modules to setup and configure two components - A & B. The directory structure of the modules folder looks like below: modules modulea manifests init.pp install.pp config.pp service.pp templates 1.properties.erb (This one is also needed by moduleb) 2.properties.erb (This one is also needed by moduleb) moduleb manifests init.pp install.pp config.pp service.pp templates 1.properties.erb (same as in modulea) 2.properties.erb (same as in modulea) 3.properties.erb 4.properties.erb 5.properties.erb The code in install.pp and service.pp is identical in both the modules.