r/AskProgramming • u/[deleted] • Apr 06 '21
Mobile How do developers get their UI to look exactly the same on mobile and inside the browser?
Forgive me for my beginner question, I don’t know a lot about mobile development but I would like to learn. I’ve always wondered how developers are able to make an app that has the exact same UI on a mobile device, and in the browser or even a desktop app (for example, Discord).
In addition, it’s interesting that the mobile apps can be look the exact same on an iPhone and an Android. I am aware that you can use flutter for this, but then, how do they build the web application that runs in the browser and looks so similar to the mobile app? How do they go further to build a desktop app that looks similar as well?
I would appreciate if someone could explain to me how this works. Do developers use different technologies or are they able to use the same frameworks and languages when developing for web and mobile.
Thanks
EDIT: I am not asking about the mobile-first approach (building a web app and testing it in the mobile browser) but I am instead asking how developers build web apps (browser) versus mobile apps (App store or Google Play) versus desktop apps (electron apps, QT, etc) that look exactly the same.
4
u/Actkeen Apr 06 '21
In short: they build everything using HTML/CSS/JavaScript (mostly in the form of a Js framework) and serve that same code a variety of ways to many platforms.
You eluded to electron in your other comment which is the main way I know that Js frameworks can be directly ran as a desktop application (with some minor tweaks). To get it on mobile, any browser can run any website obviously but they make mobile look just as good by changing the content depending on the viewport size. If you load reddit on a desktop browser and shrink it to the size of a phone, it will look exactly the same as on the phone. (I haven't actually tried this with reddit but im guessing that's the case, if not you can force desktop to look like mobile in dev tools). If you meant mobile as in native app, react native is just like electron but for mobile apps. I don't know much about that tho.
3
Apr 06 '21
I see. Yes I think I misworded my original question, by mobile I meant native (I didn’t know that’s what it was called). Thanks for your answer
5
u/lovesrayray2018 Apr 06 '21
Its called 'mobile first' development. The app is designed primarily to be used on a mobile device, and everything abt the UI is planned there-in.
The app may then be somewhat modified for a browser that has more viewport dimensions, but the UI can look largely the same.
-2
Apr 06 '21 edited Apr 11 '21
I am aware of mobile first, but this does not explain how developers take advantage of tools and technology in order to create an app (say from the App Store or Google Play) that looks exactly like a desktop app that runs on windows or even in a browser such as Firefox. Your answer makes sense but only explains the design process and I think you meant to only answer the question for browsers on a mobile phone and on a computer, but that was not my question. The question in my post is about mobile app vs desktop app vs web app...
How do they build a web app and a mobile app that look exactly the same? Does electronJS (how discord was built for example) also allow for mobile app development? That was my question in the post
EDIT: added some text
EDIT: Any reason why this is being downvoted? It's a genuine question.
7
u/mynameisdifferent Apr 06 '21
Developers can make apps developed on different platforms, using different technologies, look and feel the same. There's not really a good way to answer your question...
How do they build a web app and a mobile app that look exactly the same?
They just build it. Designers tell them what it needs to look like, and they build that in whatever platform or tool they are using.
A mobile app written in swift, or an android app written in Java, or React Native, a desktop app using electron or a website. They can all be made to look the same.
-1
Apr 06 '21
That’s interesting. I find it a difficult task to make the interfaces look so similar, as if they were built using the exact same tools. I wonder if there are technologies or frameworks that help them with this process.
4
u/mynameisdifferent Apr 06 '21
Not really, it's not that difficult on any of those platforms to implement almost any design a designer can dream up once you are relatively experienced. You are probably imagining it to be difficult because you are not an expert on at least two of those platforms.
The key is to have multiple experts on each platform working on it, it's rare that one person would be implementing the apps on different platforms.
You have to remember, these are large companies you are talking about with teams of developers, of course they will be able to implement things you or I would find difficult.
0
Apr 06 '21
You make a good point. But I’ve noticed that it’s still hard to capture the look and feel of even the simplest UIs that way (browser vs native app), like an Android app won’t really feel the same as a React app no matter how hard I try. I agree that a part of it has to do with not being an expert in the field but isn’t it also the underlying technology that’s different? Someone pointed out in a different comment that Discord is built with JS everywhere and that explains why it has the same look and feel. But an Android app made in Android studio with Java won’t feel similar.
Anyways maybe I’m fooling myself lol. You’re probably right
2
u/mynameisdifferent Apr 06 '21
Yes maybe with your example (Discord) many of the apps are written in Javascript and they use React Native / Electron so they can share code between platforms, but I promise you that isn't always the case.
Think of apps like Spotify, any Google App (Maps, Gmail, Keep, YouTube, ect.), Facebook will all use different tools an tech for different platforms, it won't just be javascript.
1
1
u/vegetablestew Apr 06 '21
Because web has established standards so it is similarly implemented across different browsers. The language is descriptive so that while implementations can be different, the end result are identical. Lastly the designs are parametric, UIs are not coded for a specific device, it is coded for a range of them and within each range they are just scaled versions of one another.
0
Apr 06 '21
You misunderstood my question. I will clarify what I am asking: I am not asking about web apps on computers vs web apps on mobile. I am asking about web app (browser no matter what device! Could be mobile or computer) versus mobile app versus desktop app. How can a developer make them look so similar?
I reiterate the example of Discord. How does that work?
4
u/vegetablestew Apr 06 '21
Because Electron is actually built from Chrome. So we use web tech to build desktop apps.
Discord iirc, is an Electron app.
1
Apr 06 '21
That would make sense. So they can make an electron app work both in the browsers and on the desktop? What about on mobile, though?
2
u/vegetablestew Apr 06 '21
Discord for mobile uses React Native, so it is also a web tech that gets compiled to Android iOS native apps.
2
Apr 06 '21
Ah, so at the end of the day it’s just all JavaScript
2
3
Apr 06 '21
Look into flutter if this is something you're interested in
Otherwise yeah, the designers design the app and its implemented to match exactly by the ui devs
2
1
u/Masaylighto Apr 06 '21
for ui it self depend on what tool you use if it was qt qml then just make it responsive and the size of everything measured according to the size of screen if it was flutter you really dont need to care about anything if it was js then the ui will be created with html and css so read about how to make a responsive website and the tools for that like Media query and flex and grid box and if you were talking about the app as whole then what you point at is cross platform app ant it depend on the language you use for example in cpp you can use qt and write the app one and deploy it to any platform if it was js use electron if it was python use pyqt and if it was c# wpf for desktop and xamren for android but you will need to write the app twice so making the ui looks the same ia depending on your effort Java is the same as c#
1
u/probablySunderee Apr 06 '21
Short answer: Flutter.
Long answer, typically you have a designer prepare application design for different form factors, and then you just implement both UI and business logic for a respective platform. That means web technologies on the web, and mobile technologies (Android, iOS) respectively.
With cross-platform tools nowadays, it's much easier. We're using Flutter because it solves our problems the best.
25
u/Icanteven______ Apr 06 '21
Speaking as a react centric web developer, we'll write the core app once, which takes care of mobile browsers, desktop browsers and desktop apps (via Electron), and then we'll slap a React Native view on top of it for Android and iOS. The react native parts are basically just a thin presentation layer on top of the abstract business logic so it's not horrible to upkeep.