News for hackers. Stuff that matters.
Re:Rawdrawandroid: Build Android apps in C by realharo on Sunday May 10, 2020 @04:58PM (#23136115)
If you mean Android Studio being slow (and the Android build system in general, with its many transform steps), that has little to do with Java itself.

Even IntelliJ IDEA, built on the same platform is much, much faster than AS (with non-Android projects).

Android Studio is just a slow IDE. 16 GB RAM and a good CPU is the absolute bare minimum for it these days for any non-trivial project, especially if you want to run the emulator as well.

Re:Rawdrawandroid: Build Android apps in C by benibela on Sunday May 10, 2020 @05:31PM (#23136399)
Yes, Android Studio (and the emulator)

The Android app development went from my first laptop with 4GB RAM and HDD to my second laptop with 8GB RAM and HDD to my current, third laptop with 16 GB RAM and SDD.

But all the laptops were really fast. I started writing Pascal code with Delphi under Windows 98 on a 166 MHz PC with 64 MB RAM or something, and it was fast enough

Re:Rawdrawandroid: Build Android apps in C by realharo on Sunday May 10, 2020 @06:10PM (#23136770)
I'm pretty sure Delphi also didn't have the same level of code navigation and inspections across the entire codebase (including resources, even from 3rd party libraries), or a built-in CPU/memory/network/energy profiler of the same quality, or layout previews that actually reflect the written code.

Android Studio is still slow even by today's standards, but that is not an apples-to-apples comparison. There are also some ways to make incremental debug builds faster (can be brought down to a few seconds for smaller changes, gradle can show which step takes how long).

Re:Rawdrawandroid: Build Android apps in C by jfkebwjsbx on Sunday May 10, 2020 @06:26PM (#23136878)
We have 3 orders of magnitude more computational resources than back then...

There is something very wrong with IDEs and complex applications these days.

Re:Rawdrawandroid: Build Android apps in C by realharo on Sunday May 10, 2020 @06:42PM (#23137011)
The same can be said about just about any software (plus again, AS is an exception, a typical IDE doesn't use anywhere near that much RAM - only few hundred MB to low GBs). Everything is bigger these days - web browsers show bigger web pages, photo editing software deals with much larger photos, etc. Today's cars and planes are also much more complex than the cars and planes from 100 years ago.

What it comes down to is, are the extra features provided by today's tools worth it? For most people, that's a no brainer.

As a random example, take auto import suggestions.

I can start typing 3 or 4 letters, and get a suggestion for a function name to call (and it's not just prefix search either, it is aware of words, etc.), then I just hit enter, and the function call is added to my code, plus the import statement is seamlessly added to the top of the file. I can see that function's documentation right then and there, navigate to its implementation and its usages inside a 3rd party library or just in my project, I get an immediate warning if I use it wrong or make a common mistake, etc.

Then you have languages like TypeScript that automatically narrow variable types based on the checks you perform around them. So if you have `if (user === undefined) { return }`, then it knows that below that block, `user` is definitely not `undefined` and the error reporting and autocomplete reflects that and doesn't complain. If you later remove that check, you'll immediately see red squiggly lines on code below it that broke because it can no longer rely on that assumption.

All of this requires having the code of my project and all of its dependencies indexed into a pretty verbose structure, but the productivity and reliability gains are 100% worth the extra bit of RAM and CPU time it takes - that's what it's there for.

Re:Rawdrawandroid: Build Android apps in C by IggleSniggle on Sunday May 10, 2020 @08:21PM (#23137598)
I love TypeScript. But let's not use it to excuse our present situation. OCaml shares many properties with TypeScript, especially when TypeScript is used in a functional way with inferred types propagating through the system. And the tooling for OCaml has run for a long time on vastly less powerful machines.

Just yesterday, VSCode had a UI lock for a good 5-10 seconds in a pretty small typescript project. It easily could have been some extension I had installed somewhere. But our current ecosystem solves for the combination of satisfying business managers (fast iteration) and developer enjoyment over producing long term stable and reliable programs that can run on minimal hardware.

Re:Rawdrawandroid: Build Android apps in C by mceachen on Monday May 11, 2020 @01:39AM (#23139196)
At the same time, I had typeahead find and completion for method and variable names back in the 90s with vi/emacs and exuberant ctags. It didn't need that much cpu or ram mojo. We tend to use whatever is available.
Re:Rawdrawandroid: Build Android apps in C by jfkebwjsbx on Monday May 11, 2020 @09:18AM (#23141759)
We were talking about code and IDEs, not media files.

Code completion, GUI designers and all sorts of fancy features already existed in IDEs 20 years ago.

You claim you have gained productivity, but coding a business app as a webpage or as an Electron app is not any faster than making it in VB6 or Delphi was. And the language were designed designed than JavaScript.

Re:Rawdrawandroid: Build Android apps in C by realharo on Monday May 11, 2020 @03:05PM (#23145713)
"Code completion" can mean many different things, from very basic features to more advanced ones. Many "lightweight" tools I've seen lack the more useful parts and offer only really basic completion.

For example if a function in a library I'm using is called `createUserWithSubscription`, and I start typing `usersub` anywhere in the project, it should offer that function near or at the top of the suggestion list, even if its location is not already imported/included in my current file. Things like that have a huge impact on easy discoverability of a library's functionality, which in turn has a huge impact on productivity and speed of adopting new technology.

If I just press Ctrl+space while the cursor is inside a function call, without typing anything, it should offer suggestions based on what other code passes into that function, or suggestions based on the type of the argument, etc. I don't recall these things from 20 years ago. And that is still just one of the features.

>coding a business app as a webpage or as an Electron app is not any faster than making it in VB6 or Delphi was

I would say it is. Of course the apps made today are very different from the apps back then, but making UI that displays data is much easier.

Re:Rawdrawandroid: Build Android apps in C by jfkebwjsbx on Monday May 11, 2020 @07:11PM (#23148368)
The kind of features you are describing existed two decades ago, in several IDEs, in one way or another, and for the most part do not require huge amounts of CPU/memory. Definitely not 2 orders of magnitude more.

> Of course the apps made today are very different from the apps back then, but making UI that displays data is much easier.

How so? Both VB6 and Delphi were designed to display and edit data quickly. Its main use case was creating business apps very quickly and both had WYSIWYG GUI designers in the IDE itself!

There were menus, buttons, lists, tables, tree displays, rich-text editors and many other ready-to-use controls. You had adaptors for different databases, OLE for embedded documents, COM support, etc. You could display images, video, sound too. Even commercial games were developed on them.

Re:Rawdrawandroid: Build Android apps in C by realharo on Tuesday May 12, 2020 @07:17AM (#23152767)
None of that matters when once you need to display a list of items (where every item has its own group of UI widgets), you have to start dealing with a whole bunch of clunky model wrappers, and even basic features like sorting and filtering require special care. Not to mention keeping all the UI in sync when one piece of data that is displayed in more than one place changes.

Instead of just doing

    <>
      <h1>List of items</h1>
      {items
        .filter(itemFilter)
        .map(item => <div>
            {/* UI for the individual item, e.g. name,
                subtitle, icon, buttons, etc. */ }
        </div>)}
    </>
that also keeps the displayed data current no matter what - new data comes in from network, the filter in the search textbox changes, it all stays in sync...
Re:Rawdrawandroid: Build Android apps in C by jfkebwjsbx on Tuesday May 12, 2020 @10:22AM (#23154272)
I don't understand what you are talking about. What is so special about receiving data and displaying UI controls from it?

Networked apps, business apps, database frontends, etc. have been a thing since the 80’s, and I am not even talking about that but IDEs from the 90’s and later.

The code you show is identical to what was done back then in many languages, many frameworks and many systems. Filtering, sorting, per-item UI, multi-views, synchronization, etc. has been always a basic need.

The web is yet another UI/app framework. Nothing less, nothing more.

Re:Rawdrawandroid: Build Android apps in C by realharo on Tuesday May 12, 2020 @10:26AM (#23154315)
My point is that in environments like old-school Delphi or VB, or even with frameworks like Qt, those things take way more effort and boilerplate code than they should.

For exapmle in Qt you have to either subclass QAbstractListModel or use QStandardItemModel with weird QStandardItem wrappers around your data, then you have QSortFilterProxyModel (https://doc.qt.io/qt-5/qsortfilterproxymodel.html) and all that weirdness. And then for the actual UI of the individual items, you have QAbstractItemDelegate, etc. https://doc.qt.io/qt-5/qabstractitemdelegate.html

I mean, just look at this example: https://doc.qt.io/qt-5/qtwidgets-itemviews-stardelegate-exam...

No way that should take that much code.

Re:Rawdrawandroid: Build Android apps in C by jfkebwjsbx on Tuesday May 12, 2020 @10:39AM (#23154487)
If you say so. I have worked professionally in quite a few UI frameworks and they are pretty much the same.

The web is actually one of the most complex ones out there due to the never ending frameworks and libraries that come into fashion every other year. Old environments had a defined set of things to use and learn and things were stable for many years.

In Qt you can build your UI on the fly with code without using those classes if that is what you are asking.

Re:Rawdrawandroid: Build Android apps in C by realharo on Tuesday May 12, 2020 @11:48AM (#23155311)
I doubt I could build something like this

https://codesandbox.io/s/eloquent-spence-d51td?file=/src/App...

in Qt or one of the "old school" desktop tools as quickly as I just did in a few minutes, that loads data from the web (mock) and displays them in this way (and has this level of flexibility for further development). There's just no way.

Re:Rawdrawandroid: Build Android apps in C by detaro on Tuesday May 12, 2020 @11:54AM (#23155412)
Hows the code in that link fundamentally different from what you'd write in e.g. Qt's QML?
Re:Rawdrawandroid: Build Android apps in C by realharo on Tuesday May 12, 2020 @12:06PM (#23155594)
One difference is that you can just use data directly as it comes from the net (or combine it with any other data in your application).

You don't have to wrap it in models like this https://doc.qt.io/qt-5/qtquick-modelviewsdata-modelview.html and then either recalculate that when the data changes or have a custom model class that does it. Though granted that is still a huge improvement over doing this in regular Qt Widgets (see the star example a few comments above), or one of the "old school" desktop GUI builders. This difference would be felt even more if the items also had some interactivity with state (e.g. expanded/collapsed things in them, lazy loaded extra info etc.)

One consequence of the way rendering works is that I can just use language-native constructs like `if` or the ternary operator to either include or not include the "Top poster" line in the example. Instead of having to do something like this https://stackoverflow.com/questions/27695717/conditionally-i.... Similarly, you can use map/filter on arrays, transform the data more easily before rendering it, etc.

Another difference is that JS/TS is the main language of the entire app, not a separate DSL that you can use for some parts and not for others. You can use async/await, have the entire npm ecosystem available, etc.

Though QML is still hell of a lot better in this regard than old school VB or Delphi used to be.

Re:Rawdrawandroid: Build Android apps in C by rs23296008n1 on Monday May 11, 2020 @10:32AM (#23142542)
Pretty sure it does. Delphi can be used to build its own components and the inspectors will pick up properties etc automatically. Compile time is a lot faster as well.

Creating GUIs, including resizeable windows and controls was not only possible but relatively easy.