Welcome to Dream.In.Code
Getting Help is Easy!

Join 84,852 Programmers. There are 1,749 online right now! Ask your question and get quick answers from Dream.In.Code experts. Join the #1 programming help community on the internet! Registration is fast and FREE... Join Now!

Chat LIVE With a Expert
Powered by LivePerson.com

Register to Make This Box Go Away!

Programming style/habbits

4 Pages V  1 2 3 > »   
Reply to this topicStart new topic

Programming style/habbits, How do YOU do it?

NickDMax
post 19 Mar, 2008 - 07:02 AM
Post #1


2B||!2B

Group Icon
Joined: 18 Feb, 2007
Posts: 2,020

I am often amazed when helping out in the forums. People seems to write entire programs out without testing as they go. In the C++ forum people will post long code listings riddled with syntax errors -- which makes it seem that they sat down and wrote this entire program without compiling once.

Me, I compile often. I also test often. I would say that probably about 10% of the code I write is purely for testing purposes and will not appear in the final product.

Now I realize that I am not a fast programmer and a good deal of that is probably related to the fact that I have a very conservative programming style (referring to how I work not my coding style). I am wondering if I am the norm or the exception. It would seem to me that other programmers are much faster -- and I think part of that has to be that they don't "waste" as much time writing code to ensure that the other code that they have written works.

How often do you compile the code you are working on?
How much do you test as you go?
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Not The Right Answer?

Ask an Expert Now...
Join For Free!


Register for Free to Make This Ad Go Away!

BenignDesign
post 19 Mar, 2008 - 07:10 AM
Post #2


DIC Regular

Group Icon
Joined: 28 Sep, 2007
Posts: 452

I design websites, so compiling isn't a big part of my day, but I test my code almost constantly. I usually have Notepad++ open with all the code related to the site I'm working on, the site itself up in Firefox and IE (and sometimes Opera and Netscape also), plus Gimp for quick image editing. After every 2 or 3 changes, I refresh everything just to make sure it's working the way I want. On the rare occasions I need to use a "real" language, I compile just as often.

Seems to me it saves time and energy in the long run to test functionality often rather than get to the end and lose hours trying to find a missed quotation mark.

I also usually have DIC open in my Firefox window... 1. for when I need a quick break, 2. for when I need a quick reference, and 3. for when I need to post a question. I must say I am so happy to have found this site - you all have saved my butt on more than one occasion. biggrin.gif

This post has been edited by BenignDesign: 19 Mar, 2008 - 07:14 AM
User is online!Profile CardPM
Go to the top of the page
+Quote Post

bflosabre91
post 19 Mar, 2008 - 07:25 AM
Post #3


New DIC Head

*
Joined: 22 Feb, 2008
Posts: 35

i test and compile like crazy. prob too much but i just want to be sure i dont break anything and typed everything correctly before i go too far deep. cause i hate backtracking what ive done..basically after i finish a new function or whatever it may be, ill test and compile. i dont really dig deep, but just make sure its functioning now, and then i do really specific testing later on in bigger chunks
User is online!Profile CardPM
Go to the top of the page
+Quote Post

girasquid
post 19 Mar, 2008 - 07:33 AM
Post #4


Barbarbar

Group Icon
Joined: 3 Oct, 2006
Posts: 943

QUOTE(BenignDesign @ 19 Mar, 2008 - 07:10 AM) *

After every 2 or 3 changes, I refresh everything just to make sure it's working the way I want.


I usually do this when I'm working on XHTML, using Firefox + Safari - in addition to that, my editor(Smultron) has an in-editor preview, so I can just push cmd+u to preview the HTML document.

For a language that actually needs compiling/testing, I'm usually doing a compile/test after any significant change, whatever that may be for the given project.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

NickDMax
post 19 Mar, 2008 - 07:44 AM
Post #5


2B||!2B

Group Icon
Joined: 18 Feb, 2007
Posts: 2,020

Another thing I tend to do that seems to irritate my boss (in that way where you can't tell someone they did wrong, but you wish they would have more sense) is that when I write a class I tend to write a complete class.

To explain what I mean by this I will give an example: In a recent POC (proof of concept) I had to write a class that would write auditing information to a database. Now the only requirement was that entries get written -- since it is a POC and not a solution the code was never expected to function past testing. BUT I went ahead and added other functions to update entries, to delete entries, to delete old entries etc. -- a complete auditing class. Nice to have, but now I have a class where only about 20-25% of the code was actually used/required.

I understand that sticking to the requirements document is important since "added functionality" leads to support problems later. But I can't help it, when I am building a class I tend to add in all the functions I think that Object needs.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

born2c0de
post 19 Mar, 2008 - 07:48 AM
Post #6


printf("I'm a %XR",195936478);

Group Icon
Joined: 26 Nov, 2004
Posts: 3,286

I compile and casual-test frequently while writing code.
Initially when I started out, I used to test only when I wrote major chunks of code but it led to solid debugging sessions so now I compile as often as I can.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

1lacca
post 19 Mar, 2008 - 07:57 AM
Post #7


code.rascal

Group Icon
Joined: 11 Aug, 2005
Posts: 3,132

I don't compile too often due to several factors:
- I am quite confident in my coding wink2.gif
- every modern IDE does syntax highlighting so an obvious syntax error becomes visible right on the spot
- the applications I work on right now rebuild in a minute, and the initialization and startup takes at least twice as much time, so it is not that exciting (in the other room there is a monster, that rebuilds in 15 to 20 minutes)
- usually the test cases and functions I have to go through take even longer to test, so it is not really efficient to compile and test too frequently.

Anyway, this is why we like unit tests, don't we?

Back to your original question, I find it strange too, that people post codes full of syntax errors, because the compilers usually give quite good error messages recently (not like the javascript errors of IE), so they should not be too hard to fix.


However you can still read my answer as I compile and test as much as I can.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

tody4me
post 19 Mar, 2008 - 08:17 AM
Post #8


livin in a gamers wasteland

Group Icon
Joined: 12 Apr, 2006
Posts: 807

I usually compile when I get finished with a portion of code. Sometimes there are errors, that I go back and fix. After the program compiles, I will do a basic test of the UI and make sure it's asking for the right things, then the actual testing is done by the users. If they should find something that doesn't work as expected, they'll let me know and I'll fix it.

This post has been edited by tody4me: 19 Mar, 2008 - 08:17 AM
User is online!Profile CardPM
Go to the top of the page
+Quote Post

1lacca
post 19 Mar, 2008 - 09:02 AM
Post #9


code.rascal

Group Icon
Joined: 11 Aug, 2005
Posts: 3,132

QUOTE(tody4me @ 19 Mar, 2008 - 04:17 PM) *

... then the actual testing is done by the users. If they should find something that doesn't work as expected,

I would get a royal kick in the ass for that, lol!
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Nykc
post 19 Mar, 2008 - 09:19 AM
Post #10


DIC == Huge!

Group Icon
Joined: 14 Sep, 2007
Posts: 2,221

I don't compile too often, but in web design my HTML Kit comes with a preview button. Also I constantly check my updates every few changes.
User is online!Profile CardPM
Go to the top of the page
+Quote Post

NickDMax
post 19 Mar, 2008 - 11:23 AM
Post #11


2B||!2B

Group Icon
Joined: 18 Feb, 2007
Posts: 2,020

to be totally honest -- at work I use Java and develop in eclipse. Eclipse compiles the current file every time it is saved (and periodically while editing) so I don't really compile all that often in Java. I actually do not build and deploy the code very often. I write little "test programs" which test the classes, but since I work with an enterprise application I don't often test on the development environment until things are working on my laptop.


QUOTE
...the actual testing is done by the users. If they should find something that doesn't work as expected, they'll let me know and I'll fix it.
Well... um... that is *kinda* the way it works with me. The end users do tend to test the code (performance test/load tests/stress test (not really sure what the difference is between these), unit tests etc etc etc.) I really have no idea what they are doing... generally I get emails telling me everything worked, but the "business users" want to change one little thing (which generally means a big thing). Sometimes they complain because the code failed or runs too slow when a mere 4000 users were connected (this is often more of a hardware problem than my coding -- try explaining THAT though).
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

PsychoCoder
post 19 Mar, 2008 - 11:40 AM
Post #12


Code Or Die!

Group Icon
Joined: 26 Jul, 2007
Posts: 5,819

When writing software I use NUnit and do many unit tests, usually for every piece of functionality to ensure there aren't any errors before it goes to QA. At my last job I believe I was the only developer who actually did his own user testing before sending to QA.

Even in the C#/VB.Net forums I see people constantly posting code that, with a single look, you can see it wont work, and is normally the cause of their initial problem. When answering in the forums at times I'm guilty of writing solutions in Notepad, but for the most part I actually test the code I'm offering as a solution.

Even with the tutorials I write, the code is written in Visual Studio and tested before posting the tutorial.

Though I am very confident of my coding abilities, I will continue to do my unit tests and user testing just to ensure that I can catch as many of the errors as humanly possible before sending to QA. With the web application I'm currently working on I use my family for user testing as well, I tend to like to have non techies test my work when I think it's completed, as a programmer knows all too well how to find the "happy path", whereas end users will always find a bug if it exists.
User is online!Profile CardPM
Go to the top of the page
+Quote Post

4 Pages V  1 2 3 > » 
Fast ReplyReply to this topicStart new topic



Time is now: 5/9/08 01:31PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month