Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Where to enforce requirements

Name: Anonymous 2010-09-18 23:32

Requirement: the name variable in class X has a maximum length of 10 characters.

Should class X even know about this requirement, or should the requirement be enforced solely by the business logic class?

Name: Anonymous 2010-09-18 23:47

Your design, dude. Most likely you're getting paid for this, so take a fucking decision by yourself every once in a while.

Name: Anonymous 2010-09-18 23:47

>>2
I doubt people get paid for trolling /prague.

Name: Anonymous 2010-09-18 23:52

I'm neither being payed for this nor trolling. I thought there might be somebody here with more experience who might be able to offer their opinion and their reasons for it.

Name: Anonymous 2010-09-18 23:53

I agree

Name: Anonymous 2010-09-19 0:23


                 ∧_∧    / ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄
              ( ´∀`) < Nyan nyan nyan nyan ni hao nyan
            /    |    \________
           /       .|     
           / "⌒ヽ |.イ |
       __ |   .ノ | || |__
      .    ノく__つ∪∪   \
       _((_________\
        ̄ ̄ヽつ ̄ ̄ ̄ ̄ ̄ ̄ | | ̄
       ___________| |
        ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄| |
        ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄| |
       ___________| |
        ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄| |

Name: Anonymous 2010-09-19 0:24

What's the weather like in New Delhi today?

Name: Anonymous 2010-09-19 0:30

>>7
I wouldn't know, I live in Madras.

Name: Anonymous 2010-09-19 0:31

When I am king, using the words ``business logic'' will be a capital offense.

Name: Anonymous 2010-09-19 0:48

Well, business refers to one of the 3 layers of design separation...

http://en.wikipedia.org/wiki/Business_logic

What do you call it? It's just sort of a way to make talking about abstract concepts easier—a bit like design pattern names.

Name: Anonymous 2010-09-19 1:28

>>10
I hope you get hit by a car.

Name: Anonymous 2010-09-19 1:50

>>11
I hope you get hit by a cdr.

Name: Anonymous 2010-09-19 1:55

>>12
I hope you get hit by a cock

Name: Anonymous 2010-09-19 2:09

>>13
I hope you get bitch-slapped by a Y-Combinator

Name: Anonymous 2010-09-19 2:55

It depends on the circumstances.

If it is not physically possible for the name class to have a length greater than ten (I.E: it represents some specific, documented naming standard which specifies all names must be less than ten characters) then this would go inside class X. It would enforce strict requirements in the setter for the name, as well as in the constructor. In fact, in this case, you should probably be making a specific class for the name property and encapsulating the login in there (much like you would a phone number class, or a ISBN class).

If however, this is simply a requirement necessitated by external influence and not really chosen for a specific design purpose (Say, the GUI does not have space for names longer than ten characters, a legacy database stores names in VARCHAR(10) or similar) then you would not put the logic in X. The class X will still support names longer than ten characters, but the classes that need a ten character name will need to perform appropriate transformations. (i.e.: the GUI could truncate it, insert a dash and move the rest to a newline, the database could maintain a separate map from unique 10 character 'id' values to true names.

Name: Anonymous 2010-09-19 3:02

>>15
Why are you not trolling?

Name: Anonymous 2010-09-19 3:32

>>16
Be the change you want to see in the /prog/.

Name: Anonymous 2010-09-19 9:03

>>15
Sounds gay. If the name shouldn't be > 10 chars, then it should be in class X. The GUI shouldn't contain special cases for each input field; it should set the maximum length of all text fields as the maximum length of the variables to which they are bound.

Name: Anonymous 2010-09-19 9:36

>>18
You don't know what you are talking about and I suggest you read my post again.
Sounds gay
back to /b/, please

Name: Anonymous 2010-09-19 9:50

>>19
I read it 5 times. Class X should be aware of this requirement, regardless of whether it's specified by documentation or a legacy database, as it is part of its internals. The GUI should have nothing to do with this logic, apart from enforcing a 10-character limit on input fields (having been told to do so by class X).

Name: Anonymous 2010-09-19 10:04

I would make it a char[10] and if it overruns the program crashes

Name: Anonymous 2010-09-19 10:17

>>20
What if the character requirement is GUI-specific, hmm?

>>1
Probably in class X. You want to make invalid program states unrepresentable, so don't create a data type that can hold one. That's assuming that for all uses of class X, a name greater than 10 characters is invalid.

Name: Anonymous 2010-09-19 11:19

>>20
I'm not even going to bother helping you because it's clear you are too retarded to help yourself. Rest assured however, that you are completely wrong.

Name: Anonymous 2010-09-19 11:25

>>23
Okay, given no reason aside from baseless personal attack, I have no choice but to believe you. Thank you; you have shown me how I am wrong and how I can better myself - not only as a GUI programmer, but also as a human in general.

Name: Anonymous 2010-09-19 12:04

If I were to tell you what is wrong I would basically just be quoting your entire post. If you can't see what is wrong with it, then not only do you not understand OOP, but you don't know what you don't understand about OOP and that I fear is your downfall.

Name: >>25 2010-09-19 12:19

That was meant in reply to >>24 , not OP.

Name: Anonymous 2010-09-19 12:25

>>25
Well then it's lucky that Haskal is the only language I know, isn't it?

Name: Anonymous 2010-09-19 13:04

>>24
GUI programmers aren't humans and shouldn't be considered to be.

Name: Anonymous 2010-09-19 17:38


_____________________________________
/ I am an
EXPERT GUI PROGRAMMER and I \
\ agree with >>24                     /
 -------------------------------------
      \                    / \  //\
       \    |\___/|      /   \//  \\
            /0  0  \__  /    //  | \ \   
           /     /  \/_/    //   |  \  \ 
           @_^_@'/   \/_   //    |   \   \
           //_^_/     \/_ //     |    \    \
        ( //) |        \///      |     \     \
      ( / /) _|_ /   )  //       |      \     _\
    ( // /) '/,_ _ _/  ( ; -.    |    _ _\.-~        .-~~~^-.
  (( / / )) ,-{        _      `-.|.-~-.           .~         `.
 (( // / ))  '/\      /                 ~-. _ .-~      .-~^-.  \
 (( /// ))      `.   {            }                   /      \  \
  (( / ))     .----~-.\        \-'                 .~         \  `. \^-.
             ///.----..>        \             _ -~             `.  ^-`  ^-_
               ///-._ _ _ _ _ _ _}^ - - - - ~                     ~-- ,.-~
                                                                  /.-~

Name: Anonymous 2011-02-04 18:42

Name: Anonymous 2013-01-19 23:51

/prog/ will be spammed continuously until further notice. we apologize for any inconvenience this may cause.

Don't change these.
Name: Email:
Entire Thread Thread List