The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. September 18, 2019, 11:12:05 AM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: Programming and Wordwrap  (Read 2688 times)
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5627


Back in my day we had 9 planets


View Profile
« on: May 14, 2009, 11:27:33 AM »

Seriously?
Who the hell can program with wordwrap turned on?
It must be a lot of people though, because EVERY programming IDE i try out, has it turned on my default. That tells me, most folks do.

HOW THE FUCK CAN YOU SEE WHAT YOU ARE DOING?Huh?

AAARARRGGGGG!!!!

Code should have structure, both literally and conceptually. Throwing in these wordwraps just makes the baby jesus cry.
Logged

I could eat a bowl of Alphabet Soup and shit a better argument than that.
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #1 on: May 14, 2009, 11:37:27 AM »

And cry he does. I am RIGHT WITH YOU.

It's also responsible for mass kitten deaths and puppies getting run over.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5627


Back in my day we had 9 planets


View Profile
« Reply #2 on: May 14, 2009, 12:13:51 PM »

Every time i reload my system, I have to go on the "grand hunt for wordwrap settings".

I really should keep notes or something for this.
Logged

I could eat a bowl of Alphabet Soup and shit a better argument than that.
rcjordan
Lifer
*****
Offline Offline

Posts: 882


View Profile
« Reply #3 on: May 14, 2009, 01:01:13 PM »

Good handling of indents, easy of managing wordwrap, and minimalist ui is one of the reasons I stick with ultraedit v7. I bought ue 12 or somesuch and went back to 7 --couldn't stand the additional clutter.
Logged
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #4 on: May 14, 2009, 01:16:52 PM »

Excellent point and I agree there also RC - who the heck ever thought that massive new features for an editor is what is needed every year or so? I understand the model, but it's a PIA.

With BBEdit, for example, they went from 8 -> 9 and changed up how projects work, display windows work, you name it. The upgrades are marginally useful, if at all, but in the process they messed up loading/saving from FTP - even just connecting to FTP is now buggy. Or how about that it no longer opens up symlinked files? ARGGH! (Note: the author of the app is trying to work with me to ascertain why it won't - at least he's responsive)

And the time spent by the developers on macro languages is highlarious. I don't know about you, but in the time it takes to create and perfect a keyboard macro, I could've typed the desired code a dozen times. And then remembering that I made CTRL+ALT+F+O+touch elbow to monitor+raise left eyebrow == type out the basics of a switch statement is way beyond my ability to remember.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
nop_90
Global Moderator
Lifer
*****
Offline Offline

Posts: 2203


View Profile
« Reply #5 on: May 14, 2009, 03:06:35 PM »

I used UE way back when, when i still used windoze.
For python I use SPE, which is basically a standard editor with no bells or whistles that basically does nothing more then syntax highlighting and offers showing of "whitespace" which is very important for python

For actual running/testing of program I use ipython which is a fancy python shell, it also allows you to run linux command in it and pipe the results into the shell.
So you can test shit, or when the program is running, you can check on variables etc. Very handy for debugging, testing ideas
Fuking IDE is a waste of time. Even with GUI, you are better off to design the GUI by hand, use sizers for layout etc.

As for wordwrap.
Honestly I never had to look for it. If you lines of code are larger then 80 chars you are doing something wrong.

As I said before (I must sound like a broken record)
Tons of books on how to use some stupid API, very few on how to lay out code properly.
Read some article that had a few basic rules.
I think it was like this :
1) No line of code should be more then 80 chars
2) No function should be more then 20-40 lines
3) Origionally code for functionality, then always optimize after you know the function works
4) If you see duplicated code that is repeated in your code repeatedly, then you should replace it with a function
5) Your code should look "nice", as in it should be layed out in a proper format, always be consistent with Naming etc. 75% of your time is spent looking for some sort of bug usually. If the above rules are followed, then it makes it 100 times easier to locate bug

Also I am under the impression that in a "professional" setting. Programmer productivity is measured by lines of code.
So some programmer who hammers out 500 lines of garbage, while another who does the same thing in 100 lines, stupid big boss thinks 500 line coder is 5x better Smiley

So usually I make a class/program/function.
Then often I will take a look at it.
I will see I can lay it out differently, therefore cut the size in 1/2. 1/2 size of code = 1/2 amount of bugs Smiley

Also even if making some throw away program.
Maybe it nice.
My code is like a library. 95% of it is like useless now. But I often find myself looking into it 1-2 years later to see how I solved a problem then.
If it look like garbage, then it is useless.

Anyway stop wasting time with stupid IDE. You never use 95% of the features, and they are slow buggy and bloated.
Get a "good" editor. Good again is what ever u prefer.
Logged
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5627


Back in my day we had 9 planets


View Profile
« Reply #6 on: May 14, 2009, 04:19:31 PM »

lol Nop.

I use 2 Editors/IDEs. UE and PHPdesigner.
Both for reasons of organization and simplicity of access to multiple code locations.

There are lots of simpler solutions out there that are basically notepad+ (which i used to use), but they never quite made things simpler.

I agree sort of with the list you give.
Long lines are not good, however... Visually, manual wrapping of lines is almost as confusing as automatic wrapping.
I HATE php with the _ at the end of line. And to do a $var .= 'moreshithere'; is adding cycles.
Those uberlong REST urls will NEVER be wrapped in my code, purely as a matter of construct.
So "general rule" of 80 is probably good.

function 20-40 lines.... LOL

100% agree with code for functionality first, then optimize. Thats Agile and thats me. I code very small chunks of functionality, then refine and refine. Then move on, then when I have a whole process/thought/section/module done, I refine at the gross level.

duplicate code as functions. lol DUH.

code should look nice. 100% agree.


You are correct about the professional setting. Most programmers are judges on number of lines. I killed that judgment really quick in a prior job. "how come you only produced X lines of code? Joe did 100x that? Are you not working?"
Next review cycle, I submitted my code... 4000x what joe did... I ran my code through a script to add double lines, concat strings as single words, instead of full sentences, broke all math up into things like +=, added random line wrap markers and wrapped the line, put in a shitload of comments, that copied the exact line of code but put my name at the end, etc etc.

I code for compact, easy to read, and hopefully easy to understand goal. I do not comment much, because my code IS my comment. I use vars that are descriptive, constructs that are easy to follow (when possible) and I dont use ANY shortcut codes like ? : in PHP for example. I have on the otherhand gotten ALOT of unprofessional, crappy ass code, with var names like $eatpussy and $fatbitchbosswantedthiscounter... I shit you not.

Logged

I could eat a bowl of Alphabet Soup and shit a better argument than that.
nop_90
Global Moderator
Lifer
*****
Offline Offline

Posts: 2203


View Profile
« Reply #7 on: May 14, 2009, 07:13:20 PM »

I too use different editors for different things to some degree
@NB sorry if i sounded preachy Cheesy
Like all rules they are not set in stone, occasionally they can be broken.

Just i worked while I was in school tutoring C/C++ granted it was 10 years ago but same shit still applies.
But simple shit like in C/C++ the missing }
compilers in those days where slower, so every time you compile and it catches a missing } you waste 1 minute, a consistent indenting style fixes that problem

If you need long strings, PHP like python and perl offers multiline strings
stuff all you big strings in a seperate file, then just access them by variables. Also makes sense if u are going to go multilanguage

you also have to know the little minor details of the language u are working with
concatation/joining of strings

python
this is a lot slower
lines = ["fred","tom","joe"]
result = ""
for line in lines :
    result+=line

as opposed to
result = "".join(lines)

1st instance every time in the loop result allocates a new string
while in the second instance length of the new string is calculated from the array, then moved in 1 go into the result
for 100K or more of text differences can be astronomical

instead of a case statement (python does not have case)
use a lookup table
as in
funct = {"a" :  functa,"b" : functb}
then u can do something like
funct[option](arg)

another twist i use on the lookup table is make the keys regexps (granted that is not as fast as a lookup, but more flexable, and probably just as quick as a case, or series of if/elseif statements, and a hell of a lot more easy to read)
then walk thru the lookup table till you get a match then call the function

Anyway this is just stuff that worked for me.
I wish someone had told me this shit years ago.
Take it or leave it.
Logged
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5627


Back in my day we had 9 planets


View Profile
« Reply #8 on: May 14, 2009, 07:27:48 PM »

i know im used to the way you and V answer lol Tongue

I am a very verbose coder, at probably the cost of some speed. But I make up for it with actually tuning my code.
BH has been freakin AWESOME for motivating me to squeeze cycles out.

Actually if I have a horrific string concat I use HEREDOC in php.

But i guess I was more thinking along the lines of actual code. long equations, massive indents. etc.
Off the top of my head I cant think of anything better than some mega loops have done. Yes I can functionize each loop, but thats another call, burning another cycle, and it disconnects the logic for a reader of the code.

Though I do think I will try to adopt a char limit... see how it goes, because it does of course make sense.
Logged

I could eat a bowl of Alphabet Soup and shit a better argument than that.
deregular
Expert
****
Offline Offline

Posts: 172


View Profile
« Reply #9 on: May 15, 2009, 01:41:21 AM »

At work. I use eclipse, mainly for the svn addons and such, being that we have 6 or 7 people working on the same stuff.
At the home office?  Textpad FTW! Has everything I need.
Logged
vsloathe
vim ftw!
Global Moderator
Lifer
*****
Offline Offline

Posts: 1669



View Profile
« Reply #10 on: May 15, 2009, 06:27:52 AM »

I have no clue whether or not I have wordwrap on.

Every one of the displays on which I program is at *least* 1920 pixels across, so I rarely experience lines wrapping. If they do, I separate them onto multiple lines and concatenate.
Logged

hai
rcjordan
Lifer
*****
Offline Offline

Posts: 882


View Profile
« Reply #11 on: May 15, 2009, 10:00:31 AM »

>I am a very verbose coder, at probably the cost of some speed.

I was, too. For what little I code any more, I'm too out of shape to do elegant/compact code.  For maintenance and portability, I've found that deciphering the logic I used 3 years ago is simply too hard to do.  I'll sacrifice speed for future readability in a heartbeat. 
Logged
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!