Posts Tagged ‘Twitter’
[KotlinConf2017] My Transition from Swift to Kotlin
Lecturer
Hector Matos is a senior iOS developer at Twitter, with extensive experience in Swift and a growing expertise in Kotlin for Android development. Raised in Texas, Hector maintains a technical blog at KrakenDev.io, attracting nearly 10,000 weekly views, and has spoken internationally on iOS and Swift across three continents. His passion for mobile UI/UX drives his work on high-quality applications, and his transition from Swift to Kotlin reflects his commitment to exploring cross-platform development solutions.
Abstract
The similarities between Swift and Kotlin offer a unique opportunity to unify mobile development communities. This article analyzes Hector Matos’s presentation at KotlinConf 2017, which details his transition from Swift to Kotlin and compares their features. It explores the context of cross-platform mobile development, the methodology of comparing language constructs, key differences in exception handling and extensions, and the implications for fostering collaboration between iOS and Android developers. Hector’s insights highlight Kotlin’s potential to bridge divides, enhancing productivity across mobile ecosystems.
Context of Cross-Platform Mobile Development
At KotlinConf 2017, Hector Matos shared his journey from being a dedicated Swift developer to embracing Kotlin, challenging his initial perception of Android as “the dark side.” As a senior iOS developer at Twitter, Hector’s expertise in Swift, a language designed for iOS, provided a strong foundation for evaluating Kotlin’s capabilities in Android development. The context of his talk reflects the growing need for cross-platform solutions in mobile development, where developers seek to leverage skills across iOS and Android to reduce fragmentation and improve efficiency.
Kotlin’s rise, particularly after Google’s 2017 endorsement for Android, positioned it as a counterpart to Swift, with both languages emphasizing type safety and modern syntax. Hector’s presentation aimed to bridge the divide between these communities, highlighting similarities that enable developers to transition seamlessly while addressing differences that impact development workflows. His personal narrative, rooted in a passion for UI/UX, underscored the potential for Kotlin and Swift to unify mobile development practices, fostering collaboration in a divided ecosystem.
Methodology of Language Comparison
Hector’s methodology involved a detailed comparison of Swift and Kotlin, focusing on their shared strengths and distinct features. Both languages offer type-safe, concise syntax, reducing boilerplate and enhancing readability. Hector demonstrated how Kotlin’s interfaces with default implementations mirror Swift’s protocol extensions, allowing developers to provide default behavior for functions. For example, Kotlin enables defining function bodies within interface declarations, similar to Swift’s ability to extend protocols, streamlining code reuse and modularity.
He also explored structural similarities, such as both languages’ support for functional programming constructs like map and filter. Hector’s approach included live examples, showcasing how common tasks, such as data transformations, are implemented similarly in both languages. By comparing code snippets, he illustrated how developers familiar with Swift can quickly adapt to Kotlin, leveraging familiar paradigms to build Android applications with minimal learning overhead.
Key Differences and Exception Handling
Despite their similarities, Hector highlighted critical differences, particularly in exception handling. Swift treats exceptions as first-class citizens, using a do-try-catch construct that allows multiple try statements within a single block, enabling fine-grained error handling without nested blocks. Kotlin, inheriting Java’s approach, relies on traditional try-catch blocks, which Hector noted can feel less elegant due to potential nesting. This difference impacts developer experience, with Swift offering a more streamlined approach for handling errors in complex workflows.
Another distinction lies in Kotlin’s handling of extensions, which are declared in separate files without requiring curly braces, unlike Swift’s protocol extensions. This syntactic difference enhances readability in Kotlin, allowing developers to organize extensions cleanly. Hector’s analysis emphasized that while both languages achieve similar outcomes, these differences influence code organization and error management strategies, requiring developers to adapt their mental models when transitioning between platforms.
Implications for Mobile Development
Hector’s presentation has significant implications for mobile development, particularly in fostering collaboration between iOS and Android communities. By highlighting Swift and Kotlin’s similarities, he demonstrated that developers can leverage existing skills to work across platforms, reducing the learning curve and enabling cross-platform projects. This unification is critical for companies like Twitter, where consistent UI/UX across iOS and Android is paramount, and Kotlin’s interoperability with Java ensures seamless integration with existing Android ecosystems.
The broader implication is the potential for a unified mobile development culture. Hector’s call for community engagement, evidenced by his interactive Q&A, encourages developers to share knowledge and explore both languages. As Kotlin and Swift continue to evolve, their shared design philosophies could lead to standardized tools and practices, enhancing productivity and reducing fragmentation. For developers, this transition opens opportunities to work on diverse projects, while for the industry, it promotes innovation in mobile application development.
Conclusion
Hector Matos’s presentation at KotlinConf 2017 offered a compelling case for bridging the Swift and Kotlin communities through their shared strengths. By comparing their syntax, exception handling, and extension mechanisms, Hector illuminated Kotlin’s potential to attract Swift developers to Android. The methodology’s focus on practical examples and community engagement underscores the feasibility of cross-platform expertise. As mobile development demands increase, Hector’s insights pave the way for a unified approach, leveraging Kotlin’s and Swift’s modern features to create robust, user-focused applications.
Links
[ScalaDaysNewYork2016] Finagle Under the Hood: Unraveling Twitter’s RPC System
At Scala Days New York 2016, Vladimir Kostyukov, a member of Twitter’s Finagle team, provided an in-depth exploration of Finagle, a scalable and extensible RPC system written in Scala. Vladimir elucidated how Finagle simplifies the complexities of distributed systems, offering a functional programming model that enhances developer productivity while managing intricate backend operations like load balancing and circuit breaking.
The Essence of Finagle
Vladimir Kostyukov introduced Finagle as a robust RPC system used extensively at Twitter and other organizations. Unlike traditional application frameworks, Finagle focuses on facilitating communication between services, abstracting complexities such as connection pooling and load balancing. Vladimir highlighted its protocol-agnostic nature, supporting protocols like HTTP/2 and Twitter’s custom Mux, which enables efficient multiplexing. This flexibility allows developers to build services in Scala or Java, seamlessly integrating Finagle into diverse tech stacks.
Client-Server Dynamics
Delving into Finagle’s internals, Vladimir described its client-server model, where services are treated as composable functions. When a client sends a request, Finagle’s stack—comprising modules for connection pooling, load balancing, and failure handling—processes it efficiently. On the server side, incoming requests are routed through similar modules, ensuring resilience and scalability. Vladimir emphasized the “power of two choices” load balancing algorithm, which selects the least-loaded node from two randomly chosen servers, achieving near-optimal load distribution in constant time.
Advanced Features and Ecosystem
Vladimir showcased Finagle’s advanced capabilities, such as streaming support for large payloads and integration with tools like Zipkin for tracing and Twitter Server for monitoring. Libraries like Finatra and Featherbed further enhance Finagle’s utility, enabling developers to build RESTful APIs and type-safe HTTP clients. These features make Finagle a powerful choice for handling high-throughput systems, as demonstrated by its widespread adoption at Twitter for managing massive data flows.
Community and Future Prospects
Encouraging community engagement, Vladimir invited developers to contribute to Finagle’s open-source repository on GitHub. He discussed ongoing efforts to support HTTP/2 and improve performance, underscoring Finagle’s evolution toward a utopian RPC system. By offering a welcoming environment for pull requests and feedback, Vladimir emphasized the collaborative spirit driving Finagle’s development, ensuring it remains a cornerstone of scalable service architectures.
Links:
[DevoxxUS2017] Continuous Optimization of Microservices Using Machine Learning by Ramki Ramakrishna
At DevoxxUS2017, Ramki Ramakrishna, a Staff Engineer at Twitter, delivered a compelling session on optimizing microservices performance using machine learning. Collaborating with colleagues, Ramki shared insights from Twitter’s platform engineering efforts, focusing on Bayesian optimization to tune microservices in data centers. His talk addressed the challenges of managing complex workloads and offered a vision for automated optimization. This post explores the key themes of Ramki’s presentation, highlighting innovative approaches to performance tuning.
Challenges of Microservices Performance
Ramki Ramakrishna opened by outlining the difficulties of tuning microservices in data centers, where numerous parameters and workload variations create combinatorial complexity. Drawing from his work with Twitter’s JVM team, he explained how continuous software and hardware upgrades exacerbate performance issues, often leaving resources underutilized. Ramki’s insights set the stage for exploring machine learning as a solution to these challenges.
Bayesian Optimization in Action
Delving into technical details, Ramki introduced Bayesian optimization, a machine learning approach to automate performance tuning. He described its application in Twitter’s microservices, using tools derived from open-source projects like Spearmint. Ramki shared practical examples, demonstrating how Bayesian methods efficiently explore parameter spaces, outperforming manual tuning in scenarios with many variables, ensuring optimal resource utilization.
Lessons and Pitfalls
Ramki discussed pitfalls encountered during Twitter’s optimization projects, such as the need for expert-defined parameter ranges to guide machine learning algorithms. He highlighted the importance of collaboration between service owners and engineers to specify tuning constraints. His lessons, drawn from real-world implementations, emphasized balancing automation with human expertise to achieve reliable performance improvements.
Vision for Continuous Optimization
Concluding, Ramki outlined a vision for a continuous optimization service, integrating machine learning into DevOps pipelines. He noted plans to open-source parts of Twitter’s solution, building on frameworks like Spearmint. Ramki’s forward-thinking approach inspired developers to adopt data-driven optimization, ensuring microservices remain efficient amidst evolving data center demands.
Links:
Twitter within GoogleReader
Let’s say immediatly there is no miracle solution and it required a bit of work…
If the title is not explicit enough, the goal of this post is to give a way to include Twitter flow within your GoogleReader. IMHO, the main features of GoogleReader over regular Twitter are the following:
- posts are stored on long term
- posts can be searched or filtered by keywords
- easy integration with Google Plus share button
- ability to give a priority to feeds (as in Google Plus’s circles)
- a simple interface to monitor all feeds
Unlike, following Twitter accounts on Google Reader (or even any other RSS aggregator) makes you lose the real time feature of Twitter.
This said, how to include your Twitter follow list within Google Reader syndication?
- For each of the accounts you follow on Twitter, get the userId.
- The easiest is to select a tweet > right click > source code > search the attribute “data-user-id”, get the associated number, eg: 813286 for @BarackObama, 50055701 for @MittRomney and 248309482 for my prefered one: @John_the_Cowboy ;-).
- Alternatively, you can request the following service: http://www.idfromuser.com
- In Google Reader, add a feed:
https://twitter.com/statuses/user_timeline/XYZ.rss. Replace “XYZ” with the actual number retrieved before
Of course, this is not easy at all, as said in the disclaimer above. It is long, takes much time, and can become fastidious if you follow tens of people. Anyway, Google Reader users are geeks rather than newbies. You may create a Groovy script of setup a Mule instance to automatize de process ;-).
I suggest you to create one or many folders to gather the Twitter feeds.