|
The reason indeed why I posted the acceptability is to hear what you think.
I am way out to left field my own practices are just for myself as I am the owner of my software company.
This is the whole thing, I already know how off standard this is.
Namespace Sinks
<System.Runtime.Serialization.DataContract(IsReference:=True)>
Public MustInherit Class Base
Inherits Validate
Implements iInterface
<System.Runtime.Serialization.DataMember>
Private mLastUpdated As DateTime, _
mLastUpdatedBy As String, _
mClearanceRequired As Int64, _
mClearanceIsRequired As Boolean
Public Sub New()
MyBase.New()
End Sub
Public Sub New(Clearance As Int64)
MyBase.New()
ClearanceRequired = Clearance
End Sub
Public Property LastUpdated As DateTime Implements iInterface.LastUpdated
Get
Return mLastUpdated
End Get
Set(value As DateTime)
mLastUpdated = value
End Set
End Property
Public Property LastUpdatedBy As String Implements iInterface.LastUpdatedBy
Get
Return mLastUpdatedBy
End Get
Set(value As String)
mLastUpdatedBy = value
End Set
End Property
Public Property ClearanceIsRequired As Boolean Implements iInterface.ClearanceIsRequired
Get
Return mClearanceIsRequired
End Get
Set(value As Boolean)
mClearanceIsRequired = value
End Set
End Property
Public Property ClearanceRequired As Long Implements iInterface.ClearanceRequired
Get
Return mClearanceRequired
End Get
Set(value As Long)
mClearanceIsRequired = True
mClearanceRequired = value
End Set
End Property
Public Overloads ReadOnly Property Value(User As Directory.iUser) As Object Implements iInterface.Value
Get
Select Case True
Case User.Deny : Throw New Exception("User Denied!")
Case ClearanceIsRequired And User.ClearanceReadLevel < ClearanceRequired : Throw New Exception("User clearance is lower then required!")
Case Else : Return MyBase.Value
End Select
End Get
End Property
Public Overloads WriteOnly Property Value(UpdatedDate As Date, LastUpdatedBy As String) As Object Implements iInterface.Value
Set(value As Object)
Me.LastUpdated = UpdatedDate
Me.LastUpdatedBy = LastUpdatedBy
MyBase.Value = value
End Set
End Property
Public Overloads WriteOnly Property Value(UpdatedDate As Date, LastUpdatedBy As Directory.iUser) As Object Implements iInterface.Value
Set(value As Object)
If Me.LastUpdated = Nothing Then Me.LastUpdated = Me.Created
Select Case True
Case ClearanceIsRequired
LastUpdatedBy.Authorize _
(
OriginalDate:=Me.LastUpdated,
ChangeDate:=UpdatedDate,
ClearanceLevel:=Me.ClearanceRequired
)
Case Else
LastUpdatedBy.Authorize _
(
OriginalDate:=Me.LastUpdated,
ChangeDate:=UpdatedDate
)
End Select
Me.Value(UpdatedDate, LastUpdatedBy.Name) = value
End Set
End Property
End Class
End Namespace
modified 14-Apr-14 16:05pm.
|
|
|
|
|
I would prefer to write the attribute for each member, if you want to save lines of code you could write them inline.
<System.Runtime.Serialization.DataMember> Private mLastUpdated As DateTime
<System.Runtime.Serialization.DataMember> Private mLastUpdatedBy As String
<System.Runtime.Serialization.DataMember> Private mClearanceRequired As Int64
<System.Runtime.Serialization.DataMember> Private mClearanceIsRequired As Boolean
And since you're saving lines of code, why could use auto-implemented properties por LastUpdated, LastUpdatedBy and ClearanceRequired.
|
|
|
|
|
yeah I like that way too.
It's not about saving lines of code, it's about creating white space
|
|
|
|
|
If you're worried about space, why are you using one of the most verbose languages there is?
|
|
|
|
|
White space and readability
It's like taking actual English practices and applying them to coding, so the point reading code is like reading a paragraph - when it's so elegant writing comments are redundant.
|
|
|
|
|
Gates VP wrote: That stated, if you're mixing types on the "multi-declarations", it's time split them out.
They are clearly separated by lines, if they were in the same line, then I would agree with you. As I said in my reply, it resembles a lot C++ declaration like:
private:
int x;
double y;
.
.
.
The underscore even act as C++ semi-colon. It doesn't hurt readability as you can clearly see the types at the end of each line. I don't see any confusion, except that someone may be in doubt if the attribute applies only to the first variable or all of them.
To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson
----
Our heads are round so our thoughts can change direction - Francis Picabia
|
|
|
|
|
If you have 35 or 40 of these grouped into one segment, they're going to flow off the screen.
If you want to mark just one of them as "public", do you copy/paste this to some other part of the file entirely?
How does this affect the attributes? Remember, after you copy/paste the private variable to the public section, the original attributes are on a completely different screen. And you're not instinctively moving the attribute along with the variable.
Quote: I don't see any confusion, except that someone may be in doubt if the attribute applies only to the first variable or all of them.
That's still confusion. And it's not really useful or purposeful confusion. You save a small number of characters and compile to the exact same IL code (hopefully) while introducing uncertainty for developers.
This is the equivalent of doing C++ / C# if blocks without braces. You come back to this problem that actually caused real production issues on iOs:
https://www.imperialviolet.org/2014/02/22/applebug.html[^]
|
|
|
|
|
I write generics
my classes are never more then 300 lines of code
and if I need more then 4 or so data members I am doing something wrong
Also I would never declare a member of a class public, I use properties to expose members.
The only reason these are grouped together is so I do not have to write the serialization tag out for each, its cheating a bit.
|
|
|
|
|
This is actually one line of code,
but that is why I break it into multiple lines using the _ character to cheat a little bit, so I only have to write the serialization tag once.
|
|
|
|
|
I would say it is not acceptable because your intent is not clear, which makes the code difficult to maintain.
|
|
|
|
|
The comment above the code in a must inherit class
Authorization data members:
If Clearance Is Required the user attempting to change the value will have their clearance level validated against the clearance required.
Collects who and when this class was last updated by - for data merging such as offline files.
|
|
|
|
|
|
Set up a proxy or use a TOR client/browser.
|
|
|
|
|
How about contacting the company at: support@freelancer.com
And asking them to send you the App ?
good luck, Bill
“I speak in a poem of the ancient food of heroes: humiliation, unhappiness, discord. Those things are given to us to transform, so that we may make from the miserable circumstances of our lives things that are eternal, or aspire to be so.” Jorge Luis Borges
|
|
|
|
|
They told me to try again later...
|
|
|
|
|
Vasily Tserekh wrote: need help from people from the lounge
No you don't.
The report of my death was an exaggeration - Mark Twain
Simply Elegant Designs JimmyRopes Designs
I'm on-line therefore I am.
JimmyRopes
|
|
|
|
|
You've obviously got on-line access to post this message, so why not just use the web-site until you're back in Canada?
|
|
|
|
|
|
Interesting.[^]
Wildlife has always fascinated me. As much as I enjoy learning about them, I am also a strong advocate of not tampering with their lifestyle like in zoo and other parks around the World.
I am not sure if anyone saw it, but there is a video floating around that shows 15 Chinese people electrocuting tiger to show off their wealth. Now that is something which deserves capital punishment. Reading through news and watching videos around it, I also stumbled upon a zoo or a circus clip from China again where two men were seen physically abusing a tiger. I wish they face same treatment before they too are handed over capital punishment.
Call me inhumane or whatever but I do feel some acts totally deserve capital punishment.
|
|
|
|
|
I believe they ought to have the right to abuse a tiger.
I have no problem with that.
However it ought to be done in a confined space and with the tiger being free to respond in any way it wants.
Let us see how brave they would be then!
---------------------------------
Obscurum per obscurius.
Ad astra per alas porci.
Quidquid latine dictum sit, altum videtur .
|
|
|
|
|
Dalek Dave wrote: I believe they ought to have the right to abuse a tiger.
You managed to piss me off a little with this. But then I read the rest.
Sad thing is, that animals mostly do not attack even if they have a chance. Fear of life is still in a very primitive stage in them and they tend to succumb. You might feel a tiger would fight back if free but that is not entirely true. They prefer avoiding.
I hear you have a military background, do you mind killing idiots like these?
|
|
|
|
|
I am not saying we should kill idiots, but we should remove all safety warnings and let nature take its course.
---------------------------------
Obscurum per obscurius.
Ad astra per alas porci.
Quidquid latine dictum sit, altum videtur .
|
|
|
|
|
I thought you were going to say that they found it chewy.
You'll never get very far if all you do is follow instructions.
|
|
|
|
|
No, that was Polar bears - cold and crunchy on the outside, warm and chewy on the inside.
Dave.
|
|
|
|
|
Isn't that a polar bear's review of an igloo?
You'll never get very far if all you do is follow instructions.
|
|
|
|