We need to talk about Gradle

The aim of this channel is to document the working practices of a half-decent software developer, so I pretty much show all the changes that I make to the source code of a project.

There is one exception to this convention; which is that I don’t subject you to the chores that are required to keep the build up to date. I upgrade versions, fiddle to make things faster, and sometimes even upgrade Gradle itself, all on my own time.

Today though I tried to modify the build of the JetBrains Ktor example project that we have been studying in recent videos (https://ktor.io/docs/server-create-http-apis.html). I just wanted to get it to build and run on JDK 21, so that I could run benchmarks with Loom virtual threads.

I failed.

As failing to get Gradle to just do something is, in my experience, part of the working practices of a half-decent software developer, I’ve decided to make an exception to my exception and publish the attempt.

I’m probably missing something obvious. Maybe I just need to RTFM? No doubt there is a solution, but the sad fact is that where Gradle is concerned, even my 35 years of industry experience isn’t enough to keep me from stumbling around in the dark.

If you like this, you’ll probably like my book Java to Kotlin, A Refactoring Guidebook (http://java-to-kotlin.dev). It’s about far more than just the syntax differences between the languages – it shows how to upgrade your thinking to a more functional style.

submitted by /u/dmcg
[link] [comments]

Continue ReadingWe need to talk about Gradle

Which is a better design of data class in the following case – using val or var?

Hello all. I was wondering, which is a better design of data class in the following case?

Using var

 data class TabInfo(var syncTimestamp: Long) fun main() { val tabInfos = listOf(TabInfo(999)) // Update the timestamp for (i in 0 until tabInfos.size) { val mutableTabInfo = tabInfos[i] mutableTabInfo.syncTimestamp = System.currentTimeMillis() // Corrected property name } // Print the updated timestamps for (i in 0 until tabInfos.size) { val mutableTabInfo = tabInfos[i] println(mutableTabInfo.syncTimestamp) } } 

Using val

 data class TabInfo(val syncTimestamp: Long) fun main() { val tabInfos = mutableListOf(TabInfo(999)) // Update the timestamp for (i in 0 until tabInfos.size) { val mutableTabInfo = tabInfos[i] tabInfos[i] = mutableTabInfo.copy(syncTimestamp = System.currentTimeMillis()) // Corrected property name } // Print the updated timestamps for (i in 0 until tabInfos.size) { val mutableTabInfo = tabInfos[i] println(mutableTabInfo.syncTimestamp) } } 

I know the good of using immutable class design – https://stackoverflow.com/questions/3769607/why-do-we-need-immutable-class

However, for a properties member which will be updated frequently, will it better to use var?

submitted by /u/yccheok
[link] [comments]

Continue ReadingWhich is a better design of data class in the following case – using val or var?

Kotlin Foundation Secures 5 Contributor Projects for GSoC 2024

All the projects the Kotlin Foundation submitted for Google Summer of Code 2024 have been accepted! GSoC is a global online program that brings new contributors to open-source software development. Under the guidance of Kotlin Foundation mentors from Google, Gradle, and JetBrains, contributors will work on programming projects lasting 8–22 weeks over the summer.

This year promises to be full of collaboration as we dive into these exciting endeavors. Here is our final list of projects:

  1. Incremental compilation for the Kotlin/Wasm compiler
  2. Kotlin DSL improvements for declarative Gradle
  3. Support Android target in kotlinx-benchmark
  4. Gradle build server – support for Android projects
  5. Compose Multiplatform component gallery generator

Contributors will gain real-world development experience, work on impactful Kotlin projects, learn from experienced mentors, enhance their resumes, and receive stipends.

If you’d like to follow our progress and take part next year, join our #gsoc Slack channel in the Kotlinlang workspace.

Thank you to everyone who submitted proposals, engaged with mentors, or contribute to the OSS community in general. While we couldn’t submit all the projects we received, we value your contributions and encourage you to continue participating in open-source communities.

If you have any questions or feedback, feel free to get in touch. Stay tuned for more updates and exciting developments!

Let’s make this summer unforgettable for Kotlin! 

Continue ReadingKotlin Foundation Secures 5 Contributor Projects for GSoC 2024

Suggest backend framework

I want to write small project for me and friends, something like online flash drive, but as for “storage” it will use system of other clouds

I have wonderful experience of using python FastAPI, especially autodoc and pydantic models

I checked spring and it semt to quite large for such a small project, ktor looks interesting, but i heard it has a lot of cons tho

So what will u suggest?

submitted by /u/gamer_girl_2007_nah
[link] [comments]

Continue ReadingSuggest backend framework

Helpp

So I am a beginner with Android development and kotlin , I started 1 week back and trying to build a calculator, I have made the UI/UX and the buttons works with constraints and I ultimately get a string consisting of numbers and arithmetic symbols , but the problem is how do I compute this , I searched a lot and found that in Java I can use javax.script to use javascript function of evaluating string directly , for which I tried importing it’s dependencies but it shows error in unresolved symbol script , so please help on how I can resolve this and import this API to use to compute the string and return the answer

Here are some screenshot of what I did in my code :-

Thankss 🙂

submitted by /u/Professional_Knee_71
[link] [comments]

Continue ReadingHelpp

End of content

No more pages to load