2024/10/03
Given that #IntelliJ can highlight #Kotlin code with partially invalid syntax or failing type checks, and given that parts of the compiler are used for highlighting, does it mean that partial compilation of Kotlin code is not too hard to implement (at least within IDE)? đ€
2024/10/02
To be specific about #Kotlin fun interfaces missing usages, I was going to make this Listener fun
but decided not to because I then wonât be able to navigate to its usages, e.g. here. TLDR language features need properer IDE support.
2024/10/01
Another unfinished #Kotlin feature is find usages of fun interfaces, so code navigation and refactorings suffer. Itâs 10 years old and in the backlog đ„ https://youtrack.jetbrains.com/issue/KTIJ-2367
2024/09/30
One idea for the Activity Tracker plugin is to predict/assist with the next user action based on the project activity history, its current state, etc. Maybe this involves less guessing/variability than predicting the code Iâm trying to write.
2024/09/29
South Park Gnomes business plan: 1 - Collect underpants, 2 - ?, 3 - Profit. It was a nonsense joke in 1998 but is very real for some companies today. Activity Tracker plugin (which I just updated to work with the latest #IntelliJ IDEs) is similar except that you own the data. Please help with phase 2!
2024/09/28
I wish there was an option in #IntelliJ to do a text search on the source code of the project libraries. Itâs already almost there⊠you can do the search, but you have to select a specific jar file in the project view âExternal Librariesâ.
=== Reply from Anton Keks ===
I think you can do it if you change the Scope in search dialog to Project and Libraries
=== My reply ===
Yes, thank you! Just choosing âScopeâ in the âFind in Filesâ popup window defaults to âAll placesâ which includes all librariesâ source code. (It feels like I knew about this feature and discovering it for the third time đ)
2024/09/27
Talking about one change at a time, I donât mean never to do large messy changes. There is a time and place, e.g. making yourself feel better (rationalised as âproductiveâ). Or as an exploration and maybe part of the Mikado method. Just shelve the big change and do it again slowly.
2024/09/26
If there is one piece of advice (aka opinion) I have for developers, it is: Do. One. Thing. At. A. Time. (Iâm too bored of seeing code not compiling for a couple of hours and commits that change seemingly everything everywhere.)
=== Reply from samir, jobless immigrant scum ===
Iâd like to add something to this excellent advice.
If you canât do one thing at a time, fix that.
For example, if you canât do one thing at a time because the waiting time to merge is too long (perhaps because youâre waiting for a review, or for your build to finish), thatâs your problem. Figure out how to make it faster until you no longer need to do two things at once.
Oh, itâs always a people problem. The build isnât slow because of technology, itâs slow because no one cares.
Similarly, you canât make people review in a more timely fashion with more code.
You canât code your way out of the deadline pressure on the engineering team.
Even purely technical solutions need organisational buy-in, or theyâll just revert. You can add build caching if you want, but people will just find ways to make it slower.
2024/09/24
With all the money spent on CI/CD tools, how is it that itâs still not a common practice to continuously pull non-conflicting changes from upstream into your local code? Similarly, why not auto-push all local changes that passed all tests?
=== Reply from Oliver Weiler ===
You donât push local changes in the first place because the dev machine may be âtaintedâ (it works on my machine).
=== My reply ===
If you knew that the dev machine is extremely unlikely to be âtaintedâ (e.g. itâs virtualised), would you continuously push? I suspect most people wouldnât because of deeper (probably behavioural) reasons.
=== Reply from Oliver Weiler ===
I would never trust a dev machine. Iâve seen tons of builds break on the CI system because the dev machine had config files / external config / build artifacts not present on the CI system. Impossible to prevent.
=== My reply ===
Sure, ultimately I would not trust any machine or any single build. Iâve seen build systems being non-deterministic, dirty cache problems, supply chain problems, file system being corrupted, etc. Not many people are being paranoid in this space though.
2024/09/23
Overheard at a meetup last week: the top 10 programming languages list is as meaningful as the top 10 bands/artists.
2024/09/16
There is an old idea to treat project file tree with usability in mind. Considering the most common usage patterns (once you know the project), do we really need build files, readme, gitignore, etc. at the projectâs root? Maybe there should be a convention to hide them a bit.
2024/09/13
TIL that GitFlow is not recommended by its author https://nvie.com/posts/a-successful-git-branching-model. And if you consider local code changes a branch, then the recommended GitHub flow is basically: make a change, review, commit đ§đ€· (This is your overdue reminder that pull requests are a waste.)
2024/09/12
If you happen to be in London next Thursday (19th September), come say hi at the On #Kotlin meetup https://www.meetup.com/source-talks-on-kotlin/events/302384401. The format of six short talks is bound to be great, and itâs near a couple of nice north London venues like Never For Ever and The Southampton Arms.
2024/09/11
I occasionally see people coding in #IntelliJ and using Notepad++, VS Code or something else for notes. I wonder if thatâs because theyâre not aware of scratches, scratches have discoverability or usability issues, or they have a strong preference for another editor đ€
2024/09/10
Itâs one of those days when Iâm once again disappointed by IDE not being able to find âimplementationsâ of a typealias in #Kotlin (so I have to resort to find all usages). This is one of the reasons why I think typealiases should only be used within a limited scope (class/file).
2024/09/08
TIL #IntelliJ has an unfinished âHighlight Only Current Declarationâ feature (only available in the internal mode) which greys out code/text outside the current scope. Looks very cool to me đ€© With suppressed inspections, it could be the true distraction-free mode.
2024/09/06
I know itâs too late (and impossible) to fix the âstubs vs mocks vs fakes vs other thingsâ terminology confusion, but Iâm tired or stubs which fake an external service and mocks which return values without any checks (especially for data classes in #Kotlin).
2024/09/05
Random #IntelliJ tip (and a reminder for myself). When IntelliJ starts using a lot of CPU and you are about to express your outrage, remember that you can try the âActivity MonitorâŠâ action so the outrage can be expressed in the right direction (or a plugin).
2024/09/02
Good old #Gradle integration in #IntelliJ showing error messages twice https://youtrack.jetbrains.com/issue/IDEA-221469. Iâve definitely seen it before, but Iâm probably institutionalised enough to expect strange things from Gradle, and just silently suffered for years.
2024/08/30
#Gradle: âThere were failing tests. See report at: file://âŠ/index.htmlâ. And of course, itâs in the âcloudsâ, so itâs a click-ops task to get the file out of it, or the Docker image has been just deleted đ€Ź Maybe printing a test summary to an HTML file is not a good default?
2024/08/29
TIL about âdisagreeable giversâ (via @TShootingAgile https://soundcloud.com/troubleshootingagile/disagreeable-givers). So if you see me ranting about Kotlin or IntelliJ, you now know what it is :)
2024/08/28
Great talk by Brian Goetz âValhalla - Where Are We?â https://www.youtube.com/watch?v=IF9l8fYfSnI (thanks to Uberto Barbini for mentioning it). TLDR after 10 years itâs now just value classes and null restricted types đ€© #JVMLS #OpenJDK
2024/08/27
A modified Brian Kernighan quote for the AI hype wave. Debugging is twice as hard as writing a program in the first place. So if a chatbot generated some code for you that you would not be able to write, then how will you ever debug it? With a debugging bot?
2024/08/25
It took me only a couple of days to figure out why #LivePlugin compilation stopped working in #Kotlin 1.9 đ Turns out it was a bug fix, and coincidentally I found a comprehensive list of #Kotlin language features (which couldâve saved me couple of days).
2024/08/23
In case you would like to click subscribe and ring the bell (or whatever that messed up YouTube workflow is), Duncan McGregor is rebranding his channel to âPairing with Duncanâ https://www.youtube.com/watch?v=MccT-XORptQ
2024/08/22
Iâm really sorry to be late to the party of people who discovered that Firefox shows expired cookies in the dev tools https://stackoverflow.com/questions/60732831/firefox-still-shows-expired-cokies-in-debugging-screen. (It can be really confusing considering that expiration time is in GMT, and I am in the BST time zone.)
2024/08/21
Todayâs puzzler. #Kotlin plugin says smart cast wonât work with invoke
(and suggests a loop of âfixesâ) but it does. Thatâs because the latest #Kotlin plugin doesnât understand Kotlin 2.0 without (beta) K2 mode đ
2024/08/16
It seems widely recognised that software development is a team effort, but most focus is still on individual people. There are not many stories about software teams (unlike, for example, sports like football). Hiring a team is not really a thing.
2024/08/15
Another example of invoke()
navigation not fully supported in #Kotlin (including K2) đż
=== Reply from Eduard-Cristian BoloÈ ===
This one is so annoying, that I stoped using the invoke operator. I prefer being more vorbose, but have navigation working.
2024/08/13
I wish there were editor/IDE extensions to detect conflicts with other branches or local changes of other developers in real time, i.e. as soon as you type the code. Maybe the lack of these extensions means that people want to be left alone more than doing actual CI đ€
2024/08/11
Random #IntelliJ tip. You can turn off native file chooser dialog (because IntelliJ dialog is just better) in IDE Registry
with ide.mac/win.file.chooser.native
property or in the latest versions in Advanced Settings
with âUse native file chooser dialog on Windows/macOSâ checkbox.
2024/08/10
Itâs interesting to see more actions (refactoring, code transformations, and settings) in the #IntelliJ alt+enter popup window. Would it eventually include all available actions though? Maybe yes, and similar to the code completion, only with the most relevant actions at the top.
2024/08/09
Random #IntelliJ tip. You can see version control history for selected text by doing alt+enter and choosing âShow history for selectionâ intention. The functionality existed for years, but I guess itâs more discoverable this way and easier than remembering custom shortcuts.
2024/08/08
One thing Iâm currently exploring in the #IntelliJ QuickFix plugin is default reordering for intention/inspections. We care about the most relevant auto-completion results to be at the top, so why not have the same for context actions?
2024/08/07
I just uploaded a new version of the QuickFix plugin for #IntelliJ that adds an action to apply the topmost intention/inspection because life is too short to press âalt+enter, enterâ all the time. See đ https://github.com/dkandalov/quick-fix
2024/08/06
Itâs probably an unpopular opinion, but having #IntelliJ config files and all dependencies checked into version control was good enough for most projects. I wish there were better tools for downloading/updating dependencies and maybe a build tool (e.g. Amper) to build projects.
2024/08/03
In case you never heard about it, there is Coffee Compiler Club run by Cliff Click. I would describe it as an open-space online meetup related to programming languages and compiler things. Pretty much what Internet is supposed to be :)
2024/08/02
âBeyond the Hype: A Realistic Look at Large Language Modelsâ is a nice talk about LLMs by Jodie Burchell. Especially, the âare LLMs intelligentâ section which is also available here as blog post with more details https://t-redactyl.io/blog/2024/07/are-llms-on-the-path-to-agi.html.
2024/08/01
Random #IntelliJ tip. There is copy/paste history (ctrl/cmd+shift+V), so you can copy two or more pieces of code from the source file(s), then navigate to the destination and paste from history one by one or several items at once (and it works with multiple cursors too!) đ
=== Reply from Oliver Weiler ===
On Mac you can also use https://maccy.app to have this functionality everywhere, not only IntelliJ.
=== My reply ===
Thank you! Just tried maccy and it seems like it doesnât paste sometimes đ Also ÂŁ10 on App Store but free via brew, not sure what that means đ€
I like the idea though and can only wonder why itâs still not the default functionality of all OS.
BTW, to emphasise the point in IntelliJ you can do multi-select in the copy history and paste all selected items at the same time. For a single cursor, they are concatenated. For multiple, one item is pasted for each cursor.
2024/07/31
#IntelliJ trivia: some shortcuts in the default keyboard layout most likely come from https://en.wikipedia.org/wiki/File_manager#Orthodox_file_managers, and were probably intended to be intuitive for the users at the time. For example: F4 - edit file, F5 - copy file, F6 - move file, shift+F6 - rename file.
2024/07/28
Someone (maybe a company making software development tools, e.g. JetBrains đ) should do research and design properly ergonomic keyboard shortcuts for code editors. Itâs tiring to see different and mostly âaccidentalâ shortcuts everywhere.
=== Reply from breadsmasher ===
You can literally pick from a list of various different keyboard maps https://www.jetbrains.com/help/idea/configuring-keyboard-and-mouse-shortcuts.html. Relevant XKDC
=== My reply ===
Yes, and AFAIK none of them are based on any research or actual design. The XKCD is really valid. Maybe it should be a coordinated attempt by couple popular text editors.
You canât standardise everything, but the basic most common actions could be. There is already a small subset which works across the majority of editors, ctrl/cmd+ZXCV for example.
=== Reply from breadsmasher ===
The entire QWERTY layout as far as I remember wasnât based on any design or research
=== Reply from thisisnotgoingwell ===
Thatâs wrong. Qwerty was eventually chosen by the inventor because it was the most efficient design. https://interestingengineering.com/innovation/history-and-evolution-of-qwerty-keyboard
2024/07/25
I really like the âUnused symbolâ inspection in #IntelliJ. Except when itâs a bit too random and project-specific đ€·â #Kotlin
None of the above top-level vals are used in the project.
2024/07/24
#Kotlin shows a âdeclaration has type inferred from a platform callâ warning for top-level declarations like this one even though itâs not nullable:
Why not enhance platform types with external annotations (which could be bundled for JDK)?
2024/07/23
Itâs interesting that some classes in #Kotlin have special treatment for platform types đ€
2024/07/22
There is a nice feature in #IntelliJ to rename variable/function by changing its name and using alt+enter to invoke the rename refactoring https://www.jetbrains.com/help/idea/rename-refactorings.html#inplace_rename. But it only works on definitions, not usages đ€·â So I canât just forget about the rename refactoring shortcut.
2024/07/19
I donât remember if I ever really needed it, but you can have higher-order extension functions in #Kotlin. For example:
2024/07/18
If there are extension functions/properties in #Kotlin, should there be extension classes and objects?
=== Reply from Garth Gilmour ===
Do you mean as in Ruby? Would that not require a lot of runtime magic, instead of just compiler sleight of hand?
=== My reply ===
Not like in Ruby because as you say it would be against the grain of Kotlin. But to be clear, I donât know what I mean exactly đ I just take an existing language concept and try applying it more uniformly.
If you think about context parameters (ex âcontext receiversâ) as a generalisation of extension functions, then extension classes might be equivalent to context parameters for classes. And I just found an answer here https://github.com/Kotlin/KEEP/blob/context-parameters/proposals/context-parameters.md#qa-about-design-decisions TLDR itâs too complex.
=== Reply from Robert Chatley ===
Isnât that called inheritance?
=== My reply ===
I guess the main difference with inheritance is that there is no subtyping đ€ The closest proposed feature for Kotlin is/was contextual classes (And there might be terminology clash between âextendsâ keyword in Java and âextensionâ functions in Kotlin.)
2024/07/17
One of the interesting discussions at XTC yesterday was âAre backlogs bad?â. I like the idea that increasing backlog size needs cost/benefit analysis. Is it about capturing knowledge (e.g. bugs) or is it trying to predict the future? Will it age quickly and become a distraction?
2024/07/16
Interestingly, IntelliJ has an intention for #Kotlin to import object extension functions, but it doesnât work. Could it be a sign of a missing language feature rather than an IDE bug?
Just for reference I created https://youtrack.jetbrains.com/issue/KT-69957 (I bet there is a duplicate issue which didnât manage to find)
2024/07/15
If you happen to be in London tomorrow (16th July), come to the eXtreme Tuesday Club (XTC) Londonâs oldest agile meetup. It will be hosted again in East London hipsterlands đ§ https://www.meetup.com/extreme-tuesday-club-xtc/events/301157888
2024/07/13
Similar to âstumbling on software designâ there often is a gap between what software development seems to be when you start compared to what you end up doing. I bet itâs a natural tendency for any discipline, but are there any studies?
2024/07/12
Iâm sure it has been posted in some other #Kotlin news already but âData class copy function to have the same visibility as constructorâ in K2 is worth mentioning again đ https://kotlinlang.org/docs/whatsnew-eap.html#data-class-copy-function-to-have-the-same-visibility-as-constructor
2024/07/11
There is a difference between what we think, what we say, what we do, how things work out, and how we interpret what happened (and all of these are probably interleaved). It seems that a lot of software design is based on what we say, so this could be an opportunity to improve đ€
2024/07/10
Random #IntelliJ tip: you can use extend and shrink selection actions (and the keyboard shortcuts) in UI trees, e.g. to select files in the project view!
2024/07/08
There is a great book Stumbling on Happiness by Daniel Gilbert describing how we fail to predict what will make us happy due to cognitive biases. Itâs tempting to draw an analogy with software development. Are we lacking observations of our actual experience and chasing the wrong goals?
2024/07/07
You can also find an earlier version of the âRefactoring to Expressive Kotlinâ talk here https://youtube.com/watch?v=UwM3b5D4FjU that covers more topics (for better or worse).
2024/07/06
I wouldnât expect many people to notice that in the âRefactoring to Expressive Kotlinâ talk https://www.youtube.com/watch?v=p5WylVjtzBQ&t=2269s I used a few intentions with the đ emoji. These are custom intentions I wrote specifically for the talk. Wish #IntelliJ had them out-of-the-box though.
=== Reply from MĂĄrton Braun ===
Do you have a list of these somewhere, are they perhaps open source?
=== My reply ===
Itâs convert apply to let, let to apply, convert secondary constructor to top level function, move extension function to class. The source code is here https://github.com/dmcg/gilded-rose-tdd/blob/537de53f9b56b7c173683db0ebb2729def92bcfb/.live-plugins/plugin.kts#L35 (itâs only a project-specific prototype, please donât judge :))
2024/07/05
âContinuous Integration is not a Server. It is the integration of our minds.â https://blog.gypsydave5.com/posts/2024/7/5/continuous-integration-is-not-a-server/ by David Wickes.
2024/07/04
As a reminder for myself that the ârightâ technology, writing tests first or some magic thing, doesnât guarantee a âgoodâ design. Only making an actual code change later can prove how âgoodâ the design was. Should we speculatively attempt the most likely changes from time to time?
2024/07/02
Here is another attempt at paragraph navigation actions (this time mostly based on indentation) https://gist.github.com/dkandalov/6bd16ac80ee69739f9b81b665bb93768. Not a very well-factored code as it still doesnât feel right anyway.
2024/07/01
Another random #IntelliJ tip: âCompare WithâŠâ action (ctrl/cmd+D) can compare and synchronize folders and compare archive files like .jar and .zip. BTW you can select two or more files with ctrl/cmd+click.
2024/06/30
Random #IntelliJ tip: you can use the âCompare WithâŠâ action (ctrl/cmd+D) to compare any two or even three (!) selected files in the project view.
2024/06/29
TIL #IntelliJ âQuick Documentationâ action (F1 or ctrl+J) works in the project view and for files it shows file size, creation and modification time. I wish it worked on folders but very useful anyway.
2024/06/28
It seems we are mostly editing code in files as a whole and arranging them in tabs. Could this be different/better? Do you know about any experiments? For example, a âtiledâ editor space, where each tile is a projection to a text range corresponding to a field/function/class.
2024/06/27
Following the spatial navigation metaphor in code editors, what should be the third dimension, i.e. moving into and out of the code? đ§ My intuition is that moving into is like zooming into function/class definition(s), and out is finding usages, or should it be a folder view?
2024/06/26
Another idea for vertical movement in code editors is to have an âinfinite scrollâ by showing the âpreviousâ or ânextâ file, where the order might be the order of files in the project file tree of the editor/IDE.
2024/06/25
Similar to code navigation to the previous/next word being really useful (it should be the default!), it feels like something is missing for moving vertically đ€ Because going up/down one line is too slow, up/down method is too fast, up/down a page is too unstructured.
=== Reply from Benji Weber ===
Like intellijâs Move Caret Forward/Back a Paragraph
action?
=== My reply ===
Yes, something like that. The problem is that this action, and similar actions in other editors, are about moving to an empty line, not a paragraph (and I donât have a precise definition of what âparagraphâ might mean in the context of a programming language).
Probably some kind of mix with Move Caret to Code Block End/Start
action could work. Need to experiment more with what feels right for me.
=== Reply from Stylianos Gakis ===
I sometimes use a shortcut to go up to the nearest opening bracket. Another thing I do in big classes is to press F12 I think? And get a list of functions inside the class I am in, and move with arrows to the one I wanna go to.
=== My reply ===
I never got used to navigation to the nearest opening/closing bracket. Probably worth another try! đ€ Yes, file structure (cmd+F12 on mac) is an option and has good usages, but itâs more high-level and âbreaksâ the flow with popup window.
Thinking about it as a uniform navigation in all dimensions (which might not be a good idea btw), I guess itâs about finding the analogy for word boundaries and the start/end of the line with vertical navigation.
2024/06/24
Arguably, for code navigation instead of left/right moving to the previous/next character, the default should be previous/next word instead. I have happily used it for years (with an alternative alt+ijkl layout). How is that not a thing in every talk about developer productivity?
=== Reply from Ted M. Young ===
I dunno, but Iâve seen folks hold down the arrow key to get to the beginning/end of a line instead of using the home/end key (equivalent). I guess it was easier when there was a dedicated key, now maybe folks arenât even aware that thereâs such a shortcut?
2024/06/23
Here is an updated #Kotlin version of paragraph navigation actions for #IntelliJ https://gist.github.com/dkandalov/fc8638d21d4ba8b48aec5b25f565c726 (interesting amount of details like scroll to caret, etc.) It still doesnât match my intuition though. Maybe it should include indentation in some way đ€ #LivePlugin
2024/06/22
I wrote this #IntelliJ mini-plugin to navigate to the previous/next paragraph a while ago https://gist.github.com/dkandalov/56482a6b1d5b00702d66545c7c303eb9 but for some reason, it didnât stick đ€ It also needs some refactoring to improve the code and covert it Kotlin! #LivePlugin
2024/06/21
Are there any good developer surveys about pull-request preferences? Something like the range between âI do PRs with myselfâ and âPRs is a wasteâ with breakdown by various attributes. (Asking to learn how much of a minority I am, or maybe not.)
=== Reply from @sleepyfox ===
Last year there were a whole raft of âPull requests are slowing your engineering department down!â articles. My own take on how to make PRs useful: https://gist.github.com/sleepyfox/53ce08ab81515cdc5494f1358f609401
2024/06/18
Code editors usually have actions to navigate up/down functions but what about âparagraphsâ? Which could mean a bunch of statements without empty lines or braces between them. Or maybe big enough bulks of expressions? đ€
2024/06/17
I love this meme by Jason Gorman đ
2024/06/15
A good example of a web UI jitter is Google search. Search for â123â, then search for â1234â. Watch All/Images/Videos/⊠tabs flicker. If logged in, your avatar and Google apps will flicker. If not logged in, âSign inâ jumps left and right. Even in Chrome. Not impressive đ€·đ°
2024/06/14
Another problem with (mostly web) UIs is the jitter. Do we need a cultural shift to make it unacceptable? đ§ For example, this issue https://youtrack.jetbrains.com/issue/IJPL-133305/Lag-when-searching-for-file-class (picking on #IntelliJ only because I use it a lot :)) Or pretty much any website, just watch the screen!
2024/06/13
The dreadful experience of laggy corporate virtual desktops makes me question the rationale behind it. Cost âreductionâ of the cloud? Security concerns? I wish a highly responsive environment was the norm. Maybe it needs lobbying. A law making it a health-and-safety concern? đ€
=== Reply from Peter Lawrey ===
Itâs harder to measure the reduced productivity than the reduced cost of the equipment & support.
=== My reply ===
Also people who make the decision are not affected as much, so everything might look ok to them.
I agree this is probably whatâs happening, but it sounds like âitâs harder to measure public health than profits, so weâll go with the profitsâ which is unlikely to change on its own.
=== Reply from Uberto Barbini ===
TBF, when they works I find them great. Much better than a physical locked down laptop.
=== My reply ===
When every micro-interaction with UI depends on the network latency, itâs unlikely to actually work (unless you have wired connection to the server). We wonât be aware of every tiny lag but it affects the experience, our behaviour and probably wellbeing. Similar to air quality.
2024/06/12
Quoting zed.dev: âWhen you move the cursor or type a character, you should see pixels on the next refresh of your displayâevery time. Even sub-perceptual pauses add up over the course of a day to create unnecessary stress.â Such a contrast to a typical fully remote and laggy corporate desktop environment.
2024/06/11
TIL about https://zed.dev new code editor from the creators of Atom. Itâs early days, but I like the emphasis on the performance and collaborative editing. It would be interesting to see what extension development is like. (For context, I was just getting into Atom when MS bought it â°ïž)
2024/06/09
I wonder if there is a good reason #Kotlin doesnât create a class for anonymous objects đ€
=== Reply from Alejandro Serrano ===
The problem here is that config
needs to get a type, and given that the type of the object
is anonymous, the compiler assigns Any
. As a result, foo
and bar
are not accessible.
=== My reply ===
Youâre right, what I shouldâve said is why Kotlin doesnât define a named class for top level anonymous objects but does it for local objects (as mentioned by pablisco).
=== Reply from pablisco ===
In fact, given that reassigning a local object var is not supported, it could make sense to deprecate anonymous objects and support local object singletons instead đ€ It may match expectations more closely, IMHO
=== My reply ===
Ooh, I like the reassignment attempt đ I guess the reassignment of anonymous objects is basically a request for structural types đ€
Not sure about deprecating anonymous objects though. They are like anonymous classes in Java and are used quite a lot.
To be fair to anonymous objects this works just fine:
2024/06/08
I like the âperfectionism is egoâ idea regardless of whether itâs true, partially true, or wrong because it hints at a bigger idea of questioning our âbasicâ narratives and patterns. Using a geek metaphor, itâs like debugging our behaviour and going through its Git history.
2024/06/07
âPerfectionist is a euphemism for having a massive ego⊠you donât like things that puncture your ego like being wrongâ đ I really like this quote from the best non-Kotlin talk at #KotlinConf by Dan North https://www.youtube.com/watch?v=xW39RKtwolA&t=176s
2024/06/05
I like the recent optimisations in #IntelliJ (it feels faster). Not indexing external libraries could be done better though. When you open unindexed file and ask IDE to index it, the file is just closed. And there is no obvious way to turn off the feature I didnât ask for đ€·â
2024/06/03
If you happen to be in London next Thursday (6th June), come say âhiâ and chat about KotlinConf at the #Kotlin meetup https://www.meetup.com/kotlin-london/events/300882149 :)
2024/06/02
Would you consider a bunch of value classes and pure functions that manipulate these classes an internal DSL? (Assuming the functions donât do anything fancy with nested lambdas etc.)
2024/06/01
Not sure if this #KotlinConf talk inspired me to write Fleet plugins https://youtube.com/live/G8pS1FzZlhk?t=4410s. As if editor/IDE APIs and language AST werenât hard enough, why should I bother with transactional distributed database reactive queries and coroutines structured concurrency on top?
2024/05/31
Overthinking power-assert a bit more, maybe it should deliberately limit the complexity of expressions it handles by default. Because tests are also about discovering the design and ways we think about the problem, and without matchers, we might be pushed into pure tech thinking.
2024/05/30
Overthinking power-assert, there will always be expressions too convoluted for diagrams and objects too large or meaningless to render. One extreme could be to save a âdebugger viewâ of relevant objects and show it in IDE on the assertion failure.
2024/05/29
Another great (lightning) talk from #KotlinConf is âKotlin + Power-Assert = â€ïžâ by Brian Norman https://www.youtube.com/live/G8pS1FzZlhk?t=17597s. I hope Power-Assert becoming a standard Kotlin plugin means it will get more attention, all the good features/fixes, and IDE integration đ
2024/05/28
Iâm watching the #KotlinConf talks I didnât attend, and here is a good one by Martin Bonnin https://www.youtube.com/watch?v=xW39RKtwolA&t=26267s. Tiny correction, this is the right Result4k link https://github.com/fork-handles/forkhandles/tree/trunk/result4k (although KT-68296 is likely to be the future anyway).
2024/05/27
I havenât seen all the talks at #KotlinConf but this one is likely to be the best talk this year: âRevamping and Extending Kotlinâs Type Systemâ by Ross Tate https://www.youtube.com/watch?v=xW39RKtwolA&t=18183s (I sat next to Ross during the keynote but had no idea who he was đ€Š)
2024/05/26
Since someone asked, this is the #LivePlugin I used to have a proper test progress bar in presentation mode at #KotlinConf https://gist.github.com/dkandalov/765232732a0ef7d2937861fcb035b804 (a bit more code than youâd expect đ€·â)
2024/05/23
Thank you to all who came to the refactoring talk Duncan McGregor and I did today at #KotlinConf. You can find the resources we mentioned here https://java-to-kotlin.dev/2024/05/23/kotlinconf-resources.html. The video stream is available here https://www.youtube.com/watch?v=YfiAkmJARe4&t=14861s
2024/05/21
This might be trivial, but here is one way to avoid Impl, Prod, and similar postfixes in class names in #Kotlin:
2024/05/19
Iâm not sure about the origins of the concept of long-term support releases in software, but I wish it was also applied to physical consumer products. For example, when I buy shoes, Iâd like to know if Iâll be able to purchase exactly the same pair in a couple of years.
2024/05/18
Friday content you do need: â2022 - Non-Euclidean Doom: what happens to a game when pi is not 3.14159âŠâ https://www.youtube.com/watch?v=_ZSFRWJCUY4
2024/05/17
Friday content you donât need: âWe need to talk about Gradleâ https://www.youtube.com/watch?v=lKIZA8PiQ3Y by Duncan McGregor #gradle #softwaresucks
2024/05/16
I wonder what program structure could look like if files/packages followed the same rules as nested scopes and all definitions from âparentâ files/packages were available by default đ§ If thatâs a bad idea, why is it a good/ok idea at the function level?
2024/05/15
This #Kotlin code compiles in file/object/function but doesnât compile in a class. It would be a more regular design if {}
always had implicit access to the outer scope or classes couldnât access the outer scope by default đ€
2024/05/13
If Java static
existed in #Kotlin, an interesting way to think about it could be as a âcontext rejectorâ (opposed to context receivers).
=== Reply from Marcin SzaĆomski ===
Scala 3 has an annotation for that. Thereâs an ongoing KEEP regarding statics in Kotlin.
https://github.com/Kotlin/KEEP/pull/347
=== My reply ===
Thank you! Just for the record, Iâm not suggesting to add static
keyword to Kotlin đ I miss some of its usages in Java but answering the question if itâs worth changing the language design to add static
is a completely different endeavour.
2024/05/12
I still miss Java static
in #Kotlin to indicate that the function doesnât use class fields. Companion objects are a bit too indented, and moving the function out of the class distorts the âownership.â So I think I mostly just leave these functions in the class đ€
=== Reply from ÈocĂąte DÄ«xit ===
Is it not the case that, strictly speaking, a function doesnât have an owner (unlike a method), but maybe a namespace ?
=== My reply ===
I donât think Java or Kotlin language specification has the concept of ownership (https://docs.oracle.com/javase/specs/jls/se17/jls17.pdf, https://kotlinlang.org/spec/pdf/kotlin-spec.pdf). So itâs probably fair to say that I made this term up to explain how I think about the code đ€·â
2024/05/10
This is a good old reminder that actually talking to (or working with) people is better than pull requests https://dragan-stepanovic.github.io/2020/11/16/pr-size-cannot-be-reduced.html #noPRs
2024/05/09
An old bugbear of mine is the Gradle test runner in #IntelliJ that doesnât run disabled tests. Classic JUnit runner can do it, so it looks like a regression bug to me (probably >10 years old). Things like that make me doubt Gradle should be the default way to build projects.
2024/05/08
I thought that comments that duplicate what the code says were an artefact of the past (or would only be done by people new to programming). I guess ContinuationScope
in the JDK proves me wrong đ
2024/05/07
Of all modern testing libraries for #Kotlin https://strikt.io is the one I enjoyed using the most. Itâs sad to see it not under active development anymore https://github.com/robfletcher/strikt/graphs/contributors. Makes me wonder if there are good models to âgive awayâ or let someone âinheritâ the project.
=== Reply from Anton Keks ===
I like atrium: https://github.com/robstoll/atrium
Recently it started getting more attention from the maintainer
2024/05/05
Living in an information bubble as we all do, I wonder how many people heard of refactoring golf? đ§
=== Reply from David Denton ===
You might need to find out how many people understand what refactoring is before we start talking about competitive refactoringâŠ
2024/05/03
There is an interesting analogy between #Kotlin scope functions and imports, for example with(foo) {...}
is almost like a scoped version of import foo.*
. I wish the analogy was closer though and nested withs
disallowed resolution ambiguity, or you could define a package object.
=== Reply from Ivan Canet ===
What would a package object do? What would it be used for?
=== My reply ===
Everything objects/classes can do and packages cannot đ Initialization, extending an interface, being used as an expression, reflection and probably other things.
2024/05/02
When editing a file/class, I might not want to be distracted by its existing warnings. Here is an #IntelliJ plugin prototype to suppress inspections until the next commit đ https://gist.github.com/dkandalov/590bdf339efe643a124e43082bed22d1 #LivePlugin (Maybe âDistraction Freeâ mode could do something like that đ)
2024/05/01
Short notice but if you happen to be in London on 2nd May and would like to see some pre-KotlinConf talks, this might be a good event https://www.meetup.com/source-talks-on-kotlin/events/299930315
2024/04/30
Iâm witnessing some Kotlin design hacks đ
But the following doesnât compile đ€š
2024/04/29
I understand that all people are different and there is neurodiversity, but I struggle to understand how people donât notice lots of (squiggly yellow) warnings in the editor. Or reversing the question, why am I so bothered by them? đ€
=== Reply from Görge ===
I believe, that a lot of people are overwhelmed of the possibilities and visual clues of an IDE. So maybe itâs just selective perception so that donât âseeâ the warnings. Maybe itâs also a matter of education. âTheyâ just donât know that the warnings are there to help.
To the reverse question: Same here. I did learn it the hard way. From the C/C++ Compiler warnings over the first hints in JBuilder and later eclipse to the rich code flow analysis based IDEA hint. It makes me a better programmer if I read and understand the warnings. As weâre taking care of our coworkers, we want them to learn, too.
2024/04/27
It might be a false memory, but I think it was possible in #IntelliJ to configure the build so that it doesnât open a tool window every time compilation fails. I wonder what happened to it đ€
=== Reply from Ivan Canet ===
Isnât that in the run configuration settings? IIRC you can decide whether the view opens or not
=== My reply ===
Yes, there is a setting in the run config, but thatâs for running, not building. So if there is a compilation error, #IntelliJ opens Build tool window regardless of the run config.
2024/04/26
Me ranting about #Kotlin API design affected by IDE functionality might be a good example of code not existing on its own, but being a part of a sociotechnical system in which some people might want to use all IDE features. At the same time, itâs always a trade-off, and if creating an API is impossible without a degraded experience for some users, then it might be worth it anyway. I wonder if it is (was) the case for C++ STL for example đ§
2024/04/25
Yet another example of #Kotlin APIs interacting with IDE support is that you canât easily find subtypes of type aliases or function types. Not a massive deal on its own (unless you really need it), but these things can accumulate.
=== Reply from Uberto Barbini ===
this is big peeve of mine! I like typealiases but their usage are hard to find. My #1 feature for IntelliJ would be a Hoogle-like api search engine where you can put a signature and get all functions with that signature (or places where they are needed)
2024/04/24
Another example of #Kotlin APIs affected by IDE is type aliases support. In the code below, the âSpecify return type explicitlyâ intention expands the alias instead of using Foo
(it works with simple aliases though).
2024/04/23
Another example of #Kotlin APIs affected by IDE is unusably slow âFind/Show Usagesâ on widely used functions (with short names maybe đ€). Iâve seen it happening with from()
and invoke()
. Not great for classes extending function types. (Sorry, canât find the right YouTrack issue.)
2024/04/22
One example of #Kotlin API usability affected by IDE is the navigation of the invoke()
function. In the code below, you can only âJump To Sourceâ (or ctrl+click) on the last closing paren.
2024/04/21
Another #LivePlugin making #Kotlin first in the new file popup https://youtrack.jetbrains.com/issue/IDEA-171273 đ
=== Reply from Simon Vergauwen ===
You sold me on LivePlugin, going to take that for a spin.
Do you have a repo, or blog, or any reference where I can see some of your code, and utilities?
=== My reply ===
đ„ł https://github.com/dkandalov/live-plugin The examples, might be out-of-date (because IntelliJ API changes) and might need to be updated to include the ones I actually useâŠ
2024/04/20
Here is a âone-linerâ plugin for #IntelliJ I use before presentations (it needs #LivePlugin to run, but you get the idea đ):
2024/04/19
In case you want to try an alternative JSON (de)serialization library for #Kotlin, Kondor https://github.com/uberto/kondor-json by @ramtop is great. No annotation magic, just functions explicitly defining the mapping. No external dependencies. As fast as Jackson.
=== Reply from Nat Pryce ===
Itâs a great library and especially useful when you need to select a format dynamically, via HTTP content negotiation or version info within a file, for example. Which, given enough time, is always.
2024/04/18
Code editors with AI assistance should be equipped with two pedals. âLess AIâ pedal: I know what Iâm doing, just let me type the code! âMoar AIâ pedal: keep hallucinations coming, I have a blank page problem.
2024/04/16
Typical #IntelliJ dilemma. There are two identical entries in the auto-complete popup. Do I spend an hour (or more) investigating and reporting it on YouTrack to find that itâs already fixed, or itâs been a known bug for years? Or move on pretending nothing happened? đŹđ
2024/04/15
One way to make (Auto)Closable
in Java/Kotlin safer could be a compiler check that itâs been closed. Something similar to @Nullable
/@NotNull
annotation or https://youtrack.jetbrains.com/issue/KT-12719. (To be fair, there is a Java inspection for AutoClosable
in IntelliJ, but this is not generic enough.)
=== Reply from Simon Vergauwen ===
How would that be possible to track? I use a DSL for that, I released it as a 1 file library in Arrow. Hmm, KDoc missing from Dokka. https://apidocs.arrow-kt.io/arrow-autoclose/arrow/-auto-close-scope/index.html 1st party support would be cool though.
=== My reply ===
For Kotlin, the same (or similar) way IntelliJ finds unused Deferred
. Just for reference DeferredResultUnusedInspection
source code and AbstractResultUnusedChecker
is easy to configure.
2024/04/13
Why JDK has (Auto)Closable
interfaces but nothing like Disposable
(e.g. see https://github.com/JetBrains/intellij-community/blob/idea/222.3739.54/platform/util/src/com/intellij/openapi/Disposable.java; not to be confused with IDisposable
in C#) or similar pattern to pass the parent resource owner as a parameter so that itâs harder to forget to close the Closable
? đ§
2024/04/12
On the topic of dark vs light editor themes, the correct answer is of course âit dependsâ. Theyâre all fine and at some point, I had auto-switching using https://github.com/mikereedell/sunrisesunsetlib-java. I wish there were responsive colour schemes so that OS could gradually shift colours through the day.
2024/04/11
Are there good articles about tiny types (aka micro types)? Also, what does make a type âtinyâ? I guess itâs about narrow usage in the domain, e.g. Date or Money are not tiny even if they wrap a single primitive value đ€
2024/04/10
In case you need a #Kotlin client for Amazon S3, you might want to try https://github.com/http4k/http4k-connect/tree/master/amazon/s3 đ Itâs minimal but easy to extend/test, and you control the HTTP client it uses! #http4k
=== Reply from ĐĐŸĐ»ĐŸĐŽĐžĐŒĐžŃ ĐĄŃДлŃĐŒĐ°ŃŃĐș ===
In case you need a #Kotlin client for S3 , just use the official one https://docs.aws.amazon.com/sdk-for-kotlin/latest/developer-guide/kotlin_s3_code_examples.html
=== My reply ===
Sure. Java client also works just fine. The difference is the amount/size of dependencies and testability. Also the official Kotlin SDK is all âsuspendâ which some people might not need/want đ€·
=== Reply from dav1d d ===
I havenât looked at it deeply, but it seems like the official sdk might obsfucate the end client from you, thus rendering it untestable in a non-in-memory fashion? The Java SDK did allow for replacement of the http client so you could decorate it with observability etc..
2024/04/09
As an example of why bother with allocation stack traces, imagine seeing this line in #Kotlin stack trace FooKt$compose$1.invoke(foo.kt:42). With many usages of compose() in the project, it can be hard to find the right one and the functions it composed (and so on recursively).
2024/04/08
Unlikely to be a new idea, but it could be useful to have object allocation stack traces in a debugger. Then the allocation stack traces might include objects that also have allocation stack traces⊠and thatâs almost profiling đ€ #whynot
2024/04/06
In programming, itâs important to name things right, so itâs âcore humanâ, not âsoftâ skills. (Image by Susan David, Ph.D., discovered via Compassionate Coding.)
=== Reply from gavr ===
it seems to me that soft skills is the same generalization as hard skills, they could also be unpacked into a diagram from a bunch of components
2024/04/05
Happy to confirm that #IntelliJ 2024.1 preserves #Kotlin imports after copy-paste đđ„łđ» https://youtrack.jetbrains.com/issue/KTIJ-10687
2024/04/04
Given that in #Kotlin apply
and with
are often used for configuring objects, it would be interesting to try restricting this
to only one immediate receiver đ§ Maybe with something like @DslMarker
.
=== Reply from Uberto Barbini ===
Itâs not already like that? I mean you need to qualify it for refer to the other receivers
=== My reply ===
Youâre right, this
can only refer to immediate receiver or has to be qualified đł What I mean is accessing several contexts via implicit this
2024/04/03
The usability of APIs is not just typing the right code. Itâs also the amount of friction or help from the compiler/IDE/editor at every step, being able to âguessâ the right thing to do, navigating to and understanding the source code, finding documentation/examples online, etc.
2024/04/02
I wish there was more usability testing on APIs. Nothing fancy. Just watch someone with good knowledge of the programming language and technology complete a couple of tasks (no hints, no judgment). This might be enough to find pain points and avoid the curse of knowledge.
2024/03/31
In case you missed it, there is https://kotlintoday.com by @kotlin_magazine đ #Kotlin
2024/03/30
Clarifying the point about ::functionReference in #Kotlin. The line between âvariablesâ and functions is blurry anyway, and itâs possible to reference a function without â::â đ€·â
2024/03/29
I wonder why #Kotlin needs â::â before function references, is it for faster parsing or there is a deeper reason? đ§
vs
2024/03/27
Can anyone recommend good eye tracking hardware/software suitable for recording the area/letters user is looking at on the screen? đ€ I thought eye tracking was mostly a âsolvedâ problem but after a bit of search Iâm more confused than before.
=== Update ===
I found https://www.tobii.com/products/eye-trackers/screen-based/tobii-pro-spark for ÂŁ2600 and https://pupil-labs.com/products/core for âŹ3440. Given the prices, Iâm not in a rush to order one.
2024/03/26
I wonder if people use #Kotlin scope functions in some idiosyncratic way that doesnât match coding conventions https://kotlinlang.org/docs/scope-functions.html đ€ I think I tend to use also
only for non-essential side effects and avoid run
and with
if possible.
=== Reply from Simon Vergauwen ===
I almost never use run, or with. I rarely use also, typically for (temp) logging.
let I also use sparingly, for ?.let(::Reference) and similar but definitely not always.
So I refrain from these most of the time.
=== Reply from Uberto Barbini ===
I use with only when I need something in scope to get ext functions on something else.
Run is nice sometimes as a let on receiver, but the name is unfortunate
2024/03/25
Nothing radically new here, but in #Kotlin you can change the order of function/constructor calls in the code to match the execution order with scope or extension functions. For example:
đ
2024/03/23
In terms of less local code ergonomics, e.g. âreadingâ a function, in addition to eye/mouse/cursor tracking it might be interesting to capture navigation like finding usages, which arguments are passed in, etc. The complexity of navigation could correlate with worse ergonomics? đ€
2024/03/21
In terms of the âlocalâ code ergonomics for an expression/statement which fits on a few lines, what about eye/mouse/cursor tracking to measure overall distance, path overlap, hot spots, amount of jumps, etc.? This could be a more concrete thing to compare âreadabilityâ đ€
=== Reply from Louis CAD ===
How much you need to navigate and jump your eyes off to understand things, and how many questions you need to ask yourself when reasoning about what happens in the code.
=== My reply ===
Not easy to measure the amount of questions though. Maybe some statistical (AI) magic dust can interpret emotions on the webcam đ
=== Reply from Louis CAD ===
You can ask someone to write the questions they have in mind. Mutable references, and unstructured concurrency are the first offenders. Then, thereâs the âWhy was this named like that?â.
=== My reply ===
Hm, I was thinking more about lower-level measurements. Questions could be a good way to interpret the results though đ€ (The problem with asking people questions is figuring out if they actually had this thought or they think they did but actually didnât.)
2024/03/20
Code âreadabilityâ has such a wide meaning that I genuinely have no idea what it really means. I suspect it often means âthe code that we likeâ or âwe did our best to not make a messâ đ I wonder if thinking about code âergonomicsâ could lead to more concrete terms? đ€
2024/03/18
I doubt itâs a new idea, but I wonder if, similar to NP problems, the information on the Internet could/should be made hard to fake and easy to verify (via digital signature, trust network, etc. #noblockchainsplease) đ€
2024/03/16
One solution for the coding interviews could be for everyone to do them on a regular basis in the spirit of code katas. But when I ask people I know from the big tech to do it on a weekend, they are not very keen and imply itâs a waste of time. Something doesnât add up here đ§
=== Reply from Alexey Soshin ===
Before looking for solutions, someone needs to admit the problem.
As things stand now, there are more than enough people willing and able to solve any ridiculous interview question.
2024/03/15
It might seem weird today, but puzzle-focused interviews were a norm in the tech industry 20+ years ago. With the pinnacle of the âHow Would You Move Mount Fuji?â book. I hope in 20 years we will look back at the current hiring process with the same amount of disbelief #progress
(To be clear the diagram is not to scale or be exhaustive, e.g. it ignores the randomness of the hiring process.)
2024/03/14
Here are some old ideas to make coding interviews more fair. Do an actual pair programming session, in which nobody knows the problem or solution. Do it on a âneutralâ territory. No hard time limit. In big companies randomly interview existing employees to measure the baseline.
=== Reply from Jean-Michel ===
The obvious principle behind that: Being a good candidat should be a second job https://dev.to/jmfayard/how-to-not-answer-where-do-you-see-yourself-in-5-years-398m
Being a good candidate should not be a second job. Remember back of the day where we didnât care much about usuability. We had our software, it was not perfect but it worked. Users complained that it was hard to use. From our side we complained that they were too lazy to RTFM. Thing went on and on, and then we realized that the user is not trained or paid to use our software. We are the professional and itâs our job to think about usability and make sure we understand the user so much that we will remove the obstacles on her path before she can see it.
The same principle holds in a job interview. The candidate is neither trained nor paid to be a good candidate. Her real job is to be a good developer, and thatâs what the interview should be all about. The interviewer is the professional, he is paid for that, he can prepare things in advance. Thatâs his job to think about what makes candidates uncomfortable for no value to the company. And get those obstacles out of the way.
=== Reply from Dave H ===
I like the idea. Choosing that neutral territory again and again could be tricky though.
A benefit for the interviewee of working on the companies actual codebase is itâs an opportunity for them to learn if the organisations code is an environment they want to work in
Do both?
=== My reply ===
This is a good point. Itâs easy to run out of neutral spaces even in a big city. Might still be worth it compared to a corporate environment where you canât walk on your own and need a âpermissionâ to drink water or go to the toilet.
Yes! Working on a real codebase is another good idea đ Maybe even pay for it.
Obviously, I donât mean any of the ideas are easy or feasible to implement. But they highlight issues with the current process.
=== Reply from ĐĐžŃ Đ°ĐžĐ»ĐŸ ĐĐ”ĐČŃĐ”ĐœĐșĐŸ ===
This idea does not scale. Imagine how many new tasks covering the required set of skills you need to craft in medium-large companies?
Good coding interviews already resemble pair programming. Yes, interviewer done that task dozens of times, but that advantage can be neutralized by selecting everyday tasks as interview tasks.
If you hire a backend dev, make them do a CRUD app with some specific of your domain. Theyâve too done cruds dozens if not hundreds of times. So the fact that interviewer done this particular task shouldnât matter.
=== My reply ===
I suspect that interviewers who are very familiar with the problem can be affected by attribution and self-serving biases. And since knowing about the bias doesnât make you less biased, something else needs to change.
2024/03/13
To be fair, in #IntelliJ itâs easy to write a naive expansion to word boundaries (see attached snippet for LivePlugin). Whatâs hard is to make it work in all contexts with other selection expansion handlers (it doesnât). And given enough users, someone will always be upset đ
2024/03/12
I thought plain text #IntelliJ selection expansion first selects âvalid idâ, then text surrounded by spaces, then wider context. Turns out itâs a combination of PlainTextLineSelectioner
, NaturalLanguageTextSelectioner
and WordSelectioner
(actually java id âselectionerâ), which donât expand to a [b=1|23] c
. And Iâm not going to debug VSCode đ
2024/03/11
The rabbit hole of the day is exploring selection expansion in different editors, e.g.
I wish there was also this selection:
I didnât find a simple answer/solution, unfortunately.
2024/03/09
FYI Sweary Lightweight Agile Planning https://slap.pm and SFW version https://slap.pm/bowdlerised #NoEstimates Good planning advice on one page of text, which you can read in under 2 minutes.
2024/03/08
I like the idea (canât remember the source) that not all tech decisions need to have economical rationale behind them. For example, it might be worth tidying up the code not because it will make us more productive in the future but because we enjoy a better working environment.
=== Reply from Vladimir Dolzhenko ===
https://plugins.jetbrains.com/plugin/8575-nyan-progress-bar right?
=== My reply ===
Yes, I guess overall itâs about doing something because you feel like it, not because there is a convincing case for it to be useful or monetisable. The Nyan progress bar is on the artistic/performance meme side of it đ
=== Reply from Ivan Moore ===
I think there is economic rationale behind this though. Better working environment = higher morale = better motivated people = more productive.
=== My reply ===
I agree. I guess the point is that it doesnât need to have an economic rationale. People having meaningful lives is valuable on its own regardless of the productivity đ€
2024/03/07
I like the idea from the Happy Path Programming podcast (yes, itâs a recommendation đ) that creating a major build tool is so hard that people never do it again, and the knowledge is lost. But maybe someone should do it, so we finally get a perfect build tool for the JVM. An idea for Amper? đ
2024/03/05
Looking recently into OAuth/OpenID, Iâm tempted to create a diagram explaining the interactions, even though itâs âyet another monad tutorialâ territory. The reason is that I found most diagrams incomplete or confusing. Not a good thing from a security point of view đ€
2024/03/04
âYet another emoji supportâ is one of my favourite #IntelliJ plugins https://github.com/shiraji/yet-another-emoji-support đ It adds emoji auto-complete similar to Slack which I wish was the default everywhere. Not sure if the plugin works in the latest IJ though, I have a local fork đ±đ
2024/03/01
Great talk by Clare Sudbery âContinuous Integration: Thatâs Not What They Meantâ https://www.youtube.com/watch?v=Ms3J6_-6-fk đ€© And this is your regular reminder that pull requests are a waste.
2024/02/29
Here is my daily bread and butter đđ§ being taken away in the form of #IntelliJ not finding #Kotlin property usages in the constructor unless itâs a named argument :( #whybacklog https://youtrack.jetbrains.com/issue/KTIJ-11262
2024/02/28
Not sure what The Internet thinks about it, but I prefer named arguments in #Kotlin to be passed in the order of parameter declaration. If you disagree, please make sure I know about it đ https://dmitrykandalov.com/tidy-kotlin#pass-named-arguments-in-the-order-of-parameter-declaration
2024/02/27
Itâs good that build tools care about build reproducibility, but unless you rebuild artifacts at some point later and compare checksums, you cannot assume that the build is actually reproducible (because the environment, pipelines, etc. do change over time).
2024/02/26
Thinking of too many #Gradle downloads (because of many minor versions), the most appealing solution is to make core Gradle smaller and âfinishâ it, so it will naturally need fewer releases. And, hopefully, less API churn, so the build scripts from five years ago are valid today.
2024/02/25
Another #Gradle rant is the amount of Gradle versions I end up downloading. It seems like each project has a slightly different version in gradle-wrapper. I have 16 Gradle versions on a relatively new laptop. Does it have to be this way?
=== Reply from joschi ===
Thatâs the whole point of the Gradle wrapper (and Maven wrapper if youâre using it), allowing for completely reproducible builds. Even better if youâre using Gradle and Maven toolchains to download and use a specific JDK.
Also, are you working on a Raspberry Pi 1 or something? Disk space is cheap. đ
=== My reply ===
Yes, reproducible builds are non-negotiable. The question is if the experience could be better :) I agree about disk space, although itâs funny downloading +100Mb to compile a few classes. Itâs the download time (opening an old project on a train), IntelliJ indexing, etc.
2024/02/23
Random #IntelliJ/#Gradle tip to balance out the rants. You can assign a keyboard shortcut to the âExecute Gradle Taskâ action (I have it as cmd+shift+G, G for Gradle). The action has auto-completion and hints for all Gradle tasks and flags! đ
=== Reply from ĐĐžŃ Đ°ĐžĐ»ĐŸ ĐĐ”ĐČŃĐ”ĐœĐșĐŸ ===
Even better it has âRun anythingâ dialog where if you type âgradleâ you ll also get autocomplete, but you can also run ârun cofigurationsâ and other things from it.
Pro tip: hold shift to run with debugger
=== My reply ===
I somehow never got into the âRun anythingâ dialog even though itâs definitely a more explorable UX đ€ For Gradle, Iâd rather use a shortcut than type âgradelâ and misspell it đ The same for run configs. Or maybe these are excuses and I just find double ctrl a bit awkward.
2024/02/22
Unpopular opinion, but Iâm still not convinced by #Kotlin in #Gradle builds. Itâs slower. IntelliJ occasionally makes the whole script red. Build scripts are more verifiable with Kotlin but not more comprehensible. Itâs still a matter of copying random snippets from the Internet đŹđ
=== Reply from Martin Bonnin ===
I started using none of the generated accessors lately => no magic. Now I just wish IDEA/Gradle could determine the buildscript classpath without the build.gradle.kts and that would fix the chicken and egg red underlines forever.
2024/02/21
Another #Gradle/#IntelliJ rant is the console output. When running tests, why do I need to see all the â> TaskâŠâ and the classic âDeprecated Gradle features were usedâŠâ but canât see the command used to run the tests? đ€š
=== Reply from Chris James ===
Oh god this drives me mad too
Tries to teach TDD
- Write the failing test
- Run it
- Scroll past the bullshit to see the actual output youâre interested in
- Write enough code to make it pass
- Run test again
- Scroll past the bullshit to see the actual output youâre interested in
=== My reply ===
+1 To clarify Iâd rather not see any Gradle output in tests output but if itâs already there, I wish it included the command.
2024/02/20
It feels that running code/tests was faster 10+ years ago via #IntelliJ built-in runners than it is today via #Gradle. Not sure if itâs IntelliJ or Gradle itself or both. I wonder if itâs worth digging out an old version of IntelliJ to prove the point đ§ (or be embarrassed)
2024/02/16
Similar to having code coverage turned on by default when running tests, maybe the performance profiler should be enabled by default when running code locally (and maybe some other environments). Iâm sure I heard that idea at LJC unconference year ago đ€
2024/02/15
Thinking about code coverage, maybe instead of a separate feature, it should be the default behaviour when running tests (definitely during the development cycle) đ§ There will be performance overhead, but it might be ok for many projects since the build is already super-slow đ
=== Reply from Eugen Martynov (redacted) ===
So the case is about teams that collect coverage only. Frankly speaking, I know tons of people who write tests after code, so for them it is kinda obvious. As another reminder to write tests, maybe. Recently, I saw rare cases for projects without tests. Pet projects have tests.
=== My reply (redacted) ===
I would say not collecting but actually seeing in IDE which lines have coverage. This can be useful for both test-first and test-after. Yes, sometimes it feels obvious which lines are executed and then the reality surprises me đ”âđ«
I never found collecting code coverage super-useful, but maybe I havenât seen it used right.
While I remember, here is an old video by @sandromancuso showing how code coverage can be used during development https://www.youtube.com/watch?v=_NnElPO5BU0.
2024/02/14
#IntelliJ has a popup window with recent run/debug âconfigurationsâ (alt+shift+F9 or F10). This is really cool and makes at least part of the top panel obsolete once you know the shortcuts. But there seems to be nothing similar for running with code coverage and profiler đ€š
2024/02/13
Another idea is to bring the auto-completion of âobject.â from class-oriented to functional code. For example, when using http4k if I type Request(
maybe #IntelliJ could show a dropdown with the values of the Method enum because itâs the only possible first parameter đ€ #Kotlin
2024/02/12
I wonder if it might be a useful feature to have import âaffinityâ so that if there are few imports in a file from a particular package, more things are auto-imported from the package. Or maybe it already exists? (Please donât suggest auto-import exclusions in #IntelliJ đ)
2024/02/11
I wrote a couple more sections in the Tidy #Kotlin about putting parameters/arguments on one/separate lines https://dmitrykandalov.com/tidy-kotlin
2024/02/09
One of the coolest features in #IntelliJ 2024 for me are the charts đȘđ I guess they work on any âdataâ content, but CSV file support is the killer feature because they are so easy to produce in a few lines of code.
2024/02/08
Turns out #Kotlin get/set operators can have multiple parameters of any type đ§ For example:
Which can be used like this:
2024/02/07
The missing #IntelliJ intention to generate named arguments in Kotlin is a feature that I wanted for years but never even bothered looking up on YouTrack. Makes me wonder if the votes on issues skew toward the most irritating or shiny but not necessarily the most useful ones đ€
2024/02/06
One of the #Kotlin plugin features that Iâd expect from day one is an intention to generate named arguments for function/constructor invocations. Seems like a good ratio between the effort to implement and productivity impact. But itâs in the backlog https://youtrack.jetbrains.com/issue/KTIJ-16676 đ
2024/02/05
On the topic of browsers, I use Firefox as a default browser (configured to clear cookies and other data on restart) and Chrome when I need to be logged in. Firefox Focus on iOS. Quite happy with it. Chrome is the new IE đ
2024/02/04
For the first time in ages, Iâm happy to accept a cookie đ And it was a really tasty one!
Thank you, Firefox! #fosdem
2024/02/03
Interesting talk by Alan Bateman about virtual threads limitations and future plans https://fosdem.org/2024/schedule/event/fosdem-2024-3255-virtual-thread-s-next-steps #fosdem
2024/02/02
A bit of a boring topic, but it seems there is a tendency to extract a CONSTANT whenever there is a âspecialâ value in the code. I would prefer a local variable just because itâs in line with making definitions as private as possible. I wonder if there is a CONSTANT_CARGO_CULT? đ§
2024/02/01
As an example of build script testing in Gradle, it could be a task to unit test isolated parts of the build script (pure functions, simple tasks) or to sanity check output/artefacts (size, basic structure of artefact, actual dependencies, etc.) of more complex tasks.
2024/01/31
I will be in Brussels at @fosdem for the next couple of days. Happy to meet if youâre also there and maybe do a code kata or chat about #Kotlin đ
2024/01/30
Given the complexity of build scripts, how is it, not a thing to write automated tests for the build itself đ€·â
2024/01/29
I doubt itâs a new idea, but why not make #Twitter features into Internet standards (instead of another social network)? For example, a tweet could be content with URI, reply - a relation to another URL, following - something similar to RSS, likes - a generic rating system, etc.
2024/01/27
One lesson I learned from the Twitter takeover is that if I care about the content I publish on social networks, I shouldnât rely on them to keep it or make it available. Everything I wrote on Twitter/Mastodon/LinkedIn in the last couple of months is also available in my blog https://dmitrykandalov.com/micro-blog.
2024/01/26
Having approval/snapshot tests for calculated cells in notebooks could be really useful. The hardest part is to show meaningful diffs for complex and visual data. Maybe a feature for @KotlinForData one day :) (I found https://github.com/ploomber/nbsnapshot, but itâs not quite what Iâd expect.)
2024/01/25
If #Java/#Kotlin libraries, ideally, shouldnât have global side effects (e.g., print to stdout or create a global thread pool), then maybe they should also avoid logging via global API. And instead, configure logger as a function (or object) explicitly passed into library API đ€
2024/01/24
Random #IntelliJ tip. If you see a yellow/red notification panel at the top of the editor with some actions as links, instead of using the mouse to click the links, you can trigger the actions via the alt+enter popup window. For example, âSetup SDKâ in the screenshot below.
2024/01/23
Iâve seen people doing this in #Java and #Kotlin:
Premature optimisation or prudent code avoiding Iterator
allocation?
=== Reply from Brian Ziman ===
Definitely a premature optimization. ArrayList doesnât allocate an iterator at all, nor does Guavaâs ImmutableList. I would guess most âgoodâ classes have a pretty optimized forEach() method. If youâre relying on the default implementation of Iterable.forEach() in some other less performant type, then this trivial optimization probably doesnât buy you anything at all, but costs you readability.
2024/01/22
Pedantic alert đ€đš Are there any docs saying that #Kotlin val
actually means âvalueâ? Itâs âlocal propertyâ in the language spec. âPropertyâ in the grammar. And âread-only local variableâ in the documentation.
2024/01/20
I did the NO_SCREAMING_SNAKE_CONSTANTS lightning talk at the last XTC meetup. An interesting observation is that with the same style, itâs easier to change val
s to const
s or back without updating all usages. And a suggestion to try uppercase for vars and mutable data instead đŻ
2024/01/19
Programming language terminology is a mess. People say âvariableâ meaning unmodifiable reference to immutable data, e.g. String val
in #Kotlin. đ Or it can be a modifiable reference to mutable data. How new joiners are supposed to make sense of this? đ€·â We need better terms!
2024/01/18
I did a small write up suggesting to inline all single usage âvariablesâ in #Kotlin https://dmitrykandalov.com/tidy-kotlin#inline-variables-with-single-usage because there are pretty much no downsides to that (except if it needs a better name or object requires longer lifetime obviously).
2024/01/17
I wish there was an #IntelliJ feature to search files and class names in git (or VCS) history. And maybe code history text search as well (e.g. based on âgit log -Sâ)?
2024/01/15
https://youtrack.jetbrains.com/issue/KTIJ-18028 #Kotlin #backlog đ
2024/01/14
Another interesting historical speculation is that the camelCase naming style became popular because of the lack of an underscore key on some of the old keyboards http://exampler.com/blog/2012/05/15/speculation-about-the-origin-of-camelcase. Surprisingly, there arenât many studies to know if camelCase is better or worse for reading identifiers https://en.wikipedia.org/wiki/Camel_case#Readability_studies.
2024/01/13
I did a small write-up on my favourite topic of SHOUTING_CONSTANTS https://dmitrykandalov.com/tidy-kotlin#stop-the-constant-shouting. TLDR there are no good reasons for uppercase constants other than history.
2024/01/12
If you are in London next Tuesday (16th January), come say hi at eXtreme Tuesday Club (XTC). Itâs a great #openspace meetup! Will be hosted for the first time in East London hipsterlands đ https://www.meetup.com/extreme-tuesday-club-xtc/events/297787737
2024/01/11
I wonder if making variables/functions/classes/etc. as private as possible is considered to be a form of encapsulation. Or âencapsulationâ is too specific to OO and something like âinformation hidingâ is better for non-OO code?
=== Reply from Orchun Kolcu ===
I donât think encapsulation is OO specific (and although people will argue otherwise, information hiding is just what you achieve by encapsulating decisions), but there needs to be a capsule/abstraction you can point to as the end result.
So maybe outside that context, itâs just minimizing visibility or âhidden by defaultâ.
2024/01/10
I drafted a couple of Kotlin âtidyingsâ https://dmitrykandalov.com/tidy-kotlin. I think it might be good to get some feedback before writing more. What could go wrong with posting a draft on social media⊠đ
2024/01/09
Library to make Data-Oriented programming in Kotlin easier by extracting typed values from dynamic data structures such as Maps https://github.com/fork-handles/forkhandles/blob/trunk/data4k/README.md đ Looks interesting and reminds me of https://github.com/uberto/kondor-json
2024/01/08
Following analogy between websites and codebases: compiler bug => canât render a valid web page; IDE navigation bug => canât follow a valid URL. From this point of view, navigation issues are fundamental and should have one of the highest priorities đ§
2024/01/07
I find âcode smellâ as a metaphor quite descriptive. Like smells, itâs often an immediate uncontrolled reaction, and I can be rigid about preferences. I wish though I could be more flexible and absorb the context in which the code was written. Maybe another metaphor could help? đ€
2024/01/05
KT-17206 NoSuchMethodError happens with dependencies SomeTest->SomeClass->Util, where Util from test shadows Util from main. The same issue exists in Java, but in #Kotlin itâs easier to forget that files are always classes. And itâs compounded by tools not showing classpath đ This must be even more confusing for #Kotlin multiplatform when not targeting JVM #leakyabstraction
2024/01/04
To be specific about KT-17206, extract a couple of test functions into Util.kt. #IntelliJ is happy. #Kotlin compiles the code. But when running tests, they fail with NoSuchMethodError. The reason is that there is already UtilKt class in the main code. See https://github.com/dkandalov/hello-KT-17206/blob/main/src/test/kotlin/test/SomeTest.kt
2024/01/02
Itâs one of those days when after making a trivial change, I get a baffling NoSuchMethodError. Luckily, by now I have an intuition to remember this #Kotlin issue https://youtrack.jetbrains.com/issue/KT-17206 so it doesnât take hours to fix. Good to see itâs being rediscovered years later for #KMP https://youtrack.jetbrains.com/issue/KT-63940 đ
2024/01/01
If you need a podcast recommendation, Oddly Influenced by @marick is an excellent one https://podcast.oddly-influenced.dev âA podcast about how people have applied ideas from outside software to software.â Makes you realise the software world doesnât exist in isolation.
2023/12/31
Not a new idea, but I wonder if the web (similar to how we browse code) could be more about structured data and less about styles. It might be too late for HTML, but what if browsers rendered markdown đ€ This also solves the light/dark mode âproblemâ with local rendering.
2023/12/30
Similar to how we might see ads on websites, maybe we could have âadsâ in codebases showing links to related code or well-known bugs/pitfalls/etc related to the code on the screen. Like inspections in #IntelliJ but less focused on the specific line of code đ§
2023/12/28
To be clear, when I suggest tracking user navigation on codebases, itâs not just about improving the IDE/editor experience, but about improving the code (or how we think about it) in the context of the current project and people. Or at least learning about it based on data.
2023/12/27
It would be great to have use cases for tracking user navigation on codebases. If youâre using #IntelliJ-based IDE on a project big enough to benefit from usage/navigation tracking, please let me know, and I might tweak this plugin https://github.com/dkandalov/activity-tracker so that it works well for your project.
2023/12/26
Another application of web browsing to codebases might be to track user navigation. If you know the most viewed areas, common navigation patterns, etc., then you can improve the areas that matter. Or maybe discover that some people have tacit knowledge thatâs worth sharing.
2023/12/24
Given browsing is like a code navigation analogy, browsers could also borrow a few things from IDEs/editors. For example, the old idea of a website map, i.e. a tree structure for navigation. Or why we still canât bookmark any line on a website? đ€·
2023/12/23
We browse websites with their original styling (ignoring Safari reader view and Opera local CSS since theyâre not too popular.) At the same time, codebases donât have any styling at all. What if they did, so we could see the code exactly the same way as authors?
2023/12/22
Continuing with code navigation is similar to the web browsing analogy, all browsers have navigation history sorted by time, which you can also search and filter. Why is it not a norm for text editors/IDEs? đ§
2023/12/21
Discovered today a great talk by @emeryberger âPerformance Mattersâ https://www.youtube.com/watch?v=r-TLSBdHe1A TLDR itâs easy to misattribute performance changes due to memory layout, etc. Profilers are not designed for concurrency. See https://github.com/ccurtsinger/stabilizer and https://github.com/plasma-umass/coz
2023/12/20
I donât think there is an action in #IntelliJ to open a declaration in a new split on the right. Using macro (Edit Source, Move Tab Right) works but has too much visual noise. OTOH, there is an underrated (thinking about myself) âShow Type Definitionâ action that shows a popup.
2023/12/19
Another application of âcode navigation is like browsingâ is for IDEs/editors and web browsers to learn from each other. For example, Arc browser on alt+click opens a link in a new right split. Unlike VS Code which on alt+cmd+click keeps only one right split. Why the difference?
2023/12/18
If you agree with the analogy between navigating a codebase and browsing websites, then learning from web usability to apply it to software design would make sense. For example, âDonât Make Me Thinkâ by Steve Krug is an old but good book on the topic https://www.goodreads.com/book/show/18197267-don-t-make-me-think-revisited
2023/12/17
I wonder if âreadingâ code is a good analogy for any large enough codebase (and, if not, it might be leading us in the wrong direction). Yes, we read words on the screen, but overall itâs closer to browsing the Internet than reading a book đ€ âNavigabilityâ vs âreadabilityâ?
=== Reply from Estrella Kowalski ===
I think itâs a good analogy. Code is a form of written communication, and reading it is a way to understand it.
=== My reply ===
Yes, itâs definitely reading because most programs are text-based. And itâs also a different kind of reading, e.g. compared to books one difference is that itâs not sequential. âI was reading the Internetâ sounds odd, so maybe there could be a term for âreadingâ codebases.
=== Reply from Estrella Kowalski ===
I think ânavigatingâ is a good term for it.
2023/12/14
It felt like I didnât do much refactoring during Advent of Code 2023 in Kotlin Day 4 stream so I made an attempt at making a #refactoring golf based on the exercise https://github.com/dkandalov/aoc-golf-day4-2023 Let me know if itâs usable đ
2023/12/10
I still regret I didnât make it to this gig by Alpha Male Tea Party in 2017 https://www.youtube.com/watch?v=YwPta95y9_o đ I had to prioritise and be at @ACCUConf in Bristol instead. Similar to the band, itâs not the most known conference (outside the C++ world) but highly recommended regardless of the programming language you use.
2023/12/09
Good to see that #IntelliJ got a new âLift function call out of âwhenââ (refactoring) inspection since I did the Gilded Rose talk at KotlinConf https://www.youtube.com/watch?v=AxxNHKCldzA Thank you, Toshiaki Kameyama đ
2023/12/08
I donât have a cat to take a photo with the âTidy First?â book #TidyCat But there is a TCR Bar in London đ To be clear, in this case, TCR stands for Tottenham Court Road, not âtest && commit || revertâ. Are there any rich geeks to open TDD Bar in London, maybe in Shoreditch? đ§ /cc @kentbeck
2023/12/07
Thinking about copy-paste issues, #Microsoft is the winner. Formatting issues, broken shortcuts and copy-paste doing nothing at all. Unbelievable! It worked better 20 years ago. Should there be a consumer protection law, so that big companies are obligated to fix basic bugs? đ€
2023/12/06
(Summoning the power of social media đȘđ ) When you copy text/code, and then paste it, you expect to see exactly the same code/text. Unfortunately, this is not the case when editing #Kotlin in #IntelliJ. Could this issue be moved out of the backlog (aka âneverâ) please https://youtrack.jetbrains.com/issue/KTIJ-10687/Copy-Paste-should-preserve-static-imports
=== Update ===
It worked! The issue is going to be fixed in Intellij 2024.1 đ„ł
2023/12/05
Why do you need a pull request to revert the last merged pull request (assuming nothing else was committed)? đ Not really asking the question but answers are welcome.
2023/12/04
@sebi_io and I will be pair programming #AdventOfCode day 4 in #Kotlin later today đ https://www.youtube.com/watch?v=I0nCFMDkPNo Come join us live! Nothing is scripted but hopefully, there will be some refactoring đ
2023/12/02
Short-lived pull requests are fine from the CI point of view. But if theyâre so short, why bother with the PR bureaucracy? What about reviewing commits and fixing anything thatâs wrong? Maybe even talk to the author of the code đ
2023/12/01
This is your regular reminder that long-lived pull requests are missing the whole point of CI. Great video by @davefarley77 đ https://www.youtube.com/watch?v=v4Ijkq6Myfc
2023/11/29
In case you missed it, there is a new book by @kentbeck Tidy First?: A Personal Exercise in Empirical Software Design đ„ł
2023/11/28
When using Result/Either type in #Kotlin, it can be tricky to make sure they are always handled. Could we please get annotations to mark types that cannot be ignored? AFAIK this functionality has been in #Rust for years! See https://youtrack.jetbrains.com/issue/KT-12719
2023/11/26
Do you know any good resources (blogposts, tutorials, katas or videos) about using Result/Either types in #Kotlin?
=== Answers ===
- https://arrow-kt.io/learn/typed-errors/either-and-ior
- https://arrow-kt.io/learn/typed-errors/working-with-typed-errors
- Kotlin Design Patterns and Best Practices but 3rd edition!
- In case Iâm going to read this again, there are blog posts by Duncan McGregor here http://www.oneeyedmen.com/failure-is-not-an-option-part-6.html
- I should write one myself!
2023/11/25
If you are/were at the #devfestberlin2023 today, you can find the slides and code from my talk here https://github.com/dkandalov/gilded-rose.
2023/11/24
Fundamentally, #Kotlin coroutines is compiler transforming code into a state machine. They are in stdlib, e.g. Sequence builder. Nothing to do with async. And there are async coroutines in kotlinx.coroutines built on top. Both are âcoroutinesâ. Obviously, not so obvious.
2023/11/22
I wish #Kotlin stdlib had Flow-like API with onStart/onComplete/catch/etc. for Sequence/Iterable. And maybe cancellation by making them AutoClosable (?) đđ€ (Iâm sure there are some good discussions on youtrack, slack and Kotlin forum.)
2023/11/21
How wrong is it to use #Kotlin Flow with this? đŹ
=== Reply from Simon Vergauwen ===
Pretty bad, because context preservation breaks with EmptyCC.
Otherwise itâd be similar to GlobalScope.launch(NonCancellable + Dipsatchers.Default) { }
.
2023/11/20
Another idea is to have more terms than just âtech debt.â For example, distinguish it from âtech underinvestmentâ as suggested by @natpryce. Maybe a separate term for code ageing, when code becomes obsolete because of programming language and technology changes.
2023/11/19
Itâs unfortunate that âtechnical debtâ is the only widespread term we have. Maybe âtechnical shortcutsâ is a bit more descriptive and less metaphorical đ€ I also like a bit more opinionated âunsuitable codeâ by @lukesleeman.
2023/11/18
Another deceitful metaphor is technical debt. The problem is that it implies the predictability of debt. In practice, itâs often a trap with no clear way out (like piling up pieces in Tetris). Compounded by the sunken cost fallacy, the âdebtâ is even less likely to be untangled.
2023/11/16
In case anyone needs a podcast recommendation, Troubleshooting Agile is one of my all-time favourite and probably not very well-known podcasts. Thank you, Jeffrey Fredrick and Douglas Squirrel, for producing great content! See also https://agileconversations.com
2023/11/15
Another annoyingly bad metaphor is #git blame. It doesnât explain how the tool works and suggests harmful behaviour. Even worse, the command itself is too surface-level and not good at finding commit with the actual change đ (I mostly use âShow History for Selectionâ in #IntelliJ)
2023/11/14
On the topic of wrong metaphors, Iâm still annoyed that most #git projects used a tree-branching metaphor mixed with master/slave, and when there was a chance to change the âindustry standardâ, most went for âmainâ (maybe related to pipes đ€·) instead of âtrunkâ đ
2023/11/12
In case you happen to be in Berlin in a couple of weeks, Iâll be at GDG DevFest presenting the Gilded Rose refactoring kata. Come say hi. Iâm also happy to pair on the kata and maybe record it (as I used to do pre-pandemic).
2023/11/11
Old startup idea: âTwitterâ for codebases where you could follow/like/reply to functions/classes/files/branches/people. A similar thing suggested by Kent Beck: https://tidyfirst.substack.com/p/idea-codefeed. Does anyone want to do a proof-of-concept? Maybe in #Kotlin? KMP? đ±đ
2023/11/10
Somewhat surprisingly, the âunimportant implementation detailsâ like using âeventually {âŠ}â in tests can have a cascading effect via slow CI/deployment on software design, people behaviour, and organisation overall. Similarly, a slow compiler/IDE is never about time.
2023/11/09
Another possible side effect of slow CI/deployment is over engineering. Some of it is a rational response to not being able to fix things quickly. Some, I suspect, is keeping yourself entertained which is then post-rationalised to be necessary.
2023/11/07
Working in an environment with slow CI/deployment, itâs not impossible to be upset when someone breaks deployed software and it takes hours to fix. So, if youâre not careful, this creates peer pressure on the team, and maybe you get a bit of pressure from yourself.
2023/11/06
Slow CI builds increase the time it takes to fix things after deployment. At the same time, larger code changes (encouraged by slow CI) are more likely to have problems. That creates a higher stake environment in which you really donât want to make a mistake đ
2023/11/05
The problem with slow CI is not just the time it takes but also the behaviours it encourages. Waiting a couple of hours for a minor change seems like a waste, so itâs tempting to batch up a few changes or do something else in parallel, which increases work-in-progress.
2023/11/04
Overall, eventually {...}
in tests is a code smell, similar to delay(5.seconds)
waiting for the clock to move forward. There are ways to avoid it, and itâs ultimately your choice. Continuous integration is not supposed to be âcontinuousâ because the build takes 24 hours.
2023/11/03
To be fair to projects with eventually {...}
in tests, it can be hard to control concurrency or change design with tech decisions made a while ago and the code tied to a framework that does its own thing. You just end up copy-pasting eventually
in the name of consistency đż
2023/11/02
There is no magic avoiding eventually {...}
in tests. The basic answer is to have control over concurrency (like controlling time with the Clock). If itâs the code you can modify, then change its design. If itâs an external technology, wrap it in a minimal API and use a fake.
2023/11/01
Another problem with eventually {...}
is that itâs easy to sprinkle tests with it but can be really hard to remove because the design wonât let you control concurrency and itâs hard to refactor with the build being slow and flaky. Itâs a trap! đ #testing #rant
2023/10/31
The reason why using eventually {...}
in tests is not a good idea is that it will make your build slow and non-deterministic. Retries will slow down passing tests, timeouts will make failures even slower, and failure messages will read like âsomething didnât happen on timeâ đ€·
2023/10/30
If you use something like eventually {...}
function all over the tests (which retries with timeout the lambda until it succeeds), the chances are youâre doing it wrong. Ideally, refactor concurrency youâre waiting for out of the core logic and test concurrent things separately.
2023/10/29
To be clear, I suggest projectional editor for #Kotlin/#Java not just for formatting, but for overall code layout and how we experience working with codebases. For example, ânavigationâ could show functions next to each other, or maybe hide private fields or some âobviousâ types.
2023/10/27
Since itâs nearly impossible to âwinâ any code style/formatting argument, could we have a projectional editor for #Kotlin/#Java, e.g. as an IntelliJ plugin please. It has to be clever though to project into the âcurrent code styleâ in text format đ§
2023/10/26
I wonder how much code layout (letâs say just within a file) affects how we think about programs. Is there any research? đ€đŹ What if changing the layout could shift overall project design to be less data centric for example?
2023/10/25
Thinking about details first/last in #Kotlin classes, the default style is neither. It seems to be guided by object initialisation and execution order (init fields, invoke constructor, public/private functions). As a reader youâre supposed to play the role of a computer I guess đ€·
2023/10/24
Timeless question: define details first or last? In particular, in a #Kotlin file should data classes used in an interface be defined before or after the interface? If details last, then shouldnât all fields/properties be at the bottom of the class? Do you, should you care?
=== Reply from Jordan Stewart ===
Most important thing first. Probably not quite right, I like to think of it as similar to writingâs âinverted pyramidâ â https://en.m.wikipedia.org/wiki/Inverted_pyramid_(journalism)
=== The hill Iâm happy to join Chris Oldwood on ===
2023/10/23
This is a somewhat obvious thing to say but if you use randomly generated objects in tests, you really need to have a seed. Otherwise, itâs a lot of fun with not very reproducible failures and builds. Also donât assume that two random values are not equal đ
2023/10/22
Thinking about namespace pollution in #Kotlin via extension functions, is fun Iterable<T>.foldResult() {...}
a good idea? The problem is that foldResult
will appear in the auto-completion list for any Iterable even if itâs not using Result type đ€ https://github.com/fork-handles/âŠiterables.kt
2023/10/20
In #kotest tests are just functions. So they can be extracted into other extension functions like this:
Clever but the problem is that you canât run just one test from IDE đ Use abstract class instead? #UXfail
2023/10/19
Back to #kotest rants. Because kotest has âbuilt in coroutine support at every levelâ when an assertion fails, you canât navigate to the matcher source code from the stack trace (Kotlin coroutines are stackless). So good luck if the error message is not very clear.
=== Reply from James Ward ===
I wonder if Stacktrace Recovery could help: https://github.com/Kotlin/kotlinx.coroutines/blob/master/docs/topics/debugging.md#stacktrace-recovery
2023/10/18
Random #IntelliJ tip. You can select multiple items in lists/trees and apply action to all of them. E.g. select files in project view, press enter and all selected files will be open. The same works with find/show usages. Or abstract function can be implemented on all classes by using âselect allâ via ctrl/cmd+A, then âenterâ đ
2023/10/17
The reason lambda flavours in #Kotlin could be useful (e.g. with different/combined background colour in IDE) is that the meaning of indentation is diluted by âboringâ let/apply/âŠ, parameters on separate lines, nested functions, etc. Also .map() on collections vs Result type đ”
2023/10/16
I wonder if #Kotlin contracts could capture lambda flavours and maybe visualise them in IDE đ€ E.g. let
runs lambda once, ?.let
maybe once, forEach
many times, executor.submit{}
runs on a different thread later. (Also havenât heard much about contracts for a while.)
2023/10/15
To be fair, with ?:
extracted into a function and using let
with reference is an interesting alternative to if/else. Thanks to @natpryce for suggestion.
=== Reply from @natpryce ===
Nice. And to avoid duplicating logic, you could define:
And then define:
2023/10/14
Which of these Kotlin one-liners do you prefer?
or
Iâm in favour of if/else, ?.let
is overrated and can be against the âgrainâ of Kotlin đŹđ
2023/10/13
In case you havenât seen it yet, here is a perfect Friday video content: The Art of Code by Dylan Beattie (the classic recording at NDC London).
2023/10/12
This is your regular reminder that pull requests are a waste in a typical company environment. PRs make you cosplay continuous integration instead of actually doing it. See this blog post by Benji Weber for details https://benjiweber.co.uk/blog/2020/02.
2023/10/11
Would you rather have a feature/tool which depends on some non-public API (and can break in the future without notice) or not have the feature/tool at all? Iâd choose the first option. Also in my experience some public APIs end up as volatile as internal ones đ€·đ€
2023/10/10
#IntelliJ tip for #Kotlin. You can search for class default constructor (instead of class usages) by positioning cursor before the paren â(â. Like this class Foo|(val n: Int)
and invoke âShow Usagesâ action. I found it by chance. Wish it was more discoverable though đ§
2023/10/07
What about namespace âpollutionâ by extension functions in #Kotlin? E.g. a library with fun Any?.print()
(yes, itâs a #kotest #rant again) will add print()
to code completion popup for all objects. Sure, IDE can deprioritise it, but maybe donât do it in the first place?
2023/10/06
More #kotest #rants⊠shouldHaveSize()
is helpful enough to print the whole (actual) list when sizes donât match. Good idea unless the list contains large data classes. Good luck scrolling around Gradle output for the failure message. OTOH, it could be symptom of a bad test đ€
2023/10/05
Another #kotest #rant is that most of its matchers donât show diff window in IntelliJ with JUnit5 runner. It tries but most matchers throw AssertionError
(no diff) and some AssertionFailedError
(has diff) đ€·đ Makes you wonder if kotest authors actually use it via IntelliJ.
2023/10/04
Kotest has eventually()
function which retries lambda until it succeeds or times out. Not the best idea to use it across all tests in the first place, but in addition kotest prints stack trace from the first and the last failure, so you end up scrolling down đ€Šâ #kotest #rant
2023/10/03
Thinking about comments Iâm definitely in the camp of avoiding comments in the code unless itâs really necessary. Itâs better to have a good variable/function name or a test case to explain a subtle detail. This includes test case names which look like wordy comments đ
2023/10/02
If you care about how the source code is formatted, how variables/functions/etc. are named, then it might be worth caring as much about comments. Re-read them after writing, use spell checker and maybe start comments with a capital letter (as if it was a sentence because it is)?
2023/10/01
Another interesting idea is to have stack traces with granularity down to expression/statement instead of just line number. They might need to be aware of the testing library to trace creation of matchers, etc. Not easy to implement for #Kotlin on the JVM and even harder for Kotlin multiplatform đ
2023/09/30
In many environments where we run tests (locally, CI pipelines) we have access to the source code. When a test fails, why not use it to show code of the failed line/paragraph before the failure message? đ€
As couple people have pointed out there is https://github.com/laech/java-stacksrc. I havenât tried it yet, but it looks promising.
2023/09/29
The History of Cursor Keys https://www.youtube.com/watch?v=BytowtVycc0 Fun to see all the crazy cursor keys layouts from the past. Although for software development I really prefer alt+IJKL, see https://github.com/dkandalov/ijkl-shortcuts-plugin Everything else is suboptimal! đ
2023/09/28
Most assertion libraries (in #Kotlin and other languages) reimplement language features (not, or, and, equals etc) and standard library (contains, isEmpty, etc). I wish there was more effort to make tools like https://github.com/bnorm/kotlin-power-assert work really well.
2023/09/27
To be fair, the previous example could use matcher composition where beSuccess() is not an expression (it will be type-safe with #Kotlin contracts). Thanks to @sf105 for pointing that out.
2023/09/26
A better example of Result.expectSuccess()
used as an expression.
If Result is treated like checked exception, it should be ok to handle it in any part of the test đ€
2023/09/25
Thinking about the example with Result.expectSuccess()
a bit more complete test might look like this:
Which pushes one of the assertions into the âwhenâ step đ€
2023/09/24
I wish more #Kotlin assertion libraries had assertion functions as expressions so that they could be chained. For example:
2023/09/23
This is your regular reminder that pull requests is a waste when working with people you know and trust (e.g. same company). Here is a more detailed reasoning by @d_stepanovic https://vimeo.com/842233600 (thanks to @quii for the link) #pullrequest #programming #softwareengineering #coding
2023/09/22
You might have noticed that most meetings and conferences follow the same pattern of one person talking and everyone else listening. (Ok, maybe enterprise âagileâ made standups and retros more widespread.) But is it the only way for a group of people to collaborate or share information? Not at all! Welcome Liberating Structures đ https://www.liberatingstructures.com/ls-me
2023/09/21
Random #IntelliJ tip. There is âShow Gradle Daemonsâ action which shows daemons with pid, status, etc. and lets you stop them. Itâs not in any menu, but you can invoke it via âFind Actionâ (cmd+shift+A or ctrl+shift+A). As with most tips itâs probably a UX failure⊠I mean an opportunity for improvement đ
2023/09/20
Here is another basic function I wish was in #Kotlin stdlib
This is really just ?.let
but I think ifNotNull
follows the Kotlin way by being more explicit.
2023/09/19
Not many people consider this but CONSTANTS DONâT NEED TO BE UPPERCASE. Theyâre not the most important thing in the code and donât need the emphasis (e.g. unlike mutable global variables). The convention dates back to the early days of C and the need to distinguish symbolic constants defined as macros from variables đ https://accu.org/journals/overload/22/121/wakely_1923 Itâs never too late to stop the cargo cult! Can we have it in #Kotlin 2.0 please? đ
2023/09/18
One of the basic functions I wish was in #Kotlin stdlib (originally by Duncan McGregor)
So you can do foo.update().printed()
without extracting a variable and using a separate line for println().
2023/09/17
Rick Beato has a great YouTube channel. In particular, âWhat Makes This Song Great?â videos, e.g. Metallica - âMaster of Puppetsâ Breakdown. Iâm wondering if there is something similar for #software analysing/appreciating/criticising well-known projects. Should John Carmack or Dave Farley do it? đ
2023/09/16
Does the âSmall adviceâ in this talk mean that explicitly specifying return type for public functions will noticeably improve compiler/IDE speed? If yes, it sounds like an inspection đ€ #Kotlin #IntelliJ
There is âPublic API declaration with implicit return typeâ inspection in âKotlin->Other problemsâ disabled in the default profile. If itâs really going to make difference and is recommended in general, should it be enabled then?
2023/09/15
Iâm pretty sure I read a few years ago that #Mastodon (social network) was named after Mastodon (a metal band). However, most articles I can find now are saying Mastodon (social network) was named after the animal. Does anyone know more of the backstory? https://www.youtube.com/watch?v=s6WGNd8QR-
2023/09/14
Videos from JVM Language Summit 2023 https://www.youtube.com/playlist?list=PLX8CzqL3ArzW90jKUCf4H6xCKpStxsOzp I enjoyed âThe Challenges of Introducing Virtual Threads to the Java Platformâ đ
2023/09/13
It might be the âold man yells at cloudâ problem but many tools which are supposed to empower developers are achieving the opposite. More levels of indirection, more configs, slow pipelines, etc. instead of faster feedback loops (on faster modern hardware). There is a joke that k8s is a conspiracy by big tech to slow down the rest of the industry đł
2023/09/12
Here is the simplest way to implement any interface in #Kotlin đ Aka mocking library in four lines of code. (I didnât come up with it though so canât take the credit.)
2023/09/11
If youâre interested in #Kotlin, KotlinConf on May 23-24 next year will be a good excuse to visit Copenhagen. Itâs the same venue as in 2019 which was quite nice. And donât forget the best way to get the ticket is by submitting a talk https://sessionize.com/kotlinconf-2024 đ (As always, you donât really need to be an expert in the field to do a good talk!)
2023/09/10
Super slow search for #Kotlin data class components in IntelliJ is a massive contributor for me not enjoying Kotlin as much as I could. It feels that problems like this one are too fundamental to not be fixed on day one đ Unreliable/slow search defeats the whole point of IDEs.