This one made me sigh
-
Just compiled a project from our Outsourcing Contrators... Now this apparently works according to them and they feel its ready to be deployed.. Got 10 Fatal Errors and 200 Warnings :-( Its not that thats got me though, the code snippet below kinda flies in the face of logic and good practice.. Couple of questions here then... Firstly Why is it a function? And secondly why doesnt it return a value.. Bear in mind this code snippet is run on every page on page_load and has been copied and pasted across the site.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Validsession() End Sub Public Function validSEssion() if session("username")="" then response.redirect("\Logout.aspx") End Function
On going through the code a bit more I noticed that 90% of it is Function's that dont return any values.. There are no Subs!! -
Just compiled a project from our Outsourcing Contrators... Now this apparently works according to them and they feel its ready to be deployed.. Got 10 Fatal Errors and 200 Warnings :-( Its not that thats got me though, the code snippet below kinda flies in the face of logic and good practice.. Couple of questions here then... Firstly Why is it a function? And secondly why doesnt it return a value.. Bear in mind this code snippet is run on every page on page_load and has been copied and pasted across the site.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Validsession() End Sub Public Function validSEssion() if session("username")="" then response.redirect("\Logout.aspx") End Function
On going through the code a bit more I noticed that 90% of it is Function's that dont return any values.. There are no Subs!!:laugh:
SSK. Anyone who says sunshine brings happiness has never danced in the rain.
-
Just compiled a project from our Outsourcing Contrators... Now this apparently works according to them and they feel its ready to be deployed.. Got 10 Fatal Errors and 200 Warnings :-( Its not that thats got me though, the code snippet below kinda flies in the face of logic and good practice.. Couple of questions here then... Firstly Why is it a function? And secondly why doesnt it return a value.. Bear in mind this code snippet is run on every page on page_load and has been copied and pasted across the site.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Validsession() End Sub Public Function validSEssion() if session("username")="" then response.redirect("\Logout.aspx") End Function
On going through the code a bit more I noticed that 90% of it is Function's that dont return any values.. There are no Subs!!PeterTheGreat wrote:
There are no Subs!!
They got something right then :-P Russ
-
Just compiled a project from our Outsourcing Contrators... Now this apparently works according to them and they feel its ready to be deployed.. Got 10 Fatal Errors and 200 Warnings :-( Its not that thats got me though, the code snippet below kinda flies in the face of logic and good practice.. Couple of questions here then... Firstly Why is it a function? And secondly why doesnt it return a value.. Bear in mind this code snippet is run on every page on page_load and has been copied and pasted across the site.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Validsession() End Sub Public Function validSEssion() if session("username")="" then response.redirect("\Logout.aspx") End Function
On going through the code a bit more I noticed that 90% of it is Function's that dont return any values.. There are no Subs!!Unfortunately this is a misfeature of VB.NET that's inherited from VB6. If you declare a
Function
, but omit the type of the return value, it is implicitlyObject
(Variant
in VB6). The other misfeature is that in Classic VB, the return value of the function was set by assigning to the name of the function - there was noReturn
statement. The last value set was the return value, but it didn't return straight away when set. This was very confusing. You could easily forget to set it (in which case it would be defaulted, I think, to the default value for the type, in this caseNothing
).Option Strict
fixes many problems in VB code (or, rather, turns them into compile-time errors, forcing you to fix them), and thankfully failing to define the return value of a function is one of them, at least as of VB 7.1 (.NET 2003). You will have to fix all the type-coercion errors if you turn it on, though, using explicit casts. I try to useDirectCast
where possible (where I know that the object is already of the type I'm asking it to convert to).
DoEvents
: Generating unexpected recursion since 1991 -
Just compiled a project from our Outsourcing Contrators... Now this apparently works according to them and they feel its ready to be deployed.. Got 10 Fatal Errors and 200 Warnings :-( Its not that thats got me though, the code snippet below kinda flies in the face of logic and good practice.. Couple of questions here then... Firstly Why is it a function? And secondly why doesnt it return a value.. Bear in mind this code snippet is run on every page on page_load and has been copied and pasted across the site.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Validsession() End Sub Public Function validSEssion() if session("username")="" then response.redirect("\Logout.aspx") End Function
On going through the code a bit more I noticed that 90% of it is Function's that dont return any values.. There are no Subs!!That's some pretty bad naming for the functions. According to the naming conventions of .NET, I believe it should be
ValidateSession()
or at least something with a verb.ValidSession
is something I'd use for a boolean value.ROFLOLMFAO
-
Just compiled a project from our Outsourcing Contrators... Now this apparently works according to them and they feel its ready to be deployed.. Got 10 Fatal Errors and 200 Warnings :-( Its not that thats got me though, the code snippet below kinda flies in the face of logic and good practice.. Couple of questions here then... Firstly Why is it a function? And secondly why doesnt it return a value.. Bear in mind this code snippet is run on every page on page_load and has been copied and pasted across the site.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Validsession() End Sub Public Function validSEssion() if session("username")="" then response.redirect("\Logout.aspx") End Function
On going through the code a bit more I noticed that 90% of it is Function's that dont return any values.. There are no Subs!!Hi Peter,
PeterTheGreat wrote:
Outsourcing Contrators
I'm curious. Where did you get your contractors or the firm with which you are contracting? Jeff
-
Just compiled a project from our Outsourcing Contrators... Now this apparently works according to them and they feel its ready to be deployed.. Got 10 Fatal Errors and 200 Warnings :-( Its not that thats got me though, the code snippet below kinda flies in the face of logic and good practice.. Couple of questions here then... Firstly Why is it a function? And secondly why doesnt it return a value.. Bear in mind this code snippet is run on every page on page_load and has been copied and pasted across the site.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Validsession() End Sub Public Function validSEssion() if session("username")="" then response.redirect("\Logout.aspx") End Function
On going through the code a bit more I noticed that 90% of it is Function's that dont return any values.. There are no Subs!!PeterTheGreat wrote:
compiled a project from our Outsourcing Contrators...
That kind of tells something. I'll just keep my Soapbox thoughts about outsourced contractors to myself :rolleyes:
"The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon