Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The worst codebase I've ever worked on was the Telegram client for Android. I mean just look at this file, it's so huge GitHub gives up rendering it: https://github.com/DrKLO/Telegram/blob/master/TMessagesProj/...

Or this one, it implements EVERYTHING for rendering and interacting with a message in a single class, all non-service message types, all drawn manually on a canvas "for performance", and all input processed manually too: https://github.com/DrKLO/Telegram/blob/master/TMessagesProj/...

I even had the permission from the main developer to refactor some of it, but I never got around to actually doing it.

It's a miracle this app works at all.



This dude has absolutely no right to say anything about the quality of the source code of the android app, because:

1) His libtgvoip code, previously used for audio calls, is the worst code I have ever had the displesaure of touching, it caused all kinds of issues ranging from instability to segfaults, and thankfully it was completely replaced by webrtc.

2) The android app is literally the smoothest and most responsive android app I've ever used.

Grishka, please stop being so salty. VoIP is hard to do right, but not impossibly so. VoIP being hard is still not an excuse for writing garbage C/C++ code (and I don't mean to offend personally here, but the code was really a mess, please stick to Java development on your own personal projects).


Speaking as an outsider... Your comment reads as a blatant ad-hominem attack and does nothing to support your point. You should consider toning it down if your goal is to convince anyone.


Some of us have trod this path before, and recognize righteous anger when we see it.


That's just a cultural difference. I've seen Russian developers getting into physical fights over code more than once.

Thankfully, western (and especially american) corporate culture is much more conflict-awerse.


1) Which version are we talking about? Segfaults were exceedingly rare either way. Especially so when I stopped using raw pointers. But yes, to no one's surprise, early versions were a mess. I can agree with you on that. I can't agree about the same about the last versions though.

It was replaced by WebRTC that would sometimes just suddenly disconnect your calls, right.

> I managed to improve the situation after weeks of refactoring and testing

Did you submit any PRs with your improvements? I used to review and merge those, unlike the Android app devs.

2) It might provide the best UX in the entire universe, but that still doesn't justify having a two-megabyte Java file with over a hundred anonymous inner classes that gaslight you because it's often a `new FrameLayout(activity){` that overrides onLayout and does something completely different. So you see a FrameLayout, you assume it behaves like one, you add views to it, then it doesn't work the way you expect. You start questioning your sanity and only then do you realize that it's one of these stupid things.

Oh and did I mention that even just editing ChatActivity.java is an exercise in frustration? At the time, I had a 2012 MacBook Pro that worked fine for everything I did on it, except editing 2-megabyte Java sources in Android Studio. It would sometimes take a solid 10 seconds for keystrokes to register.

In other words, it might be the best Android app in the world, but it blows up in your face nearly every time you try to add a new feature.


> but that still doesn't justify

No, that really justifies anything. Programs should be pleasant for users to use, not for developers to work on them


One does not exclude the other.

And, honestly, these things are connected. It takes more needless work from the developer to maintain the user-visible pleasantness while adding new features. The code is much more fragile than it could've been which means bugs are much easier to introduce and much harder to diagnose and fix.

And I'm not asking for a complete rewrite. Just losslessly restructure the existing code, extract all those custom FrameLayouts and ViewGroups into separate classes, split those 2000-line if statements into separate methods, make some things (like ChatMessageCell) into sensible class hierarchies, introduce constants or enums to replace magic numbers, all that sort of stuff. This will not affect the UX, but it would make bugs harder to introduce and easier to deal with.

I'm generally not a fan of the developer-experience-focused approach to software development (Electron, React, and the web dev "trust me bro" attitude should not exist), but sensible code structure is where I draw the line.


Tell me you're not a professional software engineer without telling me you're not a professional software engineer.


Telegram happens to be one of the smoothest app experiences on Android, both in terms of perf and UX, so they must be doing something right.


Well, Telegram is faster/smoother than FB Messenger, Whatsapp, Discord (dog slow) etc...

So it is not only working but working well.


It’s even more crazy because Telegram is by far the smoothest messenger app on Android.

BTW, would you mind sharing how you got that job?


> BTW, would you mind sharing how you got that job?

I started working with Pavel Durov in 2011 on the VKontakte Android app, after winning several of his developer contests, and it all just went from there. I was the last one of the "old" team to transfer to Telegram. My main job was actually the libtgvoip[1] library and its integration into the Android app (the other platforms were done by their corresponding devs).

I got fired in 2019 because the calls weren't working satisfactorily for Pavel. He got furious when he was unable to call some journalist, cursed at me in front of the entire team and sent me a termination notice. In hindsight, I should've definitely not taken building a VoIP library from scratch alone upon myself. It's a massive undertaking. But at least I learned a lot, and many people say that my implementation performed noticeably better than the current WebRTC-based one ¯\_(ツ)_/¯

I'm now working on two fediverse projects at the same time — Smithereen[2], a VK-like ActivityPub server, and the Mastodon Android app[3].

[1] https://github.com/grishka/libtgvoip

[2] https://github.com/grishka/Smithereen

[3] https://github.com/mastodon/mastodon-android


> He got furious when he was unable to call some journalist, cursed at me in front of the entire team and sent me a termination notice.

Honestly does not sound like a very healthy person to work for anyway.


Does this seem like a healthy person to you?

https://www.instagram.com/durov/


Depends on what you mean by "healthy". Physically, yes, sure looks so. But that's just one definition.


I feel like those are missing a bear.

I guess the best thing that can be said is at least he’s confident enough in himself to post that.


No, that's painfully cringe.


There are two sides to every story


There's no side where berating your subordinates in front of others is justified. That's unprofessional and childish. Always.


Sure, but I do not feel like it’d really affect the broad strokes of ‘criticized in front of the entire team’.


What was it like to work for telegram/durov? A part from the "getting fired" part that is ;)


Why did the call fail? What failed with your implementation/the code?


We'll never know. There are many things that could go wrong because VoIP over the public internet is inherently fragile. When I asked for logs so I could look into it, I got cursed at once again.


Grishka wrote very low quality code (an extremely buggy and segfaulty mess of C and C++), combined with little testing in not-so-edge case network conditions.

I managed to improve the situation after weeks of refactoring and testing for my library, and thankfully now it was completely replaced by webrtc.


They didn't specify it was their job, the project is open source after all.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: