cancel
Showing results for 
Search instead for 
Did you mean: 

View Development Paradigm - which one?

Former Member
0 Kudos

Hi All,

I suspect this has been discussed before but I can't see the wood for the trees at the moment...  I'm taking my first proper steps in SAPUI5 development in anger and wondered if there is a preferred view type?  Is there a pro's/con's document or some sort of decision tree to help decide which paradigm to go for?

If it helps, I'm more used to working with JavaScript and HTML so would naturally tend towards one of those.  JS looks especially similar to how many other SAP UI technology has worked in the past in my mind so looks to be easier for me to get into but am happy to be guided...

Thanks,

Gareth.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Thanks everyone for your thoughts and comments.

Most answers pretty much summed up where I'd got to in my own head, and that a lot of the choice was down to personal preference.  However, I quite like ' point about XML views being the paradigm of choice for Fiori and I guess ultimately, it was this sort of guidance I was hoping for.

After only a short amount of meddling with SAPUI5 I'm realising one of it's key strengths - flexibility - is also a challenge as it makes the decision on "best approach" more difficult.  Maybe I'm spending too much time worrying about how best to structure an application and instead should just crack on and get coding?!

I'm now lost in a world of confusion around Application.js files and other such stuff - my OCD about the "best" way to build something is stopping me getting going

Gareth.

qmacro
Developer Advocate
Developer Advocate
0 Kudos

Be warned that the Application(.js)-based approach is being deprecated in favour of the Component based approach. Have a look at the quick run-through of a typical Fiori app here to get a feel for it.

Former Member
0 Kudos

DJ - thanks very much.  I've just learnt more in ~11mins of watching that video than 2 days of random hacking

Answers (8)

Answers (8)

former_member182048
Active Contributor
0 Kudos

Hi Gareth,

Better late than never.


If you are developing a desktop application JavaScript views IMO are the way to go.


Desktop applications will more than likely require lots of views. The views may not be form based and may need dynamic content or use conditional rendering, use data from multiple models, from multiple backends, use controls from multiple libraries.


I know that all of those things can be catered for outside of the view.


For me the compelling reason to use javascript views on desktop applications is I can debug the code at runtime, seeing the code allows you to quickly understand the intent of the developer when it was written.


cheers

jsp


This blog is worth reading http://scn.sap.com/community/developer-center/front-end/blog/2013/03/19/how-to-build-testable-sapui5...

Former Member
0 Kudos

Hi John,

Thanks for this further input to the discussion.

In my head, I agree wholeheartedly with your comment about desktop app's suiting JS development better.  It just feels more natural even with my very limited early meddling so far.  I guess that as I've worked with BSP, JSP, Web Dynpro, HTMLB, etc. it is also familiar in places too which helps.  Countering that though, I agree with DJ's recommendation of following SAP's Fiori like approach of using XML views.  Ultimately I suppose there is no 100% right or wrong answer at the moment, and may never be with this technology.

I was working on a dummy app and corresponding blog post last night, that hopefully will make use of dynamic and conditional rendering and content as you mention, which I'm building in JS as I couldn't figure out where/how to start with XML views!

I've seen that blog posting before but will re-read it.  I'll also hopefully chuck my blog posting up (really a collection of random questions and naive optimism ) later today too!

Cheers,

Gareth.

former_member182048
Active Contributor
0 Kudos

Hi Gareth,

Look forward to the blog.

I agree with DJ for Fiori like apps XML views are the preferred approach.

With every iteration of the UI5 library developing mobile applications feels more and more like developing native applications, I think that is a good thing as IMO the 2 paradigms are likely to converge.

What I have noticed with the OpenUI5 library is the Fiori2 developments have been taken away, the ushell, scaffolding, launchpad, dashboard, catalog etc. I can kind of understand why. I really hope they get put back, its one thing to develop an application that looks like Fiori, its another to develop an app that works like Fiori, I think everybody wants an ecosystem where thirdparty developers write Fiori apps.

Btw before they dissapeared from the sdk the launchpad, dashboad, catalog etc looked like they were written in jsViews.

Cheers

jsp

Former Member
0 Kudos

In my opinion, JavaScript views give by far the most flexibility.  If you are comfortable with JavaScript, it is worth taking the time to learn how to implement JS views - it is not that difficult.

Walter

AndreasKunz
Advisor
Advisor
0 Kudos

Hi,

the MVC documentation has also a section describing the advantages and disadvantages of each View type.

https://openui5.hana.ondemand.com/docs/guide/MVC.html

(check the third section)

Regards

Andreas

qmacro
Developer Advocate
Developer Advocate
0 Kudos

Ok, here's another opinion 🙂

With the current waves of Fiori apps being delivered with XML views, that's one big reason to write your own apps in XML views too - to become acquainted with that declarative method of defining views, so you are then more ready to understand and modify (extend) SAP-delivered apps in the future as a bonus.

Plus IMHO the declarative nature of the XML views have some advantages which I touch on here a bit too:

Yes, there are HTML views that are also declarative, but more verbose than their XML equivalents.

Finally, I think it's OK to reveal that the upcoming version of the sap.m Explored app will have XML view code for all the samples 🙂

Go for XML views and build apps like the Fiori development teams!

dj

surendra_pamidi
Contributor
0 Kudos

Hi Gareth,

With Javascript as view you can include javascript files.

With Html as view type you can include HTML file also.

With XML as view you can do some xml operations(editor tools prefer working with well-structured XML).

Because you are in initial stage you can go with JavaScript as view for better understanding.

former_member182650
Contributor
0 Kudos

Hi Gareth!

From my understanding I think JS is better basically because SAPUI5 has more examples in this view type. Also, it seems SAP cloud sites like HANA Cloud PortalPortal por HANA Cloud Platform are developed with JS views may be this could be an answer

Kind regards

Former Member
0 Kudos

Hi Gareth,

take a look at this document:

SAPUI5 SDK - Demo Kit

"When to use which view type"

Use the one you have the most expertise.

Most flexible is JavaScript. JSON is an easy way. XML is easy, too, but more flexible than JSON. HTML is supported, but still in early stages.

Best regards,

Tobias

kammaje_cis
Active Contributor
0 Kudos

Hi Ryan,

Did you look at this. Andreas has some real good info here.

Krishna