5 ms·
> Exposing representation invariants In object-oriented programming, a representation invariant is a set of constraints that a concrete data type must uphold to
by greggman 11y ago
> Exposing representation invariants In object-oriented programming, a representation invariant is a set of constraints that a concrete data type must uphold to correctly represent an abstract data type. Simply mapping a data structure to a UI would expose the invariant and put the burden of enforcing the invariant on users instead of the code. A typical example is having to enter a phone or part number in a specific format instead of the program handling any reasonable input.
> Warning sign: Users required to enter data using a specific format.
This one drives me nuts. Soooooo many forms say "enter your phone number no spaces or dashes or parens" or cc number. Please just remove the dashes, spaces, parens when checking validation and maybe after submit. Don't force the user to have to do this. They might be copying and pasting
Also don't make some 4 field 16 digit custom form that ruins backspace behavior and makes it impossible to copy and paste. That also means don't limit the field to 16 characters. If a users pastes in "xxxx-yyyy-zzzz-wwww" and only get "xxxx-yyyy-zzzz-w" you're only going to frustrate them.
This is also an issue with many phone apps. Some you can't paste a number in. Try copying a number from Safari iOS into Google Hangouts Phone dialer. There's no paste option so I'm forced to write down the number on paper so I can manaully type it back in. Even the built in iOS phone dialer sucks. While you can paste you can't edit. So if you copy something off a webpage and because of the crappy smartphone copy/paste issues you get something like "dial:123-4556" there's no way to remove the "dial:" part. At best you have to paste into some other app that will let you edit, edit, then copy and paste again. Sheesh, does no one ever use this stuff?
- arethuza 11y agoIs there any reason at all for not allowing spaces in CC numbers or other long strings of digits?
- dfox 11y agoI tend to write applications such that spaces and dashes are removed on input from long strings of digits and then optionally re-added on display. But I've come across case where dashes and spaces (in this case in product's serial number) were significant.
- 1_player 11y agoAnother one is password restrictions: if I want to use a one-character password, that's my business. If I want to use my birthday as password, that's my business. If the app developer is concerned about security in case an attacker gets hold of the raw database, there are better tools for that (i.e. proper salting and hashing)
- ldjb 11y agoSalting and hashing isn't going to help you much if you're prone to using one-character passwords. Unfortunately, people will use one-character passwords if they are allowed to, so systems should require strong passwords to protect users. That's not to say there aren't problems with password restrictions, but they are mostly at the other end of the spectrum. For example, I have seen far too many systems requiring that passwords must be no longer than ten characters long, or only allowing a very small subset of characters.
- 1_player 11y ago> Salting and hashing isn't going to help you much if you're prone to using one-character passwords Why not? OK I'm no cryptographer, so I'm probably talking out of my arse but why not store a random salt PER user, and the hash of (password + salt)? To an attacker, a one character password will be as hard to crack as a complex one.
- deleted 11y ago[deleted]
- ldjb 11y agoAn attacker would still be able to brute-force the password in a split-second. Besides, if you're using the same one-character password for multiple systems, the password can easily be deduced on a system that only uses hashing (or a weak form of salting), and an attacker can use that password to access accounts on stronger systems.
- UK-AL 11y agoYou just try every character. A computer can do that in < 1 second.
- jrcii 11y ago> Try copying a number from Safari iOS into Google Hangouts Phone dialer. There's no paste option The paste option is there, however it's very tricky to get it to appear. You have to hold your finger down over the space where the number appears, but sometimes you have to try it 5-10 times to get the paste option to actually appear. Before Google Voice shut off external integration and ruined it I had an app called Talkatone which worked with Google Voice, Hangouts has never been as good as that app.
- deleted 11y ago[deleted]
- amelius 11y agoThat's why I think there should be an online resource with different types of UI elements, and their functional requirements. This way, when any developer feels the desire (or is forced to) reinvent the wheel, at least they can get a complete picture of all the requirements.
- thefastlane 11y agotry pasting into any facebook text-entry widget (e.g., chat). editing is completely broken. multi-paragraph text is chopped off when submitted. etc. rather amazing when you consider how much money software engineers make at that company.
- Loque 11y agoEngineers don't often get to chose the features they work on, or to what degree they get polished. If it amazed me, I would direct such amazement to the correct person :`D </attempt at humorous pedantry>
- thefastlane 11y agoyour point is well taken. software engineers are often subject to the whims of PMs and execs, and aren't always able to pursue the level of excellence they (the engineers) might prefer.