Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #30428

Re: MVC Partner

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail
From Martin Gregorie <martin@address-in-sig.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: MVC Partner
Date Wed, 26 Nov 2014 23:22:59 +0000 (UTC)
Organization A noiseless patient Spider
Lines 74
Message-ID <m55ncj$85l$1@dont-email.me> (permalink)
References <986bdeb7-709c-4e79-91e6-1b31771f7d06@googlegroups.com> <54763070$0$293$14726298@news.sunsite.dk> <997e9d63-8e7e-4ff5-b892-69bd4fbe2318@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
Injection-Date Wed, 26 Nov 2014 23:22:59 +0000 (UTC)
Injection-Info mx02.eternal-september.org; posting-host="e5160e2be48f1ea550cf61512446f525"; logging-data="8373"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/UtoADZnxClGctnDm/FzPem+TGt+l3IZ4="
User-Agent Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2)
Cancel-Lock sha1:Ag2u7sD6CyzZ4j5tRCX7CqZp33s=
Xref csiph.com comp.lang.java.programmer:30428

Show key headers only | View raw


On Wed, 26 Nov 2014 14:54:13 -0800, Leonan Luppi wrote:

> Em quarta-feira, 26 de novembro de 2014 17h56min41s UTC-2, Arne Vajhøj 
> escreveu:
>> On 11/26/2014 2:16 PM, Leonan Luppi wrote:
>> > I have some doubt about MVC. Someone could solve please?
>> >
>> > So for my "M" it's need to be my mirror of DB (Entity mapped my JPA
>> > for example)?
>> >
>> > For my "V" it's need to be interfaces which only show and send to my
>> > controller?
>> >
>> > For my "C" it's need to be all business rules, calling my DAO to
>> > result from DB ?
>> >
>> > Someone can give an example please?
>> 
>> I would say:
>> 
>> M = interface to business logic V = display to user C = handling of
>> user actions
>> 
>> Also see
>> http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller !
>> 
>> Arne
> 
> Arne,
> 
> Ok, but if 'M' is my business logic. Where can i put my Entity's?
>
Everything that isn't GUI-related goes in the Model. 

The Model manages connections to databases, external systems, etc that it 
uses to establish its internal state. When changes are input, the Model 
uses them to update itself and any external data sources that record the 
changes. Similarly, data requests may cause the Model to retrieve data 
from the external sources and trigger a View refresh via the Controller 
so the data gets displayed.  

> And the 'V' i understand to display interfaces,
>
The layout and all code connected with formatting data for display, and 
accepting input from the user (menus, buttons, TestAreas, JTables etc., 
i.e. all the Swing or JavaFX objects go in the View. The only logic it 
contains is for managing the display and passing user input to the Model.

> but where can i send
> information to handle on controller?
>
AFAICT, stuff that the Model needs to know (user inputs that affect its 
state, database query requests, etc can be passed directly to it from the 
View. 

The Controller is triggered by the Model whenever the View should be 
refreshed to display changes in the Model. It is responsible for sending 
all relevant changes to the View, which is then colely responsible for 
presenting them to the user.

> like send my username and password
> to do logIn.
>
The View accepts this input and passes it to the Model, which uses it to 
login to the database and whatever other resources it needs to support 
its internal state. It then sets up its initial state and causes the 
Controller to refresh the View so you see whether the login was 
successful and, if so, shows you the initial Model state.


-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

MVC Partner Leonan Luppi <leonan.luppi@gmail.com> - 2014-11-26 11:16 -0800
  Re: MVC Partner Arne Vajhøj <arne@vajhoej.dk> - 2014-11-26 14:56 -0500
    Re: MVC Partner Leonan Luppi <leonan.luppi@gmail.com> - 2014-11-26 14:54 -0800
      Re: MVC Partner Arne Vajhøj <arne@vajhoej.dk> - 2014-11-26 18:07 -0500
      Re: MVC Partner Martin Gregorie <martin@address-in-sig.invalid> - 2014-11-26 23:22 +0000
  Re: MVC Partner lipska the kat <lipskathekat@example.com> - 2014-11-26 20:40 +0000
    Re: MVC Partner Leonan Luppi <leonan.luppi@gmail.com> - 2014-11-26 15:01 -0800
      Re: MVC Partner lipska the kat <lipskathekat@example.com> - 2014-11-27 08:56 +0000

csiph-web