Mark is exactly right in what I'm trying to say.

The point I'm making is a REST Web Service is directly interchangeable
with ODBC/JDBC access, NoSQL, or even a CSV data store.


If that's true, shouldn't there be some examples of utilizing REST web services available in tutorials or reference >documentation pertaining to the MVC frameworks in question? If so, I haven't been able to find it. I have seen ODBC/JDBC and >CSV implementations.

Documentation and tutorials for MVC frameworks will (and should) only cover the MVC framework. If you want to read documentation on how to consume REST APIs you should refer to tutorials and documentation of an HTTP client package such as Guzzle [1][2]. So essentially instead of using a database abstraction layer (DBAL) such as ZendDB [3][4] and DoctrineDBAL [5][6] or an ORM such as DoctrineORM [7][8] you would use an HTTP client package. Both methods would return your results and you are free to do whatever you wish with it. But as far as where you would use each of these, that does not change nor would the rest of your code, because they are interchangeable and only a part of the "M"odel in an MVC Framework.

Think is it as Scott Klement's HTTPAPI package. You won't find documentation on how to use it in RPG on Developer Works or an RPG textbook. But that doesn't mean you can't use it in place of embedded SQL in your programs.

Also, just to reiterate, hydrating the returned results into an object is what is typically done. But so long as your consistent in what your Mapper returns the rest of your code can remain the same, which is one of the primary purposes of using an MVC paradigm.


The purpose of MVC is to separate your data access method from your
presentation layer. Rest Web Services do not however replace the
"M"odel in MVC, they are simply used by the Model layer the same way
ODBC/JDBC access is.


I understand the purpose of MVC. But I'm having difficulty understanding whether you may be talking about how MVC conceptually >might work vs. what's actually implemented in MVC frameworks.

You are correct in that not all MVC frameworks provide an HTTP Client package of their own (hence why there wouldn't be documentation on it). But that doesn't mean you can't use an HTTP Client package such as Guzzle[1][2] in an MVC framework. If an MVC framework locked me in to only their packages, I probably wouldn't use it. In short, I'm talking about how MVC frameworks allow you to access data in whatever method you see fit. That doesn't mean you're replacing the "M"odel aspect by using certain data access methods over others. It just means you're accessing you data through a different medium from within your "M"odel in the MVC framework.

[1] https://packagist.org/packages/guzzlehttp/guzzle
[2] http://docs.guzzlephp.org/en/stable/
[3] https://packagist.org/packages/zendframework/zend-db
[4] https://docs.zendframework.com/zend-db/
[5] https://packagist.org/packages/doctrine/dbal
[6] https://www.doctrine-project.org/projects/dbal.html
[7] https://packagist.org/packages/doctrine/orm
[8] https://www.doctrine-project.org/projects/orm.html



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.