vForums Support :: Programming & Coding :: Programming Discussion :: Programming Style - View Topic
| |
| Dreg[Bot] Moderator
Broken Posts: 415 Status: Offline Gender: Male Age: 37 Joined:
Additional Groups: Coding Team
pmYesh im sneaky! | Programming Style (13th Jan 08 at 10:49am UTC) | | Whats your programming style, is it similar to anyone else ?
Do you space codes out?
If you do, do you use tabs or just spaces?
If you use Javascript, do you prefer DOM or innerHTML?
What from experience has taught you when each would be better over the other?
Do you worry about speed more or browser compatibility ?
If speed then how do you test?
If compatibility what browsers do you test in ?
If you use PHP do you use classes ?
If not whats your alternatives ?
Are their browser compatibility problems ?
What from your experience makes some PHP applications lag ?
What about SQL, do you use it or flat files?
What situations do you think SQL DB is better then flat files? | |
Now obsession rules my mind This commotion makes me blind Searching out who ever runs Or has stolen away my life
But i've already said
Don't ever back down Don't ever turn around My end has come So now I come for you.... |
| Michael Moderator
Recoding the future Posts: 4,043 Status: Offline Gender: Male Location: UK Joined:
Additional Groups: Coding Team
pmvForum | Re: Programming Style (13th Jan 08 at 12:03pm UTC) | | 1) I have started to space codes out, and use spaces (when working straight into the headers/footers) or Tabs when in notepad.
2) innerHTML is easier
3)browser compatibility and speed are both equal, though I will sacrifice 1ms for full browser compatibility.
4)FF, Opera, IE
5)Used to use flat files, I now use SQL for everything, probably not best, but it's more reliable than a flat file. | |
| Ross Administrator
Posts: 3,709 Status: Offline Gender: Male Age: 8 1⁄1 Joined:
Additional Groups: Support Team
pmwwwgtalkvForum | Re: Programming Style (13th Jan 08 at 12:15pm UTC) | | 3, I tend to space most things out with Tabs even though that can get a bit messy when outputting.
9, No I'm not a classes person. Although I'm thinking of writting a class for the big update as that's one instance where it'll probably be easier.
10, I tend to use a lot of includes and functions rather than classes.
11, Textboxes were a pain with incompatibilities since some browsers use \r\n whereas others just use \n.
12, Lots of queries and complex lookups. But I find most of the lag tends to be caused by the browser outputting the results of these queries.
13, It can depend on the size of the application and the limitations of the server. There's one client who I've built a couple of sites for but the hosting company they insist on using doesn't support MySql so I've had to write them with flat files. But for most big sites, I'd definately recommend either SQL or a mix of SQL with Flat files. | |
|
| (¯`•Stormraven•._) Junior Member
CodersHangout.co.uk Posts: 81 Status: Offline Gender: Male Location: $_home Age: 35 Joined:
pmwww | Re: Programming Style (13th Jan 08 at 5:44pm UTC) | | Do you space codes out? Nope I dont space them out, as long as it works thats the main thing.
Do you worry about speed more or browser compatibility? i worry about both
If speed then how do you test? just re-load
If compatibility what browsers do you test in? FF, IE and Opera
Being as I can only code in JS I can only answer a certain amount of them
I'm learning PHP now, so... well its not going too well but im trying my best, one day i may be as good as ross | |
Design and Programming Forums |
| Ryan New Member
Posts: 37 Status: Offline Joined:
pm | Re: Programming Style (13th Jan 08 at 5:51pm UTC) | | I try to make comments as much as possible, but I usually forget, or get lazy. I really need to work on that.
I tab my coding, but I don't usually put spaces between lines, unless I am separating something special. | |
Sign up and refer five people to get a free .info |
| Dylan Junior Member
Posts: 136 Status: Offline Gender: Male Joined:
pmwwwmsnaimxfire | Re: Programming Style (13th Jan 08 at 8:08pm UTC) | | If you use PHP do you use classes ? - I don't use classes never really looked into them so I don't know much about them
Are their browser compatibility problems ? None that i've come across that directly relate to php. I don't think there could be because php is parsed by the server.That being said i've come across counltess php errors when either recompiling php apache, updating php, switching servers.
What from your experience makes some PHP applications lag ? Mysql queries, I believe i'm doing some of my queries pretty slow but the application I'm working on I'm mainly trying to get it to a working state then get it released but my first major update of it will be redoing all the quries in a more efficient way.
What about SQL, do you use it or flat files? SQL, easier to use and alot more organized and reliable.
What situations do you think SQL DB is better then flat files? I've never used flat files. I may in the future so I understand how they work but I always prefer a sql database over flatfiles any day of the week. | |
|
| Marc vChat Developer
I <3 Rossy
Posts: 3,388 Status: Offline Gender: Male Location: Ontario, Canada Age: 32 Joined:
Additional Groups: Coding Team
pmwww | Re: Programming Style (13th Jan 08 at 11:46pm UTC) | | Do you space codes out? Before, I didn't; but since I've been getting more into programming in VB & C++, spacing helps out quite a bit; so I do now. However, if it's a really short code, I may leave it out based on how much time I have, and how willing I am to do it.
If you do, do you use tabs or just spaces? Just spaces; I don't code in Notepad or whatever; I do it straight from the file manager of my site/headers & footers.
If you use Javascript, do you prefer DOM or innerHTML? Depends on the situation. If copying something with more than one enclosure inside of it, or just a relatively large thing; I'll use DOM. Otherwise, innerHTML works fine.
What from experience has taught you when each would be better over the other? Read above.
Do you worry about speed more or browser compatibility ? Both.
If speed then how do you test? Grab a timestamp from the start of the code, then from the end. Subtract the two, and see how long it takes.
If compatibility what browsers do you test in ? IE, FF, Opera
If you use PHP do you use classes ? Not often; I find them a tad pointless, besides for organization.
If not whats your alternatives ? Functions, I guess.
Are their browser compatibility problems ? With what? o.O
What from your experience makes some PHP applications lag ? Bad coding.
What about SQL, do you use it or flat files? MySQL > flatfiles. Although MySQL does eventually save back to flatfiles, it's much more organized, stable, & secure.
What situations do you think SQL DB is better then flat files? Most. | |
rroll.to— Shorten a link, rickroll your friends. |
| Reverse Blade Full Member
Posts: 152 Status: Offline Gender: Male Joined:
pm | Re: Programming Style (14th Jan 08 at 2:36am UTC) | | Lately I've been trying to change my style of doing things but mostly I space things out, not tab, and I use innerHTML mostly but DOM when I need to Speed and being able to use it in all browsers are equal even though I hate making codes work in all browsers, the browsers need to have some kind of big meeting and make everything work | |
Reverse Arts, Comming soon! |
| Marc vChat Developer
I <3 Rossy
Posts: 3,388 Status: Offline Gender: Male Location: Ontario, Canada Age: 32 Joined:
Additional Groups: Coding Team
pmwww | Re: Programming Style (14th Jan 08 at 2:41am UTC) | | Lately I've been trying to change my style of doing things but mostly I space things out, not tab, and I use innerHTML mostly but DOM when I need to Speed and being able to use it in all browsers are equal even though I hate making codes work in all browsers, the browsers need to have some kind of big meeting and make everything work
FF and Opera, maybe; as they both aim for meeting all standards [Opera was just quicker to do so]. However, Microsoft [IE] refuses to accept any w3 standard. They believe that they don't have to meet any standard that they don't create. Unfortunately, this means that IE doesn't parse all codes properly. | |
rroll.to— Shorten a link, rickroll your friends. |
| Dranew New Member
Posts: 10 Status: Offline Gender: Male Location: Michigan, U.S.A. Age: 36 Joined:
pmwwwmsnyahooaim | Re: Programming Style (14th Jan 08 at 3:29am UTC) | | Do you space codes out?: I do, makes it a lot easier to read, at least in my opinion.
If you do, do you use tabs or just spaces?: Both, I started using tabs awhile ago, and just recently started spacing my lines.
If you use Javascript, do you prefer DOM or innerHTML?: innerHTML is easier, though I wouldn't mind trying DOM for awhile
Do you worry about speed more or browser compatibility ?: Both really. though, compatibility is more important to me
If compatibility what browsers do you test in ?: IE, FF, Opera
If you use PHP do you use classes ?: I just started using classes.
What about SQL, do you use it or flat files?: SQL
What situations do you think SQL DB is better then flat files?: I never use flat files | |
o_O |
| Samus Junior Member
Posts: 56 Status: Offline Gender: Male Location: Australia Joined:
pmmsnicq | Re: Programming Style (16th Jan 08 at 5:28am UTC) | | Do you space codes out? Yes. I'm stuck in the habit now. Before it was just so Dreg wouldn't eat me.
If you do, do you use tabs or just spaces? Depends on whether or not the area supports the tabs.
If you use Javascript, do you prefer DOM or innerHTML? DOM. innerHTML may be easier, but doing stuff the easy way gets you nowhere.
What from experience has taught you when each would be better over the other? Dreg.
Do you worry about speed more or browser compatibility ? Both, equally.
If speed then how do you test? I don't. If it loads fast, then its fast. Otherwise it's too slow.
If compatibility what browsers do you test in ? Fx, IE, Opera, and Safari. And it WILL work in all of them the same, or I swear I will rip apart that code until it does. | |
|
| Reverse Blade Full Member
Posts: 152 Status: Offline Gender: Male Joined:
pm | Re: Programming Style (17th Jan 08 at 3:22am UTC) | | Lately I've been trying to change my style of doing things but mostly I space things out, not tab, and I use innerHTML mostly but DOM when I need to Speed and being able to use it in all browsers are equal even though I hate making codes work in all browsers, the browsers need to have some kind of big meeting and make everything work FF and Opera, maybe; as they both aim for meeting all standards [Opera was just quicker to do so]. However, Microsoft [IE] refuses to accept any w3 standard. They believe that they don't have to meet any standard that they don't create. Unfortunately, this means that IE doesn't parse all codes properly.
IE needs to get to it, all coders hate them. | |
Reverse Arts, Comming soon! |
| Xikeon New Member
Posts: 4 Status: Offline Gender: Male Location: Netherlands Joined:
pmaimgtalkxfire | Re: Programming Style (18th Jan 08 at 6:31pm UTC) | | Whats your programming style, is it similar to anyone else ? It's similar to lots of people's coding style. It's a style used by many people.
Example (click Select All):
Code: - var name = 'value';
- var second = 1337;
-
- if( name == 'this' && second == 1337 )
- {
-
- document.write( 'Ok...' );
-
- }
- else
- {
-
- alert( 'This be an error!' );
-
- }
Though instead of spaces I use tabs (editor: phpDesigner).
Do you space codes out? Yes.
If you do, do you use tabs or just spaces? Tabs
If you use Javascript, do you prefer DOM or innerHTML? Never really used DOM, so going for innerHTML.
What from experience has taught you when each would be better over the other?
Do you worry about speed more or browser compatibility ? Browser compatibility, though speed is important too.
If speed then how do you test? I just reload and see for myself xD
If compatibility what browsers do you test in ? FF2, IE7 (sometimes IE6, but it sucks).
If you use PHP do you use classes ? If they are handy to use (like for big projects, such as a whole site, member system or w/e), yes. And I made a framework which I use for everything so that's 99% classes.
If not whats your alternatives ?
Are their browser compatibility problems ? In what?
What from your experience makes some PHP applications lag ? Long for loops and getting too much data from an SQL table.
What about SQL, do you use it or flat files? SQL is better for holding serious and critical data. It's more organized and easier to manage.
What situations do you think SQL DB is better then flat files? MySQL is better for forums, member systems etc. Flat file is better for storing small data which you hardly ever change (Cache files, for example). | |
| Charles Stover New Member
Posts: 31 Status: Offline Gender: Male Location: Canada Age: 34 Joined:
pmwwwmsnyahooaimgtalkicqxfire | Re: Programming Style (1st Feb 08 at 12:28am UTC) | | Coding style:
Code: - <?php
- header("Content-Language: en-us");
- header("Content-Type: text/html; charset=utf-8");
- ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <html>
- <head>
- <title><?php
- $titles = Array("a", "random", "title", "is", "selected");
- echo $titles[rand(0, count($titles) - 1)], " - ", time();
- ?> - Mozilla Internet Explorer</title>
- <script type="text/javascript"><!--
- window.onload = function()
- {
- alert("This page was coded in GAMEchief's coding style.");
- }
- //--></script>
- <style type="text/css"><!--
- body {
- border : #000000 solid 3px;
- margin : 0;
- text-align : center;
- }
- --></style>
- </head>
- <body>
- <h1>Header 1</h1>
- <p>Forfeit the game before somebody else takes you out of the frame and puts your name to shame.</p>
- </body>
- </html>
Do you use tabs or just spaces? Tabs
Do you prefer DOM or innerHTML? Both.
What from experience has taught you when each would be better over the other? I like how you assume I put both. =]
Do you worry about speed more or browser compatibility? Compatibility.
If compatibility what browsers do you test in? Firefox and IE are the only ones I personally test in. Rarely IE even anymore. I assume it works in other browsers. If I learn that it doesn't work in a certain browser, I'll upgrade it until it works in that browser.
Do you use classes? No.
What are your alternatives? Functions.
Are their browser compatibility problems? No.
What from your experience makes some PHP applications lag? Excessive queries and editting files.
SQL or flat files? Depends. I love MySQL, but I've found that many situations suit flat files.
What situations do you think SQL DB is better then flat files? Anything that's rapidly updated and/or has many rows and columns. | |
|
| Cryhavoc_ Full Member
Just do it. Posts: 238 Status: Offline Gender: Male Location: The wrong way. Age: 31 Joined:
pm | Re: Programming Style (3rd Feb 08 at 7:56pm UTC) | | I've never used Flat Files alone. On my first week of learning PHP I created a full-proof CMS (had Peter check it out completely), and it was done entirely in SQL. Even the basic cookie checks were SQL based, though it made a lot of the coding tedious.
Though I'd like to try a complex system entirely of flat files, just because. | |
|
| |
| |
|