Why so many layers of abstraction?

Having problems with building or using the JCEF Java binding? Ask your questions here.

Why so many layers of abstraction?

Postby rigorberto » Sat Aug 29, 2020 9:44 am

I'm trying to implement a simple jar: scheme handler to be able to load files bundled within my application's .jar. I'm looking at the detailed example and I'm wondering why can't I just do it by calling a function like client.addSchemeHandler(scheme, handler). Why do I have to extend 5 or 6 different classes and interfaces to be able to accomplish a simple task like that?

I swear to god the example looks like the Hello World Enterprise Edition and I can't see a good reason for that. Is it a design feature of CEF itself?

Anyway I'm stuck with JCEF since the performance of JavaFX's webview is so abysmal and the application I'm building needs to have a version compatible with 32 bit linux builds, so there you have it.

Bear with my, I'm just annoyed that a task like this needs such a convoluted routine, so I may be acting dumb right now.
rigorberto
Newbie
 
Posts: 8
Joined: Sat Aug 29, 2020 9:36 am

Re: Why so many layers of abstraction?

Postby magreenblatt » Sat Aug 29, 2020 10:23 am

The project needs to support many use cases. You can use the existing APIs to create whatever interface you prefer for your own application.
magreenblatt
Site Admin
 
Posts: 12384
Joined: Fri May 29, 2009 6:57 pm

Re: Why so many layers of abstraction?

Postby rigorberto » Sat Aug 29, 2020 11:21 am

Does the current design choices help users accomplish those many user cases, or do they force them to jump through entreprise-grade OOP loops just because? Displaying a file from within the JAR is such a common task, I don't see a reason why making it complicated helps achieving other tasks.

Anyway, I found out that I can just call registerSchemeHandlerFactory on a CefApp instance, then I'll be able to load and display a single embedded file, but I'll have no way of loading any resources that are referenced by the embedded HTML. How many different interfaces and factories do I need to implement in order to be able to handle that?


Edit: just process the html file to add jar: in any src/href property. It just works. Good performance. Cumbersome API to say the least.
rigorberto
Newbie
 
Posts: 8
Joined: Sat Aug 29, 2020 9:36 am

Re: Why so many layers of abstraction?

Postby magreenblatt » Sat Aug 29, 2020 4:32 pm

Does the current design choices help users accomplish those many user cases

Yes, that’s the idea. It’s open source, so if you want something different feel free to make it.
magreenblatt
Site Admin
 
Posts: 12384
Joined: Fri May 29, 2009 6:57 pm


Return to JCEF Forum

Who is online

Users browsing this forum: No registered users and 16 guests