r/programming • • Mar 11 '13

Programming is terrible—Lessons learned from a life wasted. EMF2012

http://www.youtube.com/watch?v=csyL9EC0S0c
650 Upvotes

368 comments sorted by

View all comments

Show parent comments

-4

u/[deleted] Mar 11 '13

If you have the luxury of planning your data, you have the luxury of doing this the other way round.

Step 1) Write UI

Step 2) Write the data structures you end up needing

0

u/[deleted] Mar 11 '13

[deleted]

14

u/cha0s Mar 11 '13

H...hey :(

3

u/[deleted] Mar 11 '13

While reading the_opinion's post, I had the mental image of a guy in a kitchen who wants some water, so he turns on the sink faucet, and then starts looking around for a glass.

3

u/gammadistribution Mar 11 '13

You have to do it this way to get the water cold without wasting time sitting at the sink.

→ More replies (2)

14

u/[deleted] Mar 11 '13

Ideally, it's a virtuous cycle -- UX informs data, data informs UX. But, yes, I agree that UX should come first. If your data structures are designed without a notion of how the users will use your app, then, congratulations, you've written yet another program that will make people hate computers.

4

u/[deleted] Mar 11 '13

"Thinking about how users will use your app" is not nearly the same thing as "writing the UI."

Let's say I'm writing a calendar app. My users are probably gonna want to create appointments, edit details, see a month view, and want a list of upcoming appointments. Knowing what the user wants, I can start designing my data model to support those tasks - even if I haven't yet written one jot of the UX code that will eventually enable those tasks.

2

u/wvenable Mar 11 '13

Of course you design the data structures with the notion of how users will use the app! How else would you design them? That's really the point. Once the data structures are designed, the UI design becomes obvious.

13

u/syntax Mar 11 '13

Actually, to really do it well, you need 3 phases:

  1. Write UI

  2. Plan the data structures

  3. Write the glue code to connect the UI to the data.

By designing the UI separately, you ensure that the UI is designed with the user in mind, not around concerns for the programmer. (And yes, that does mean that it's more work).

By designing the data model in isolation, you get proper separation of concerns, and structured data.

The final phase can involve a small amount of complexity, but this is the trade off between having a good UI, and clean data model. It should be small, and localised.

You can rename these three phases to View, Model and Controller, if that's a useful mnemonic.

Note that this process is only useful if you need both a good data model and a good UI - if it's an internal app, I would do the data model first, then the UI, and be done with it - proper UI design is expensive, and thus only economic when it's a app for widespread use.

2

u/[deleted] Mar 11 '13

If it's an internal app, there's a very good chance the data model - and some actual data - already exists.

1

u/Reliant Mar 11 '13

I would agree with you if, by "write UI", you mean to conceptualize it. Once I have a concept of what the UI is going to look like in my head, I begin the actual development process by designing the database based on my concept of the UI. The actual writing of the UI happens in tandem with connecting the UI to the data.

2

u/syntax Mar 11 '13

It depends - if it's a single screen (and really a single screen), then a sketch on a piece of paper is normally fine.

However, the more complicated it gets, the more of an intereactive prototype you need, to allow for analysis of user interaction. That lets you chase out things like exactly when the user inputs certain parameters, and what feedback they need to move on to the next step.

It's a sliding scale of work needed - interestingly it doesn't seem to slide with how complicated the software is, but with how complicated the tasks the user does are. The larger the piece of software, the more chance there is for divergence between the two.

2

u/Reliant Mar 11 '13

A lot of that has very little to do with how the data is structured, and some of it is impossible to know until the app is fully developed and time has passed. I've done massive rewrites completely redesigning the entirety of the UI (not only in looks, but in also how it functions) without needing to change the data, while in other cases the tiniest change to a process required overhauling the data while hardly needing to touch the UI.

Every now and then, a UI change will come in that requires some restructuring of the data, but often these were impossible to predict because it involved changes in the business process.

I prefer to be willing to restructure the data as time passes to meet the changing needs, than be completely obsessed with getting it right the first time.

For me, when I talk about data, I'm referring specifically to the databases and the data it contains, including how they are organized in their respective tables. It's about getting the right depth between a piece of information having its own field or its own table.

1

u/alephnil Mar 11 '13

This way of doing it a classical waterfall process, where one step is completed before you start on the next one. This is the case either you start from the data structures or the UI. Both ways are wrong. In most cases when you do the second step, you realize that what you did in step one was wrong, and you must go back and do it over or at least refine it. This is an iterative project that eventually stabilize enough to ship a usable product

In any case, you forgot what you always should start with, namely "what problem am I going to solve". This always goes first, but is also iterative, just like the other steps.

-1

u/xvs Mar 11 '13

Sounds like what an annoying, clueless product manager would say.

You can't design the ui without knowing what the app actually is being built to do.

First come functionality decisions. Then you design the system to implement them. This probably includes designing most of the data model. The ui can then be whatever you like as long as it allows the functionality to be used.

17

u/[deleted] Mar 11 '13

All of this makes the massive assumption that the UI is just a pair of frilly knickers we slip on the real software, right at the end, as an afterthought.

It's that way of thinking that's kept people terrified of computing for decades.

5

u/[deleted] Mar 11 '13

You can't design the ui without knowing what the app actually is being built to do.

And you surely don't need data structures to know what the app is being built to do. Data structures are derived from functionality, not the other way around.

The ui can then be whatever you like as long as it allows the functionality to be used.

The same can be said about data structures. Also, no. The UI cannot be whatever usable. There are good UI designs and bad UI designs. Being determined by data structures does not help.

2

u/xvs Mar 11 '13

Dude, my point is that the functionality comes first, not the ui.

Sure the ui is super important. Anything you like means you're free to design a great one.

But don't design it before figuring out what the app should actually do.

1

u/[deleted] Mar 11 '13

You are right but I think I misunderstood you a bit. I agree, the order should be as follows:

  1. Functionality

  2. UI + data

Feasibility study in between.

→ More replies (4)

0

u/[deleted] Mar 11 '13

[deleted]

10

u/[deleted] Mar 11 '13

Why not? I'm genuinely asking for something more than "It went horribly wrong when I did it before", because I've seen the approach work more often than I've seen it fail. I'm guessing the entire UI was built before people started worrying about the supporting back-end, which yeh, is destined to fail. But bolting the UI on afterwards, whilst seemingly successful, is why we have so many awkward and unusable UIs in the world.

4

u/[deleted] Mar 11 '13 edited Mar 11 '13

Well, thought and consideration is needed for both steps, no matter the order. For instance, you build the UI of an address book, it all looks nice (based on your limited understanding of address books) and then you build a data structure with firstName, lastName, homepages, etc.

Then someone asks, can I get your stuff as FOAF? OK, let's update the data structure to use FOAF and be a bit more compliant. What does it say here..? Ah, some parts of the world have different understanding of first and last names.. so let's use givenName and familyName, and throw in just the freetext 'name'. (the "What should we call you" field.)

The UI is then updated with the more internationalized neutral terms, with a little script to automatically suggest the last based on the first two. The data model is then updated with a little tick-box to say if the user edited the 'name' or not; we might want to look at those later to see if they put in "Captain Spacey".

0

u/[deleted] Mar 11 '13

[deleted]

0

u/[deleted] Mar 11 '13

The problem won't magically conform to your data structures, either. Designing data structures isn't intrinsically any more rooted in reality than designing a UI. That's why incremental development of both is key.

0

u/[deleted] Mar 11 '13

[deleted]

→ More replies (9)
→ More replies (4)