Surely MDI not so bad? [closed] - mdi

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 12 years ago.
Surely MDI not so bad?
I have an ERP-type app and I have chosen a MDI UI model. The reason for this is to enable the user to multitask.
Yes, many say that a user cannot multitask, but hear me out.
My app has several modules or functional areas e.g. Admin, Pricelists, Sakes Orders, Production, Stock Shipping, etc.
I chose to create a MDI parent window for the main app window with a toolbar button for each module.
So let's say the user wants to create a Sales Order. He clicks the Sales Order button on the main toolbar and the
Sales Order window appears. This is a MDI child that allows the user to create and edit a sales order and perform
some functions on it e.g. Post, Accept, etc. So, if you are in the middle of creating a sales order and you need
to change a pricelist or add some reference data you need in the SO, you simply open that module from the toolbar
without having to abandon the SO. You cannot accept the SO, because it could violate business rules.
My app is not MDI in the sense of editing more than one document of the same kind like XLS or Word. The modules each
have their own MDI child window.
Comments would be appreciated.

MDI is not bad. It is just pointless nowadays. SDI (Single Document interface) with nice docking manager and good tabs support is sufficient enough.
Look at your IDE for example. I am almost sure that it is SDI (like Visual Studio, Delphi, Eclipse, Net Beans, etc.)

There's nothing wrong with MDI if you have good reasons for doing so. However, the reasons you have expressed are not really valid reasons to choose MDI in my opinion. You can just as easily do what you want with SDI popup windows, so long as they are non-modal.
The disadvantage of MDI is that it doesn't work very well in multiple monitor situations. The advantage of MDI is that it provides lots of nice child window management features (ctrl-tab, etc..) that you would have to emulate in SDI.
I'm not saying that MDI is bad, or that it is bad for your circumstances, but simply being able to work with more than one window at a time is not a reason to choose MDI.

Related

Why is subclassing undesirable? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
Why does the UIApplication class need a delegate to have "things" done on its behalf? Why can't this class do "things" directly without the need for an intermediate object such as a delegate? What is the purpose of that principle?
In the same way I ask myself: why isn't it possible to directly access the keyboard in order to dismiss it? Why is there a need for signaling the view controller as a delegate in order to resign first responder?
Delegation is a core design pattern. It allows for the seperation of responsibilities between parts of your program. The idea is that the part of your program that, for example, draws to the screen probably shouldn't be talking to your database. There are several reasons for this:
Performance: if the same object that draws to the screen access your data store, you're going to run into performance problems. Period. Full stop.
Code maintanence: it's easier to conceptualize code that is properly modularized. (For me, anyway)
Flexibility: If you subclass in your code, that's great - until you start running into monolithic classes that have all sorts of undesired behavior. You'll reach the point where you have to overload behaviors to turn things off, and your property namespace can become polluted. Try categories, delegatation, and blocks for altrnatives. As king Solomon says in Ecclesiastes, paraphrased: There's a time and place for everything under the sun.
To make it easier to write, read, iterate upon, and maintain your program, it is strongly advised that you follow certain practices. You're welcome to subclass many classes, and Apple won't reject your app for poor code, provided that it runs as advertised. That said, if you don't abide by specific tried and true practices, you're digging your own grave. Sub passing isn't inherently bad, but categories, protocols, and blocks are so fascinating, that I'd prefer them anyway.
Why is subclassing undesirable?
Subclassing isn't undesirable. It's just that it's not always the right solution, and it's often better to use composition instead of inheritance. Lots has been written on this on Stack Overflow already, to the point that your title puts this question in danger of being closed as a duplicate. Rather than trying to repeat, I'll just point to one of the more popular questions covering this topic: Prefer composition over inheritance?
Why does the UIApplication class need a delegate to have "things" done
on its behalf? Why can't this class do "things" directly without the
need for an intermediate object such as a delegate? What is the
purpose of that principle?
It provides a much looser coupling that allows Apple to change or replace the application object without breaking existing code.
Delegates are very useful but they also have their place and time. It is also very possible to go about without using delegates. There are certain instances though, where delegates are important. For instance, when you use the uiTextview delegate, it is important for the controlling class to know when the text changes so it can handle it. And, because different classes may want to handle this event in different ways (limit characters, capitalize letters, etc) its easiest to use a delegate.
You may be saying: Yes, but why not just make a subclass with desired behavior? Well, this is possible, but there are a few reasons why you should not proceed this way. Firstly, you may override a behavior that is happening before the delegate is called. Next, it can be dangerous because you might accidentally override a function which was necessary. Third, it is a lot more work and more code, so it will be harder to debug. Imagine you have a form with 100 textboxes and they all have different behaviours. you would not want to create 100 subclasses... its much easier to do a switch case and delegate appropriately.

Developing Data and User Models :: Tools / Best Practices / Approaches [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I'm finding that it's difficult to clearly articulate the specific models I want to create at times - especially as projects get bigger and I have to wrap my head around the relationships between everything.
How do you organize your data and user models? Do you sketch them out on paper? Maybe there's a neat tool online?
Yep, I believe good old pencil and paper are the tools to use for that. Keeping in mind that eventually your models will access the database through an object relational mapper, you should think in relations.
Mostly, it is worthwhile to think in relations first and then figure out names for your models. Consider the following case where you need something that stores the following:
posts need to be stored
comments need to be stored
users have to be stored
Now, before you think about how you name each of these, rather think about how they are related. I find that mostly by doing that, you will choose the right names intuitively:
A post belongs to a user, a user has many posts, a comment belongs to a post, a post has many comments, a user has many comments, a comment belongs to a user.
In this last rather intuitive sentence, you have everything you need: names and relations. Rails supports this intuition because it is so idiomatic.
This is as far as planning databases and models goes - if you have an existing application and need to figure out the models' relations, I recommend using a UML (unified modelling language) gem called railroady, which will automatically create a nice graphical overview of your application's data.
I find visualisation to be a huge help in establishing a data model and working on data flow diagrams etc.. Pencil and paper has never worked for me because I get all neatness obsessed and hate making changes and redoing things, and I also don't want to get distracted by moving little boxes around on a screen to make them look nice as it breaks the "creative flow".
I've used GraphViz http://www.graphviz.org/ for this in the past for a number of reasons.
First, I've worked for a lot of companies too cheap to spend money on any software that might accidentally help software development.
Secondly, the text input is distraction free -- it lets you concentrate on content without the distractions. The text input can also be generated by code, so it's been great for (semi)automatic code and schema visualisation.
Third, the input text can be added to the source code repository and commented and change-tracked.
I recently discovered http://graphviz-dev.appspot.com/ which has made it even easier -- don't forget to click on them ad links.

Correct approach for gathering data with jQuery Mobile [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I need to adapt a Ruby on Rails (v2.3.12) app to gather data via a mobile web interface. We would prefer to not have to build a client app using PhoneGap, Appcelerator, etc. I've looked at the mobile web toolkits and jQuery Mobile seems to be a relatively straightforward way to do what we want to do.
We have a basic workflow/design done, as a series of single pages. The targeted users require this to be SUPER simple. I need to gather master detail data in the following manner:
Step 1 - 2 data elements (master page)
Step 2 - enter 2 data elements and a NEXT and a DONE button (detail page)
Step 3 - enter data in 1-3 data elements and a NEXT button (detail page)
Once next is clicked on Step 3, we go back to Step 2 and repeat. If done, Click DONE and flow goes back to Step 1. Once DONE is clicked, I want to be able to POST all of the data back to the Rails app.
This is my first mobile app, so I'm not sure of the best approach to take to save data on those detail pages before I am finished gathering data. This may also not be an appropriate approach to take for this kind of app. Either way, I'm hoping for some guidance. Thanks!
I'd keep things super simple by handling the whole thing in a single form with dynamically generated inputs.
Each time the Next/Done button is pushed you hide the current set of inputs and create some new ones (using js) that are appropriately named. I'd use arrays to keep everything organized.
When all the data has been entered the form can be submitted as usual and everything gets sent off to your Rails app in one POST.

Why Asp.net MVC and not Asp.net MVP [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
As far as theory goes it seems that Asp.net MVC framework could better be described as an MVP software pattern... Why not?
Because as it seems to me I see Asp.net MVC as a framework that has functional views (scripts running) that invoke controller actions. So it seems views are masters.
There are two distinct differences (taken from source):
Passive View:
The View is as dumb as possible and contains almost zero logic. The Presenter is a middle man that talks to the View and the Model. The View and Model are completely shielded from one another. The Model may raise events, but the Presenter subscribes to them for updating the View. In Passive View there is no direct data binding, instead the View exposes setter properties which the Presenter uses to set the data. All state is managed in the Presenter and not the View.
Pro: maximum testability surface; clean separation of the View and Model
Con: more work (for example all the setter properties) as you are doing all the data binding yourself.
Supervising Controller:
The Presenter handles user gestures. The View binds to the Model directly through data binding. In this case it's the Presenter's job to pass off the Model to the View so that it can bind to it. The Presenter will also contain logic for gestures like pressing a button, navigation, etc.
Pro: by leveraging databinding the amount of code is reduced.
Con: there's less testable surface (because of data binding), and there's less encapsulation in the View since it talks directly to the Model.
See this question: What are MVP and MVC and what is the difference?

Couple of questions about asp.net MVC view model patterns [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I'm new to MVC.
I have read this short bit detailing three ways of dealing with the view model in MVC:
http://geekswithblogs.net/michelotti/archive/2009/10/25/asp.net-mvc-view-model-patterns.aspx
The gist of it seems to me that:
Method 1, pull an object out the database and use it as your view model. Quick and simple, but if you want data from multiple tables you're totally screwed (I can't think of a way around it without Method 2).
Method 2, create a class that has references to multiple objects, and use this as your view model. This way you can access everything you need. The article says that when views become complicated it breaks down due to impedance mismatch between domain/view model objects... I don't understand what this means. Googling impedance mismatch returned a lot of stuff, the gist of it being that you're representing database stuff using objects and stuff doesn't map across cleanly, but you'd presumably have this problem even with Method 1. Not sure what I am missing. Also seems to me that creating a class for each View to get the data you want isn't ideal from a maintenance point of view, not sure if you have a choice.
Method 3, I am still getting my head around it, but I don't quite understand why their checkbox example wouldn't work in method 2, if you added a bool addAdditional to your class that wasn't connected to the domain model.
Method 3 seems to say rather than return the domain stuff directly, just pull out the properties you specifically need, which I think is nicer but is gonna be harder to maintain since you'll need some big constructors that do this.x = domain.x, this.y = domain.y etc.
I don't understand the builder, specifically why the interface is used, but will keep working on it.
Edit: I just realised this isn't really a question, my question is, is my thinking correct?
The problem I've run into with #2 is that I have to do one of these two things:
Include every single field on every single object on the form -- those that aren't going to be displayed need to be included but hidden.
Only include the specific fields I need but use AutoMapper or something similar to map these fields back onto the actual objects.
So with #2 I see a mismatch between what I want to do and what I'm required to do. If we move on to #3, this mismatch is removed (from what I understand, briefly glanced at it). It also fixes the problem that a determined hacker could submit values like id fields or similar when using method #2 that unless I was very careful could be written to my data store. In other words, it is possible to update anything on any of the objects unless one is very careful.
With method #3 you can use AutoMapper or similar to do the dirty work of mapping the custom object to the data store objects without worrying about the security issues/impedance exposed by method #2 (see comment for more details on security issues with #2).
You're probably right about impedance mismatch being present in both Methods 1 and 2 - it shows up anywhere you're going between objects in code and DB objects with relational mapping. Jeff Atwood writes about it, and cites this article, which is a fantastic discussion of everything dealing with Object-Relational mapping, or "The Vietnam of Computer Science". What you'll pretty much end up doing is weighing the pros and cons of all these approaches and choose the one that sounds like it fits your needs the best, then later realizing you chose the wrong one. Or perhaps you're luckier than I am and can get it right the first go 'round. Either way, it's a hairy problem.

Resources