Home > Wrong With > Whats Wrong With This Code?

Whats Wrong With This Code?


There is no special error handling, so that could be skipped all together. You just stated they aren't, as you don't believe they can adjust to the new rules. 2. PerlMonks lovingly hand-crafted by Tim Vroom. Archives December 2016 (1) November 2016 (3) October 2016 (2) June 2016 (1) May 2016 (1) April 2016 (1) March 2016 (2) February 2016 (5) March 2015 (1) January 2015 (4) http://pcspeedpro.com/wrong-with/whats-wrong-with-this.html

fix these and it could work. 1026 points Submitted by Bobby Nation over 3 years ago 2 Comments r mora over 3 years ago Attention to detail is extremely important -- Sign in Email Address Password I forgot my password Sign in Perl: the Markov chain saw PerlMonks whats wrong with this code? Reply David Levine says: November 12, 2004 at 5:22 am Possible flaws (almost everyone has it right). 1. Using a while loop is better for that.[reply][d/l][select] Re^2: whats wrong with this code? http://wiki.c2.com/?WhatsWrongWithThisCode

What's Wrong With My Code Python

I can't think of any reason why an Order would need to be assigned to a different Customer.7. share|improve this answer answered Jun 21 '15 at 19:10 Makoto 59.7k1278128 add a comment| up vote 3 down vote You're shadowing the b variable by re-declaring it in your constructor meaning by Corion (Pope) on Jan 18, 2017 at 08:55UTC You're iterating over an array that you are modifying at the same time. Shift destroys the array for good.

Rethrowing expeptions this way is pointless - you don't add any information into exception, nor do you handle it in any way. while (scalar @array) #scalar not needed, but this is what is meant { print "@array\n"; shift (@array); } [download] [reply][d/l] Re: whats wrong with this code? The loop should be a foreach, not a for.6. What Is Wrong With My Code Java Testing - where's the unit testing that would tell us what the correct output is supposed to be? 🙂 In other words, the code may behave as intended but there is

The while loop does not muck with the $_ variable. What's Wrong With My Code Java It's not clear which of the two of the provided email addresses, if either, is supposed to be the Customer's, and if either of them *are* the Customer's email address, then I agree with the others that a char variable should be used along with a "default". https://teamtreehouse.com/community/whats-wrong-with-the-code-7 This will help both you and us. –Hovercraft Full Of Eels Jun 21 '15 at 19:12 2 f.setVisible(true); should be last, after pack().

Why is it really necessary? Javascript Code Validator Browse other questions tagged java swing actionlistener or ask your own question. Much of the work completed in this method on Customer is actually the responsibility of an Order, thus the class violates the SRP. 5. but you should double check them here you never know when something may be called.

What's Wrong With My Code Java

But so first number will always be 2 Why is that so? Log inSign up Your browser is not supported. What's Wrong With My Code Python NO action is performed even after using e.getSource(). What's Wrong With My Code C++ Reply James says: November 11, 2004 at 1:13 pm Is the ‘break;' neccessary?

There's no default case, so there's no way to determine if the value of s is always constrained to be "a" or "b", or if not, then if not executing a weblink Basically in this example there's no reason to have a try/catch block at all (except for maybe debugging, but that can be done more elegantly - use #if statement) 3. This also begs the question of whether a string should have been used in the first place. Reply Nat says: November 11, 2004 at 11:10 pm If we try to fix one by one at a time 1. What's Wrong With My Code Html

It's just that C# and the JIT do a *more* excellent job at an integer switch. Should Pluto Get Its Planethood Back? Yes NoResults (238 votes). As such, they are not conducive to pixel perfect layout. navigate here Without comments we cannot figure out that's wrong with it.

Use try/finally, move catch block out on top of switch or inside HitA/B, provide default case block, wrap exception into another more specific. Code Checker Html more stack exchange communities company blog Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and Other than that, everything else is "legal".

by Marshall (Monsignor) on Jan 18, 2017 at 10:40UTC I would code it like this (no need for the print before the loop and also swap order of statements within the

look at this as demonstration use strict; use warnings; my @array= 1..10; my $idx=0; for my $elem (@array) { print "<\$array[$idx] == $elem> @array\n"; shift @array; $idx++ } [download] out: <$array[0] What is wrong with the code?? Customer and Order probably shouldn't be directly connected so I'd have an OrderService with a method like:Order PlaceOrder(Customer, ShoppingCart);- The Customer entity shouldn't have data access logic in it.- You shouldn't Java Code Checker The compiler made no complaint.

Comment: Please enter a comment Verification: Remember Me? If the string isn't interned, IsInterned will return null, and therefore it's obviously not any of the cases (unless you have a null case, I suppose), so the code falls through string.Empty should be used in place of "".2b. http://pcspeedpro.com/wrong-with/whats-wrong-with-my-desktop.html by Alastair Smith at 8/3/2011 10:34 PM 1.

The only way to get it to compile is to declare ‘s' to be a string, but there's no way to be sure. Reply Brendan Tompkins says: November 12, 2004 at 7:18 am Eric, not sure, but how about: 1) Violates "Throw low, catch high"… no need to try catch in the first place…. by afoken (Monsignor) on Jan 18, 2017 at 13:06UTC my @array= 1..10; do { print "@array\n" } while defined shift @array; That does not work if @array may conain undef. >perl Reply Thomas Eyde says: November 12, 2004 at 12:08 am I'll second the break statement.

Other questions are better started on separate threads. Please help me if anyone can. Isn't an id good enough to create a foreign key?- Unused variable i;- Logging and sending email could be aspects handled outside your entity.- Short of an exception, PlaceOrder doesn't provide Nodes You Wrote Super Search List Nodes By Users Newest Nodes Recently Active Threads Selected Best Nodes Best Nodes Worst Nodes Saints in our Book Leftovers?

by anonymous at 8/3/2011 9:08 PM Null reference exception possible on both parameters specified.What is i used for? #re: Interview question - what's wrong with this code? I think I've done it right can anyone help me out My Photo Page Cool Images

I mean after clicking on the OK Button, there is nothing written in the JTextField. Should read if(!string.IsNullOrWhitespace(orderReference))Usage or newOrder and Product objects without ever checking to see if they are null.varable i has no discernable purpose.sqlserverdatabase, LoggingService and CommuncationServer should all be injected into the by purnak (Novice) on Jan 18, 2017 at 09:03UTC doesn't do what you want anyway I know while instead of foreach can do what I want but just wanted to Join them; it only takes a minute: Sign up What's wrong with my code?

Neither one of these was a Gimpel.com "Bug of the Month", but they are typical of the types of programming problems given during C++ job interviews. #1) What is wrong with Generated Fri, 17 Mar 2017 23:24:29 GMT by s_wx1188 (squid/3.5.23) This while loop is testing whether or not there are any elements in @array. Also: Use a logical and consistent form of indenting code lines and blocks.

So don't do that." — Ken [reply][d/l] Re: whats wrong with this code? most probably is foreach internally holding an index to iterate the array. However, the debugger does not treat it as such 🙁 #5 - Switching a string is inefficient, there may be other methods that are faster.