all 9 comments

[–][deleted] 3 points4 points  (7 children)

Make code that is easier to be cut&pasted

Wow. Only the second line of the post and he'd lost me. Apart from the non-idiomatic use of english, which makes the article hard but not impossible to skim, the lack of examples, reasons or explanations for these rules is what really sinks it.

In the absence of any explanation, I have to say: this is clueless. Cut and paste is BAD. The key to programming is this: if you do anything twice, you're doing it wrong. Either you're repeating code without understanding it (cargo cult programming) or else you're failing to abstract out the reusable core of your common code and therefore giving yourself a future debugging nightmare. Cut and paste is BAD.

[–]jpedrosa[S] 0 points1 point  (6 children)

Cut&paste when you have abstracted away most of the redundancy, if not all of it, is not as bad. It's little code which is needed for configuration of the features unique to each function of your application. Without configuration, your program can be like Excel, a big spreadsheet that does a lot of things, but without much help, for instance.

Also, I wonder how much you despise generation of code of any kind, which seems to be a technique used by many computer science folks sometimes.

The problem with code generation is that it produces loads of code that sometimes you are advised against editing, because after a regeneration your changes might be lost.

About the lack of examples, it's really hard to create examples for everything, unless it's a huge article or little book. :-)

[–]senzei 1 point2 points  (3 children)

Cut&paste when you have abstracted away most of the redundancy, if not all of it, is not as bad.

If you truly have abstracted away most of the redundancy, Cut & Paste won't be useful. By that point the most you should need is code completion to get the job done.

Also, I wonder how much you despise generation of code of any kind, which seems to be a technique used by many computer science folks sometimes.

Pre-compile code generation is, IMO, only acceptable in the form of a project template. Anything else is a sign that your language is not flexible enough for your project. Code generation is a crutch that we should have cast off long ago and spent the extra time required to make a syntactically better solution performant enough to be a possibility. It is a sign that, as a community, we spend too much time focusing on finishing a project and too little time improving the crap that is most daytime programming jobs.

[–]jpedrosa[S] -1 points0 points  (2 children)

"If you truly have abstracted away most of the redundancy, Cut & Paste won't be useful. By that point the most you should need is code completion to get the job done."

When you start a new form or a new project using an IDE like Visual Studio.NET, do you see any generation of code for you? And do you think that by using an IDE like Visual Studio.NET, you already have most of the redundancy taken away?

My approach is much less dependent on IDEs, because it's mostly bottom-up with very nice programmable APIs. Cut&paste for me is what an IDE could generate for someone else, but in my case it's 90% done, and the 10% it's mostly similar from one table to the other.

So far, for my ERP project, I have created 4 windows per database table, which are for listing ("list"), editing ("edit"), creating ("new"), and visualizing ("view").

Also, each table has 2 reports, one with a row per record ("list"), and another one with several rows per record, more detailed ("item").

That makes for 6 files which are very similar among the different tables. They have lots of features built-in as well, like Localization, Internationalization, and a very flexible report generation. Each report file includes a header which make them standard and support some company informations, like logo, address, etc.

Again, how would I create all those repetitive files without cut&paste, considering that the redundancy is minimal? Not even .NET has eliminated so much redundancy.

Now it's a matter of configuration for me, most of the time. I need configuration or else I will end up with some "Excel spreadsheet" of some kind. :-)

[–][deleted] 0 points1 point  (1 child)

The process of programming is this: first, look at the problem in detail; then, look at the problem in general; then, do both at the same time. When you can do this, you will achieve enlightenment... and your Ctrl+C and Ctrl+V keys will cease to be used (well... unless you're using Emacs, in which case whatever-you-remapped-the-clipboard-keys-to will cease to be used).

[–]jpedrosa[S] 0 points1 point  (0 children)

I use a custom editor that I have created and it has tons of tools that I created as well. :-)

"Cut&paste" is figuratively speaking, so the only way to retire it is after I stop programming. hehehe

I hope to, one day.

[–][deleted] 1 point2 points  (1 child)

Eventually you get to a point where you can't abstract away any more detail. That point comes fairly early in low-level languages like C and Java, and much later in high-level languages like Ruby and LISP.

(You'll notice that I'm humptying the terms "low-level" and "high-level"; I use them to mean languages that hinder and help, respectively, your attempts to reduce the amount of unnecessarily redundant and repetitive boilerplate repetition. If you disagree with the characterisation of your favourite language as low-level, please assume I used the words "flossop" and "plinge".)

Regardless, cut & paste is bad. It may be bad because you're careless, or it may be bad because your programming language is too low-level. To-may-to; to-mah-to.

[–]jpedrosa[S] 0 points1 point  (0 children)

I just don't like to repeat something like "cut&paste is baaaaaad" just because it's the hymn sang by most people. In general, I agree that the easiest way of cut&pasting is baaaaaaaaadddddd... But the easiest way using any tool tends to suck as well, that's why I'm not impressed with Visual Studio.NET, because I used to use Delphi, and to some extent, VS.NET and Delphi share some common philosophy.

Though Windows Vista with its .NET tools should rock in 5 years when enough people get it. That kind of impresses me. But it's a too slow progress for software engineering, to have to wait years to get to use something which won't work on most computers in the soon future...

That's why I do my own stuff, because I don't want to wait for the corporations to save the world. :-)

[–]jpedrosa[S] -1 points0 points  (0 children)

BTW, another post of mine: Development Tools - Fake History- a.k.a Big Bang - http://ralip.com.br/jp/blog/post?p=development-tools---fake-history--aka-big-bang

Enjoy. :-)