defensive-programming Questions

3

Solved

I usually loop through lines in a file using the following code: open my $fh, '<', $file or die "Could not open file $file for reading: $!\n"; while ( my $line = <$fh> ) { ... } Howeve...
Silverfish asked 22/9, 2010 at 21:54

8

Solved

As per the title really, just what can be done to defeat key/keystroke logging when authenticating access? I have just posted a related question (how-to-store-and-verify-digits-chosen-at-random-fr...
Camala asked 2/8, 2010 at 14:42

2

Solved

What would be a good way to report errors in JavaScript instead of relying on nulls, and undefineds when errors do occur and a function is unable to proceed forward. I can think of three approaches...
Vitiligo asked 17/7, 2010 at 1:16

3

Solved

I have read about how the fail-fast style of programming in languages like Erlang end up with much shorter programs than the defensive style found in most other languages. Is this correct for all t...
Forgive asked 22/6, 2010 at 12:42

8

Do people practically ever use defensive getters/setters? To me, 99% of the time you intend for the object you set in another object to be a copy of the same object reference, and you intend for ch...
Villagomez asked 29/5, 2009 at 14:52

1

Solved

I'm fairly certain my professor will ask me why I chose to use MVC for my web application. Truth be told, I'm new to MVC. I read about it, I'm building a blog application using it, I think it's ve...
Moiramoirai asked 27/2, 2010 at 14:49

14

Solved

Possible Duplicate: Defensive programming We had a great discussion this morning about the subject of defensive programming. We had a code review where a pointer was passed in and was n...
Heroism asked 16/12, 2009 at 18:6

10

Solved

I’m from a .NET background and now dabbling in Java. Currently, I’m having big problems designing an API defensively against faulty input. Let’s say I’ve got the following code (close enough): pu...
Jaguar asked 18/9, 2009 at 12:44

14

Solved

When writing code do you consciously program defensively to ensure high program quality and to avoid the possibility of your code being exploited maliciously, e.g. through buffer overflow exp...
Pontias asked 9/8, 2008 at 17:2

15

Solved

I was having a discussion with one of my colleagues about how defensive your code should be. I am all pro defensive programming but you have to know where to stop. We are working on a project that ...
Kibler asked 15/5, 2009 at 16:14

14

Solved

i was working with a small routine that is used to create a database connection: Before public DbConnection GetConnection(String connectionName) { ConnectionStringSettings cs= Configuratio...
Sathrum asked 27/6, 2009 at 17:10

6

Solved

Disclaimer: I am a layperson currently learning to program. Never been part of a project, nor written anything longer than ~500 lines. My question is: does defensive programming violate the Don't ...
Altercation asked 7/6, 2009 at 5:56

7

What is your must have defence methods to common web attacks like XSS, Sql Injection, Denial of Service, etc. ? Edit : I collected your responses under descriptions from Wikipedia. And I add some ...
Fourdimensional asked 4/2, 2009 at 15:45

2

Solved

Recently I worked on FindBugs warnings about exposing internal state, i.e. when a reference to an array was returned instead of returning a copy of the array. I created some templates to make conve...
Orbital asked 17/12, 2008 at 12:3

12

I have been programming for the last 3 years. When I program, I use to handle all known exceptions and alert the user gracefully. I have seen some code recently which has almost all methods wrapped...
Dirk asked 2/12, 2008 at 15:28

9

Solved

Here's a perfect example of the problem: Classifier gem breaks Rails. ** Original question: ** One thing that concerns me as a security professional is that Ruby doesn't have a parallel of Java's...
Milne asked 28/8, 2008 at 14:7

9

Solved

Watching SO come online has been quite an education for me. I'd like to make a checklist of various vunerabilities and exploits used against web sites, and what programming techniques can be used t...
Palacios asked 26/8, 2008 at 19:51

9

The code in this question made me think assert(value>0); //Precondition if (value>0) { //Doit } I never write the if-statement. Asserting is enough/all you can do. "Crash early, crash oft...
Emmalynn asked 11/9, 2008 at 9:53

© 2022 - 2024 — McMap. All rights reserved.