fuzzylizard Posted November 6, 2003 Report Share Posted November 6, 2003 I keep seeing this term more and more and always in relation to java or C++ code. What is it and why do I want to do it? Quote Link to comment Share on other sites More sharing options...
tyme Posted November 6, 2003 Report Share Posted November 6, 2003 "Refactoring is a technique to restructure code in a disciplined way." http://www.refactoring.com/ google rules! Quote Link to comment Share on other sites More sharing options...
fuzzylizard Posted November 6, 2003 Author Report Share Posted November 6, 2003 And that means what exactly? (looking for newbie friendly definition with examples here) Quote Link to comment Share on other sites More sharing options...
tyme Posted November 6, 2003 Report Share Posted November 6, 2003 it's a way of making code nice and easy to read and understand (or to the best that it can be since it is code ;) ). exactly HOW to go about doing that, i don't know... Quote Link to comment Share on other sites More sharing options...
Gowator Posted November 6, 2003 Report Share Posted November 6, 2003 hehe .... Especially if its java.... its not the most readable language at the best of times... AHHH ... Perl. Course Perl looks ugly to the machine but its relatively simple to make the source human readable, at least compared to java or c++ .... I guess thats just the nature of the beasts.. Quote Link to comment Share on other sites More sharing options...
johnnyv Posted November 6, 2003 Report Share Posted November 6, 2003 You think Perl looks human readable!!!!!! :P PHP or Python are human readable sometimes but Perl! j/k :) Quote Link to comment Share on other sites More sharing options...
ramfree17 Posted November 7, 2003 Report Share Posted November 7, 2003 "Refactoring is a technique to restructure code in a disciplined way." http://www.refactoring.com/ google rules! my simple understanding of refactoring is revamping of code for optimization and removal of code nuisances (anti-pattern, code smells, bugs, etc.) in layman's terms, take a code and make it better. :) ciao! Quote Link to comment Share on other sites More sharing options...
roland Posted November 7, 2003 Report Share Posted November 7, 2003 my simple understanding of refactoring is revamping of code for optimization and removal of code nuisances (anti-pattern, code smells, bugs, etc.) I didn't know refactoring. But highly optimized code is generally difficult to read. What's nice code ? Well there is a lot of opinion about what is nice code and how to make it easy to read and maintain. Here is some rules: - names are important, Edit-Search is a important programmer's tool, - make global scope names (global variables, global functions, macros) very explicite, don't hesitate to make them long to write. for example if you declare a globale variable with the name "n" you may have trouble when the program get bigger, - minimum use of global definitions, - if you have to use a global value, better create a function that just return it, - maximum use of local variables (reentrant), - a function must not be too long: one page, two pages max, - adopt a rule for names: example me: macro names = all upper case: _AUTO_BYTESIZE, types start with upper case: AutoPort, variables start wit lower case: comBuff, - one variable for one use. for example if you declare i for an iteration, better not reuse it in the function: declare int i,j,k; - one module for each task, - avoid dependencies between modules. define a little API for comunication between modules so that you can change a module without having to change others, - try to optimize using the right algorithm. Don't try to optimize on the implementation. modern compilers take care of that quite well for you, - optimize when it's necessary. most of te task don't need speed, many other things but: 1- comment your code, 2- comment your code, 3- comment your code. me, I generally start to create the header, declare the functions, comment them before any real coding. That way you made the specs and a good part of the doc. hope this help roland Quote Link to comment Share on other sites More sharing options...
phunni Posted November 7, 2003 Report Share Posted November 7, 2003 "Refactoring is a technique to restructure code in a disciplined way." http://www.refactoring.com/ google rules! my simple understanding of refactoring is revamping of code for optimization and removal of code nuisances (anti-pattern, code smells, bugs, etc.) in layman's terms, take a code and make it better. :) ciao! What on earth is a code smell? Quote Link to comment Share on other sites More sharing options...
fuzzylizard Posted November 7, 2003 Author Report Share Posted November 7, 2003 I think it is what happens when you leave it in the fridge too long. Quote Link to comment Share on other sites More sharing options...
ramfree17 Posted November 7, 2003 Report Share Posted November 7, 2003 hehehe. code smell is an anti-pattern, a fancy word to say'bad programming practices'. ciao! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.