anti-patterns

What to do about a 11000 lines C++ source file?

主宰稳场 提交于 2019-12-29 10:06:01
问题 So we have this huge (is 11000 lines huge?) mainmodule.cpp source file in our project and every time I have to touch it I cringe. As this file is so central and large, it keeps accumulating more and more code and I can't think of a good way to make it actually start to shrink. The file is used and actively changed in several (> 10) maintenance versions of our product and so it is really hard to refactor it. If I were to "simply" split it up, say for a start, into 3 files, then merging back

What to do about a 11000 lines C++ source file?

佐手、 提交于 2019-12-29 10:05:39
问题 So we have this huge (is 11000 lines huge?) mainmodule.cpp source file in our project and every time I have to touch it I cringe. As this file is so central and large, it keeps accumulating more and more code and I can't think of a good way to make it actually start to shrink. The file is used and actively changed in several (> 10) maintenance versions of our product and so it is really hard to refactor it. If I were to "simply" split it up, say for a start, into 3 files, then merging back

the significance of java RMI please? [closed]

不羁岁月 提交于 2019-12-29 05:46:49
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . Why do people use RMI, or when should I use RMI? I read those tutorials about RMI on oracle's website.But it doesn't provides enough

When is it ok to change object state (for instance initialization) on property getter access?

独自空忆成欢 提交于 2019-12-24 07:01:14
问题 (except for proxy setup!) I spent some time writing a question here regarding a better pattern for a problem I had - of a class that performed some conditional initialization on almost every property getter, since the initialization in the base class relied on data from the inheriting classes that wasn't available on construction. While writing the question I came to the conclusion it would be better practice to initialize on inheritor construction. This would require every inheriting class

Are try/catch for every single statement that throws an exception considered an anti-pattern?

随声附和 提交于 2019-12-23 07:42:04
问题 I am currently reviewing a colleagues Java code, and I see a lot of cases where every single statement that may throw an exception being encapsulated in its own try/catch. Where the catch block all perform the same operation (which operation is not relevant for my question). To me this seems like a code smell, and I do remember reading about it being a common anti-pattern. However I cannot find any references on this. So are try/catch for every single statement that throws and exception

Is there ever justification for the “pseudo-typedef antipattern”?

女生的网名这么多〃 提交于 2019-12-23 07:22:44
问题 I have a relatively complicated generic type (say Map<Long,Map<Integer,String>> ) which I use internally in a class. (There is no external visibility; it's just an implementation detail.) I would like to hide this in a typedef, but Java has no such facility. Yesterday I rediscovered the following idiom and was disappointed to learn that it's considered an anti-pattern . class MyClass { /* "Pseudo typedef" */ private static class FooBarMap extends HashMap<Long,Map<Integer,String>> { };

jQuery (anti-)pattern: building selectors with string manipulation

不羁岁月 提交于 2019-12-22 08:15:40
问题 Too often I find myself building selectors with string manipulation (split, search, replace, concat, +, join). Good or bad? 回答1: What's wrong with that? What are the alternatives — just hardcoding them as single strings? But you may use conventions on your site for how the layout is organized. If you just define the selector components in one place, and use it to build a selector, sounds like this would be less hassle than going through all the code and doing search-replace everywhere it

jQuery (anti-)pattern: building selectors with string manipulation

房东的猫 提交于 2019-12-22 08:15:40
问题 Too often I find myself building selectors with string manipulation (split, search, replace, concat, +, join). Good or bad? 回答1: What's wrong with that? What are the alternatives — just hardcoding them as single strings? But you may use conventions on your site for how the layout is organized. If you just define the selector components in one place, and use it to build a selector, sounds like this would be less hassle than going through all the code and doing search-replace everywhere it

If the constant interface anti-pattern is such a crime, why does Swing do it?

蓝咒 提交于 2019-12-22 05:03:23
问题 I was making a swing application, and realized I had a handful of classes that needed access to the same set of constants. I couldnt bring myself to declare one the primary holder of them and place them all in there and have the others reference it; I thought, hey, I'll just have them all inherit from some common place, but Java doesnt do multiple inheritence, BUT I can put infinity interfaces on things. So the idea came to me to dump them all into an interface (it's true, it just naturally

Why is a generic repository considered an anti-pattern? [closed]

落爺英雄遲暮 提交于 2019-12-22 03:16:19
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 4 years ago . it seems to me that a lot of specialised repository classes share similar characteristics, and it would make sense to have these classes implement an interface that outlines these characteristics, creating a generic repository to illustrate my point, say we have this code