refactoring

Conditional Replace with Visual Studio

拟墨画扇 提交于 2021-02-16 17:58:09
问题 In Visual Studio, I need to substitute a word with another, preserving the first character case. For example I need to subsitute "Bob" with "James" and "bob" with "james" at once, and I must avoid to replace partial matches like "ob" with "james" or "James". This can be done e.g. in Notepad++ with find:"((b)|(B))ob", replace: "(?2j:?3J)ames"; unfortunately this does not work in Visual Studio (I'm using 2015). Is it possible to do this in Visual Studio? Thanks. 回答1: It is not possible with

Swift - Refactoring code. Closure and inout?

大兔子大兔子 提交于 2021-02-11 14:44:10
问题 I have a class thats used to help manage the process of users sending emails with MFMailComposeViewControllerDelegate. The code is rather long, and I'm using it inside of almost all of my ViewControllers. And I figure I should be able to add it as an extension to UIVIewController. And so I'm currently trying to do that, but at a loss of how to do it correctly. Working Code: Struct: struct Feedback { let recipients = [R.App.Contact.email] // [String] let subject: String let body: String let

How to load a git branch from another R package

烈酒焚心 提交于 2021-02-11 14:02:30
问题 In R, how I load one package's git branch from another package? There are two packages, call them producer and consumer1 . I am refactoring my code by moving a bunch of function definitions and tests from producer to consumer1 . I'm creating git branches, rfctrProd and rfctrCons1 for producer and consumer1 . In rfctrCons1 , I need a statement doing something like #` @import producer, gitBranch = rfctrProd Also, I'll to do similarly with other packages which import producer , to make sure I

Premature refactoring? [closed]

瘦欲@ 提交于 2021-02-06 08:42:07
问题 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 2 years ago . Improve this question We have all heard of premature optimization, but what do you think about premature refactoring? Is there any such thing in your opinion? Here is what I am getting at. First off, reading Martin Fowler's seminal work "Refactoring" quite literally changed

Premature refactoring? [closed]

旧城冷巷雨未停 提交于 2021-02-06 08:41:52
问题 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 2 years ago . Improve this question We have all heard of premature optimization, but what do you think about premature refactoring? Is there any such thing in your opinion? Here is what I am getting at. First off, reading Martin Fowler's seminal work "Refactoring" quite literally changed

Roman to integer refactored

China☆狼群 提交于 2021-01-28 02:02:14
问题 I'm writing a method roman_to_integer(roman_string) , which translates a roman numeral into its integer: 'IV' to 4, 'XVI' to 16, etc. ROMAN_TO_INT = { "I" => 1, "IV" => 4, "V" => 5, "IX" => 9, "X" => 10, "XL" => 40, "L" => 50, "XC" => 90, "C" => 100, "CD" => 400, "D" => 500, "CM" => 900, "M" => 1000 } def roman_to_integer(roman_string) # TODO: translate roman string to integer number = 0 str = roman_string.dup until str.size.zero? last_two_characters = str.slice(-2, 2) if ROMAN_TO_INT.key?

Eclipse refactoring fails -> Keeps throwing exceptions!

我只是一个虾纸丫 提交于 2021-01-27 16:31:11
问题 I'm using Eclipse Helios and for every refactoring that spans multiple files it plainly fails! Nothing happens. On examining the logs here's the error that I see: !ENTRY org.eclipse.ltk.ui.refactoring 4 10000 2011-03-13 14:15:31.842 !MESSAGE Internal Error !STACK 0 java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:421) at org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.run(RefactoringWizardDialog2.java:330) at org

using non-smart pointers in modern C++

Deadly 提交于 2021-01-21 04:31:26
问题 Short Version: Is there any acceptable reason for using non-smart pointers in modern C++? Long Version: we have a huge product that contains lot's of old C++ code and now we are trying to refactor it to the modern C++ era. Along with all the old fashioned code, there is huge amount of pointers passing around (mostly with SAL annotations to provide some sense of security) and I was wondering if we should change all of them to smart pointers or maybe leave some of them as is? Trying to convert

using non-smart pointers in modern C++

时光怂恿深爱的人放手 提交于 2021-01-21 04:31:07
问题 Short Version: Is there any acceptable reason for using non-smart pointers in modern C++? Long Version: we have a huge product that contains lot's of old C++ code and now we are trying to refactor it to the modern C++ era. Along with all the old fashioned code, there is huge amount of pointers passing around (mostly with SAL annotations to provide some sense of security) and I was wondering if we should change all of them to smart pointers or maybe leave some of them as is? Trying to convert

重构

霸气de小男生 提交于 2021-01-04 08:43:27
最近在看<重构>这本书,看着看着就迷上了重构.所以打算专门搞一个分类记录一些关于重构的那些事 "重构"是一小步一小步慢慢前进的过程,下面列出书上所写的重构列表,在以后的日子里,我会对应列表,描述每一种重构手法,重构是需要好鼻子的,闻出坏味道,还需要一套规范有效的方式来安全的修改代码. Add Parameter (添加参数) Change Bidirectional Association to Unidirectional (将双向关联改为单向) Change Reference to Value (将引用对象改为值对象) Change Unidirectional Association to Bidirectional (将单向关联改为双向) Change Value to Reference (将值对象改为引用对象) Collapse Hierarchy (合并继承层次) Collapse Conditional Expression (合并条件语句) Consolidate Duplicate Conditional Fragments (合并重复的条件片段) Convert Procedural Design to Objects (将过程式设计转换为面向对象) Decompose Conditional (分解条件语句) Duplicate Observed Date