ThinkTekAway, civil engagement lives here. Aloha. I'm your host, David Tatsaka, and delighted you are joining us today for this out-and-about show where we explore a variety of topics, organizations, events, and the people who fuel them in our city, state, country, and world. As a disclaimer, any views or opinions expressed by me are strictly my own and not connected with any organization. Joining me in the studio today is Ken Nishihirao, business owner and the incoming district director for Toastmasters District 49. Ken is a distinguished Toastmaster and is the district director for District 49 Toastmasters. His district includes Hawaii Island, Oahu, Maui, and Kauai. In 2016, as the club growth director for District 49, Ken started seven new clubs for his district. This helped the district attain distinguished status for that year. He is a licensed land surveyor and the owner of KN Surveying, LLC. He has been in land surveying since he was 18 years old in 1978. He started from the bottom and worked his way up. When he's not working or participating in Toastmasters events, he spends his time with his wife of 35 years and with three kids and four grandchildren. Welcome to the show today, Ken. Thank you, David. I'm glad to be here. Tell us a little bit about your background, Ken. Where were you born and grew up? I was born and raised in Kalihi. Oh. I grew up in Kalihi. I went to Farrington and right after high school, I started working as a land surveyor. Wow. How did that happen? Was your father a surveyor or uncle or friend? No, actually, I got that job from an employment counselor. Oh, wow. I was going to be a baker, actually. Big difference now. But the employment counselor said it would be better if I do land surveying. Wow. That was a big catalyst for who you are today. It taught me a lot of things about life and about hard work, too. Good. Good. Good. Where did you first work when you became a surveyor? The first company I worked for is the R&M Tower Corporation. Oh, I know about them. You know, then after that, I went to Virginia Surveys, Hawaii. Oh. Then I worked for the state DOT, we laid out the H3 Freeway. Wow. And then went to the city and county of Honolulu. There I became a licensed land surveyor. What is a licensed land surveyor? What does that mean? Well, that means you're, it's a profession. And it means you're licensed to practice surveying in the state of Hawaii. And so it's up there with engineers and architects. Wow. The test is really hard. So you have to go through qualifications and testing to get that designation. Right. You have to be qualified. You have to, you have to have, I think at my time, was two licensed land surveyors would have to write a recommend you. Wow. Yeah. For your character. So you had to jump to big hoops or small hoops to get to where you are today. It was, it was, it was a big jump. Wow. Congratulations. Thank you. Tell us a little bit about how you got involved with Toastmasters. Well, back in 2010, while working at the city, you know, one of my coworkers had an open house, so she invited me to one of the club meetings. And I went to the club meeting and, you know, I thought I don't, at first I didn't think I could do it, you know, because I had to speak in front of people. But I knew that, you know, it would be better for me if I learned and overcome my fear. So, you know, I thought about it hard and I took the big jump. I joined Toastmasters. Wow. And from then on, you know, it transformed my life, actually. What's one thing that you think it helped you with? It helped me with my confidence and my self-esteem. So once I got that, and once I knew that I had more confidence, I just, I went, you know, bonkers on Toastmasters. I just went to every meeting, I made a lot of speeches, so, you know, worked my way up and I started to serve the district as a district director, district leader. And that made me grow more because, you know, I grew as a leader from serving as a leader. It's like a laboratory where you can learn by your mistakes and, you know, all your trial and error.  You try something else and it works better. So then I learned how to work with people and it actually helped me in my job at the city because I became a supervisor.  That's wonderful. So that was awesome. Definitely benefits for you joining Toastmasters and really getting involved in learning to be a public speaker, but also to create leadership skills in your life. Exactly. How did you happen to be on the leadership team that got you to where you actually are now? Well, they always have a survey, you know, in a club meeting if I want to serve as a district leader. So the first couple of years I joined Toastmasters, you know, I said, no way, I'm never going to serve as a leader.  But after I gained more confidence, after maybe the third year, I said, yeah, why not, you know, you know, I accomplished a lot of things. I got my confidence, you know, I overcome my fear of public speaking. So yeah, I joined as a district leader. And from there on, I learned a lot more about leadership, about people, and I learned about myself. So I just continued, continued whatever the district asked of me. I would say yes. Well, that's terrific, Ken. You know, being a Toastmaster myself, I've seen that joining Toastmasters is such a great opportunity to learn and grow personally, professionally, and just in terms of communication in general. And I found that joining Toastmasters is the only place that I could practice without fear of embarrassment or a fear of making a fool of myself. And I always felt unconditional and loving support. Did you find the same thing? Yes, exactly. That's the reason why I stay at Toastmaster because everyone, every club gives you support and you can feel the love, you know. So after I joined Toastmasters, I became more loving too because, you know, you feel the love around you with your support from your fellow club members. So now I feel the same love, yeah? And that's why my goal is to build the district, a membership by 10 percent in membership and 10 percent in clubs because I want to spread the love too. How many clubs are there and how many members are there in District 49? There are 65 clubs right now. We took a hit last year. Started with 73 and it went down. And the membership went down too, I think it was 2,000. What are some of your goals for your administration? And I know you have two others that are on your executive team. My goal is to build a membership by 10 percent and create new clubs by 10 percent so that at the end of the year, we have 10 percent more clubs and 10 percent more membership also to enhance the quality of the clubs because, you know, the members' achievement is the most important. Until I joined Toastmasters, I had a great experience. That's why I'm the district director today. But I also want to give that to the rest of the membership so they can get the same experience that I received. It appears that you were very fortunate to have a great experience, probably good mentors along the way. Probably made a lot of friends through Toastmasters. I made a lot of friends. Ever since I joined Toastmasters, I had no problem meeting people now. And no problem interacting with people. So that's what Toastmasters means to me because they have given me so much love and friendship all over. My life is fulfilled, like I live a full life. Tell us a little bit about what a person can experience if they come and visit a Toastmasters club. Well, you're going to come into a friendly atmosphere. Every club is friendly. And they will have their speeches and, you know, they'll have evaluation. They'll have table topics. Table topic is impromptu speaking. Table topic master will ask a question and choose one of somebody from the audience or somebody from the membership that hasn't spoken that day. And then they'll come up to a two-minute speech. Wow.  And if you feel like you want to join, you're welcome to join. What are some of the trainings that Toastmaster offers to members?  But then you need an officer, you need officer, executive officers to run the club successfully. So you may be asked to join as a club officer. So if you join as a club officer, whatever position you choose, you will go get training on that so you can do your job better. And so you're learning how to do your job as an officer for the club better. And at the same time, you're learning how to do that. And you can transform it to your regular life or your job.  I've seen that there's some significant changes to Toastmasters in this past year. And it's because they've changed the way that education is done with a new system called Pathways. Would you share a little bit about Pathways and perhaps why they went on this route? Yeah, Pathways is a new educational system. I think they went through that route because it's more geared to the individual, you know. So you take an assessment test to see what are your, more likely your strengths are and more likely what your personality is. And then they give you a choice about three choices. You have eight different paths, but they give you about three choices and you can pick one. And that, when you pick that choice, you're going to go to that path and you start off at level one doing your icebreaker and then you get evaluated.  And level two, three and four and five, you get five levels. Wow. Yeah, it's pretty, pretty, because in the old days, a couple of years ago, they had a manual. So you go through the manual, do your speeches. So it's kind of a really different time for Toad Smith. It's changing time. And, you know, so I guess some of the members will have hard time changing, especially the old timers that used to do the old way, because the old way was good. You know, it built leaders and communicators. But this is the new way and we're just going to embrace the new way. Well, Ken, I'm just impressed. Being a Toad Smith to myself, I know the pathways is the path of the future. And I truly acknowledge you. And we're going to be taking a short break. I'm David Tosaka. This is Out and About on the Think Tech Live Streaming Network. We're here today with Ken Nishihira, Business Director for Incoming District Director for Toad Smith's District 49. We'll be back in a minute. So stay tuned for more of this story. Hello, everyone. I'm DeSoto Brown, the co-host of Human Humane Architecture, which is seen on Think Tech Hawaii every other Tuesday at 4 p.m. And with the show's host, Martin Desbang, we discuss architecture here in the Hawaiian Islands and how it not only affects the way we live, but other aspects of our life, not only here in Hawaii, but internationally as well. So join us for Human Humane Architecture every other Tuesday at 4 p.m. on Think Tech Hawaii. Hey, aloha, standing energy man here on Think Tech Hawaii where community matters. This is the place to come to think about all things energy. We talk about energy for the grid, energy for vehicles, energy in transportation, energy in maritime, energy in aviation. We have all kinds of things on our show, but we always focus on hydrogen here in Hawaii. Because it's my favorite thing. That's what I like to do. But we talk about things that make a difference here in Hawaii, things that should be a big changer for Hawaii. And we hope that you'll join us every Friday at noon on Stand the Energy Man and take a look with us at new technologies and new thoughts on how we can get clean and green in Hawaii. Aloha. We're back. We're live. I'm David Tasaka and this is Out and About on the Think Tech live streaming network series talking with Ken Nishihiro, business owner and district director for Toastmasters District 49. Ken, a lot of changes for Toastmasters. I heard this is the first change. Pathways is the first change from almost the time that they started. And I've seen the challenges, but I can also see the benefits because they're planning for the present and for the future. And I'm really pleased that they really made the Toastmasters website so robust with videos, with all kinds of resources because that's where people are now. They're online. Would you share a few of your ideas that you'd like to put forth for the members of Toastmasters in our community here for District 49? Yes, some of the ideas that we've been thinking about is to reach out to the members to find out what they want from the district because we, the district, actually serves the members. And it's hard to serve the members if we don't know what the members want. So we're planning to put out a survey to find out from the members what they want us, what to have for their clubs. And of course we always want to help the clubs get new members or build their membership because if you have a club that's just eight members, it's not as vibrant and fun as if you had a club with 25 members. So we are always constantly focused on guiding people to the clubs so that the clubs can grow and become more vibrant, more successful. And the more different people in the club, the whole face of the club, the whole personality of the club changes. So the club's always going to benefit from new members. I've seen the new District 49 website and it is beautiful and really powerful. I think it really looks great. Would you like to share who created it for the District? Yes, his name is Slava Slavik. He's a Toastmaster and he is such a great person. Just want to share his, and he's a master. He's a master creating a great website. He's also a master photographer. He can make you look good. Really? Really. Well, I'm impressed with him. I know that we have many talented Toastmasters and I know that you appreciate all of their support. I feel that your administration and your incoming group, your support, is it called DEC? Yeah, District Executive Committee. You want to share who they are? There's a lot of people. I have John Coleman, he's our PQD, Program Quality Director. Seth P. Utahola K2Y is our Club Group Director. So John will be in charge of training the club officers and training the other leaders. So he's in charge of training and putting on the conference and the speech contest. And Seth P. Utahola will be in charge of growing new clubs and also helping struggling clubs build their membership. And there we have a lot of more people. We have a finance director. We have her name is Wendy Lee Atkins. We have the public relations manager. Her name is Karan Lau. And we have a lot more. Do you want me to go on? No, that says that. So you have a whole team behind you. We have 28 people. Wow. So you have a lot of support. Yes. And what I've seen is your primary purpose is to lead with vision and dedication and this trickles down through the whole team. Yes. What are some of the ideas that you'd like to see for your administration come into reality? Well, I'd like to have a continuity of club growth. You know, like train our club growth director with different methods of growing new clubs. And we don't want to waste people's time too at the same time. We want to grow new clubs, but we don't want to make our volunteers work too hard. So we try to narrow it down and stream it down so that we can just get to the point, just get to the main market. And that's one of the things we're working on with CEPI. We're going to go to the international convention next week in Chicago. That there, she's going to get more training. As a club growth, I'm going to get training as a district director and John will have training as a program quality director. So we want to build new clubs and a membership and just guide everyone and have everyone focus on the same thing in the whole team. We have every director that visits the clubs. They're going to go there to not only help the clubs, but they're going to help the clubs. But from the first contact with the clubs, they're going to make sure that everything is working inside the clubs. The public can get to the clubs. Make sure that the email addresses are working. The phone numbers are the phone numbers of the right people in the club. And if not, we'll have them change that. Just a little tweak. They can get maybe another couple more members. Well, I'm very excited for the changes, Ken, because I know that with your vision of making the district, the members district, where everybody has a voice, everybody has a say, everybody's welcome, and everybody feels like they're a part of a family that are coming together to help each other become the best that they can be through many different paths. And public speaking is one of them. I envision your administration to be evolutionary of sorts, meaning that your ideas really have a resonating vibration for me. Thank you. I feel very excited that our direction is on the right track and a very powerful track because it is something that I feel the members really desire and deserve. And I think the team you have on board now are just tremendous supporters and leaders in their own way. And you are very fortunate to have a team of this high caliber. Do you think that you would like to share any ideas that new ideas or some of your vision that you'd like to see accomplished for district 49 during your reign as the district director? Well, I want this to continue. Leadership to, you know, like, say this year we grow so many clubs we have and we have maybe other potential clubs in a pipeline. We wanna pass that on to the next club growth director. We wanna improve our quality of training for the officers. It's very important that the clubs serves the members so that the members can have the best experience that they can possibly have. Because with the members having a great experience, who knows if we might have a better leader, a stronger leader next time? Because when I first joined, I wasn't a leader. And I wasn't a great communicator. But after joining and becoming a leader, that was a great opportunity for me. So this is what I wish for the membership so that they can get a great experience and they can continue. Because there's a lot of people that join those masters and if their experience is not that great for them, they may leave those masters. And missed opportunity. What is the District 49 website address? District49.org. Org. Okay, so people can go there and find the clubs and information and look for additional information. Right, yeah, you can go there, you can find a club. You can look for your area director. You can see our email addresses, contact, whoever you need to contact. Well, I've been so pleased to have you as a guest, Ken. Thank you.  I feel a vibration with you. The classic thing of one of the politicians of the past was quiet but effective. And I would apply that to you except that you're not only effective, you're really not that quiet. And I really feel that Toastmasters with your administration will really fulfill the needs and the desires of the members who you all serve. And you said it right at the beginning. It is their district and you wanna make sure that they are heard, that they are served. And I know that if they have any concerns, they can get answers for their concern. And I think that that's very important for any organization. As we look forward to your administration really lifting off and taking off, I truly am looking forward to a great year with you as the leader. And as I said to you before, I'm here to support you because I believe in you, Ken. Thank you. You the guy. Thank you. So we've been talking to Ken Nishihiro and we're out of time. This is, I'm David Tosaka. This is Out and About on the Think Tech. A live streaming network. We've been talking to Ken Nishihiro, business owner and district director for District 49. Thanks for tuning in and we welcome your feedback. Thanks to our broadcast engineer, Ian Davidson, our technical producer, Ray Sangelang, our floor manager, Robert McLean and to Jay Fidel, our executive producer who puts it all together. I'll see you every other Monday at 3 p.m. for more Out and About on the Think Tech. Aloha everyone.


Hitting the mats for some wrestling. Bemidji hosting Detroit Lakes, 138 pounds. Bemidji's John Solum gets the takedown on DL's Fabian Greer and then delivers the near fall for five points. He'd win by decision 10-6. Then 152 pounds. Bemidji's Chance Heinrich flips DL's Brennan Sather, gets him on his back, earning the pin. Jacks go up 18 to 15 with his pin. But they fall to DL the night 33 to 30. If you've enjoyed this segment of Lakeland News, please consider making a tax-deductible contribution to Lakeland Public Television.


There was a time when I felt like a duck out of water, but I kept trying to swim even though it was against my own natural tendencies. I'm talking about being an introvert in a very extroverted industry, hospitality. While it took me many years to crack the code and figure out how I could fit in and thrive, now I have a strategy and tips that help me play on my strength when I'm connecting with clients and colleagues. If you're an introvert like me, you're going to want to stick around for this one. Hey everyone, it's Leanne and I am an introvert. It feels a little bit like a confession, but I'm an introvert in a very extroverted industry. And it took me a long time to be able to say that out loud. At first, I thought I could do it. I thought I could do all of the long networking receptions, the week long conferences, some of them overseas. And then as I started to get more and more exhausted, I thought maybe it was a sign that I was getting older. But in reality, all it was is I just needed some alone time to recharge my batteries. And often in our industry, we lack those opportunities. So I created a different kind of battle plan. One that helps me stay energized and stay authentically true to who it is I am, while still connecting with my community and my clients. So this week's tips, they're all for introverts in the hospitality industry, looking to create and expand their communities while staying true and authentic to who it is they are. Before we look at these ideas, don't forget to subscribe to my YouTube channel and click on that little bell to be notified of new content. I create content around personal branding for hospitality professionals each week, and I don't want you to miss a thing. Now let's look at those tips to help us introverts thrive in our extroverted industry. Tip number one, if you're working in a sales capacity, consider meeting your clients first online. Social media platforms are a great way to learn about people and create warm connections with your clients prior to meeting them in person. And then when you finally do meet them face to face, the introduction is easier because you've already connected online. Consider connecting with your client on LinkedIn and if you need tips on how best to do that, I have a video that can help you out right here. Tip number two, pre-event networking. Now this is one of my favorite ideas. It's when you gather with a small group of individuals prior to the larger networking events. Better yet, if you can partner with other introverts, then you can walk into that networking together as partners. Meeting in these smaller groups before the larger event will help you break the ice and it gives you opportunity to have deeper conversations about perhaps what happened earlier that day. Tip number three, consider making your introversion part of your personal brand similar to what I did. Chances are if you share your love of small groups and good conversation, you will attract other like-minded people to your brand. Showcase this part of your personality as a way to connect with your clients and your target audience. Tip number four, ask an introverted friend to help you make some introductions at the larger networking event. This will take some of the pressure off trying to make those awkward introductions when you have an extroverted friend that would love to do that for you. Try walking into those networking events with a colleague and together you can meet individuals and groups. Tip number five, consider video for content creation. I know this sounds counterintuitive, but being an introvert doesn't necessarily mean that you're shy or that you're afraid of the camera. I'm maybe a good example of that. Consider filming some of your social media content to help put your face out there without the pressure of being in a large group. Tip number six, consider podcasting in the same way that video can be a solo activity. So can creating a podcast when you're quite literally talking to yourself or maybe one-on-one interviews. So if audio is a great way for you to connect with your customers, consider starting a podcast or an audio series. Tip number seven, consider writing a blog. Again, writing is a solo activity. So if your target audience is looking for the written word, this is a great way for you to amplify your personal brand. Tip number eight, conduct one-on-one interviews as part of your content creation. Again, this takes the pressure off of being in large group. So start small and make content with one other individual to get comfortable with interacting with others in your content. Tip number nine, arm yourself with a few conversation starters for networking events. And if you'll indulge me, consider going past the how was your day or how was your flight questions and dig a little deeper. For example, why did you choose this particular event or venue or destination or conference? And what do you like better about this conference as opposed to other ones you attend? And my favorite, did you have time to explore the city before you had to start the conference? Tip number 10, listen more and talk less when you're interacting with your clients. By listening versus talking, you'll pick up on the cues to launch into additional questions for your conversation partner. Allow your partner to take the spotlight. They'll appreciate the attention and you'll brand yourself as someone who cares and someone who can be trusted. Tip number 11, rethink the after party at networking events. If you don't want to party at the loud bar after the networking event, invite some close to you to join you for a post networking event cocktail or coffee at the hotel lobby lounge. Wind down with good conversation, call it a night early. You'll be primed for a better tomorrow versus those that stayed out all night partying. Tip number 12, don't forget about the morning networking. For all of you who did retire early the night before, now you're primed and ready for a day of learning. Connect with those over a cup of coffee and start your day on the right foot with some great conversation. Tip 13, don't forget about your post conference wind down routine. Whether you're returning home from a week long conference or just returning from a busy night of networking, introverts can become exhausted from these activities. So ensure you build in some downtime after your events to unwind and get back to equilibrium. It could be a spa day, a couple of hours with a good book, even just a good night's rest or quality time with family. Purposefully schedule time in your calendar to replenish your energy. And tip 14 and most importantly, be yourself. Authenticity is key when it comes to personal branding.  Your brand will attract people based on your authenticity. So stay true to who it is that you are. Another great way to interact with others as an introvert is through social media communities. And I have a Facebook page that I invite you to join. We talk about all things personal branding and social media content over on my Facebook page. Whether you're an introvert or an extrovert, there's room for all of us in the hospitality industry. You may recharge our batteries in different ways, but the end goal is the same and that is to be of service to our clients and customers. You can do that through being your authentic self. And I do hope to see your authentic self at a networking event soon. Thanks for watching today's video. Bye for now.


Jerry of the circus He isn't breaking. I'll say he isn't. Hey look now. He's doing that swing trick from El Mundo's trunk Carly that smooth bump. El Mundo's just snapping at those commands of Jerry's.  We all will. Why do you know I've caught his act with El Mundo just about every time since he started doing it? Yeah, oh now watch it Bumps. This is the last time you'll ever see him. Yeah. Oh, there he goes. El Mundo just lifted him up pretty. Look, Jerry's standing up on El Mundo's head pretty bowed. He never did that before. Oh, good boy Jerry. Well, that's that. There's a turn I'll never forget. And I'll just bet you there'll never be another one like it. Well, I'll have to run around to the back door and get El Mundo now. See you later Bumps. Okay Olson.  I only got a minute. Oh, hello Jeff. Now listen, here's a note from Spike. It's for Jerry. Spike couldn't get away to say goodbye to him. He's busy getting the mess topped on and loaded and say goodbye to Jerry for me too. Okay, yeah, I will Jeff. And thanks Spike for being so thoughtful. Fine Jerry boy. You sure did a great act tonight. Oh, you just better Bump. I was telling Olson. I don't think you've ever done that act any better. Hey, did you see me stand up on El Mundo's head for my last bow? Yeah, that was all right too. How'd you happen to do that? Well, I figured as long as it was my last act I'd do something different.  I'm not going to do the last walk around. We've got to get packed and get down to training. Leave the quarter past eleven. It works right. He's over in the wagon waiting for us. Now come on Jerry, let's get a move on. Okay, I'll wait Bump. Let me take one last look at the big top with all the people in it. Yeah, now Jerry. I hate to leave the circus Bump.  Oh, listen to that band. Oh jeez Bump. Come on now Jerry, come on now. I know how you feel but the world will say you know the circus is going to go on and on. Maybe you'll be with us again next season or part of it anyway. Well, I'm on my vacation now. Why sure. A person would think you were saying goodbye forever. Well come on now. We've got to hustle. Okay. Goodbye big top. Huh? Nothing. Come on now, I'm ready. We'll have to hurry Jerry. I know it, but it won't take me long to get out of this uniform and get dressed once we get over to the wagon. Yeah, I've got all your other things packed for you. Hey, where's Mr. Randall gonna meet us? He'll be over at the wagon as soon as he counts the day's receipts. And Jim Bennett already got our tickets and arranged for rags. What do you mean arranged for rags? Well, he'll have to ride up in the baggage car Jerry. We can't take him into the sleeping car with us. Oh. Hey look, there goes Olsen in with El Mundo now. Hey, I sure want to say goodbye to him too. Or who? El Mundo. You know Bump, I think he knows I'm going away. Maybe I was seeing things but I thought for sure I saw a different look in his eyes during the night show. Well, I've never seen but one expression on an elephant's face. Hey, Olsen. Yes, Jerry? Wait a second. Well, Jerry, I guess this is where we park company. That is for the time being. Yeah, I guess so. Gee, if you've got El Mundo's trappings off of him in a hurry. Yeah, he's through acting for today. He's got work to do now. He'll be pushing these wagons as soon as the show's over. I'm gonna say goodbye to him. Okay, Jerry. El Mundo. Adios, mi amigo. I'll see you again sometime. Adios, El Mundo.  Well, I guess we better go get ready. Goodbye, Olsen. Goodbye, Jerry. Although I'm sorry to see you leave us, I'm glad you're gonna get a chance to get some learning. Now you keep in touch with us. Me and the boys here in the Menagerie would be awful tickled to hear from you. Don't worry, all right. And you'll be sure an answer and tell me all about the animals and my friend El Mundo. Oh, you betcha. Well, so long, Jerry. Put her there. Well, that's a good luck to you, boy. Well, goodbye. So long, Olsen. Goodbye, Jerry. Hey, Bumps. Now I wanna go find Spike and say goodbye to him, too. I guess he's busy now loading, but I sure would like to see him for just a minute before I leave. Olsen, that reminds me, Jerry. I got a note here for you from Spike. Jeff bought it over while you were on doing your act. Here you are. Oh, thanks. I'll read it later on the train. Uh, Jeff says that Spike was sorry he couldn't get away. He's gotta get down to the runs with a mess top. That's gotta get loaded on the cars, you know. And Jeff said goodbye, too. Oh, yeah. Say, how about your new friend Speed? Did you see him? Well, I sure when I did the act with him. Oh, I forgot about your riding lady and that race. Here we are, Jerry, this way. I said goodbye to Speed when we finished the race act. Yeah, we're back, ol' fella. I guess he knows something in the wind, too. Well, sure he does. I let him in on it. I told him he was gonna leave the circus and go with you to school. Hey, look, Bumps, what's this? What's what, Jerry? This package here. Oh, look it. Goodbye, Jerry, and good luck to you. Every time you use this kit, I hope you'll remember me and think of me, Clara. Oh, isn't that nice of Clara? That's thoughtful. Now, open it up, Jerry. Oh, boy, this is keen and something I can use, too. It's a traveling kit. Oh, yeah. Oh, gee, I'm sure glad to get this all right. Well, I think you would be. I'll thank Clara for you when I get back, but you better write her a nice letter. Oh, sure. Yeah. Well, come on now. Hurry up. We haven't got much time, you know. Okay. Hey, uh, what do I do with my uniform, Bumps? I'll put it in my trunk for the time being. Then later we'll have Clara store it away in one of her wardrobe. You ready, Jerry? Oh, hello, Sam. I will be in just a minute, Mr. Randall. All right, I've got a cab waiting right out for the side of the lot. Well, it's only a block over at the station, Sam. We can walk over. Oh, not with our suitcases and luggage. We better take a cab. Where did I put my cab? Oh, here it is. Yeah, all right.  Oh, thanks, Bumps. Say, has Reg's got his collar on? Oh, yeah. All set, Jerry. Well, I'll woof to you, too. Seems like you're sort of rushing me. Oh, not at all, Jerry, but we don't want to miss that train. It won't be another one for Fair Oaks until morning. And I don't want to be away from the circus too long. Yeah, I can't be missing too many shows, either. Yeah, I know. Well, ready now? Oh, Jiminy. Well, now what? I'm sure going to miss this wagon, Bumps. Oh, now, Jerry, look here. You're going on to something better. Why, you should be the happiest boy in the world. I know it, and I am happy, but I just can't help it. Well, I got your suitcase, Jerry. Now, come on, come on. Look, your little Reg's going. He's not sorry. He's leaving. Right around back here, the cab's right there at the curb. Hey, wait a minute. Let me have just one more good look at the lot. Oh, here, Reg. Here, boy, now. This way, fella. Well, anyway, I sure had a lot of fun with the circus, and I'm going to have a lot of fun at school, too. That's the way to talk, Jerry.  Oh, there we are. There's the cab right there. Oh, now you stay right close, young fella. You don't know where we're heading. All right. Now, Finn, Jerry, go ahead, Bumps. Here, Reg's boy.  Out the station. Yeah, that's right, driver. Oh, dear. I forgot to say goodbye to Whitey. Oh, it's too late now, Jerry. But you'll be seeing him at winter quarters some weekend, maybe. Hey, and that reminds me. How about Patsy and Jason? Yeah, and Slats and Tony and all the rest. Well, what about them? Well, they didn't come over and say goodbye to me. They weren't even in the padroom tonight. They're almost always there. Well, maybe something happened that they couldn't get away. I'm sure they didn't do it on purpose, Jerry. Boy, of course not. You know how much Jason and Patsy think of you. Yeah. Oh, there's the station right ahead. We've got plenty of time now. Bumps, you better take this ticket and check Rags with a baggage man. Yeah, yeah, OK, sir. Come on, Jerry. No, I'll take your suitcase. Yeah, come on, come on, Rags boy. Come on. Oh, still about to put this leash on you. Can't have you gallivanting all over the station. Here, driver. Thank you, sir. Yeah, I guess this is the way we go. Yeah, that's right, Bumps. Right through here. Hey, hey, what's this? Well, look at it. It's a clown bandit and Slats and Tony and Hulligan. Are you getting a single? Well, look at Patsy and Jason. Good to go away without saying goodbye to them. Good to go, Jiminy. I'll say this is a surprise. I guess the clown department didn't forget you. I'll say you didn't, Tony. Yeah, break it up. Come on, move some of those legs. Let me through. I'll make you a major mic. I'll have you know young man that you won't get away without shaking my hand. Well, I'll take Rags back and shake him. All right, all right. Do that, Bumps. A long rag. Goodbye, Rags. Well, Jerry, I hope you'll be very happy at school.  I was only fooling nature. Yeah, sure you were. But I was onto you. Yes, sir, every time. You don't need to think that you ever had me fooled. Not for one minute, Jerry. Wait a minute, boy. Wait a minute. I'm going to have a quiet when I make a my speed. All right, Tony. All right.  We all know you're going to miss us. But not a half of so much as we all are going to miss you. I think I could say the circus, she will not be the same without you. Yes, I will say. The circus, she will not be the same without you. Now, you'll be a good little soldier and don't take no wooden money. Take a rubber because it stretches far. All right. Let me throw here. Let me throw here. It's whitey. I've only got a minute, Jerry. I got to get back to the runs and help load the horses, but I just didn't want to miss saying goodbye. Now, you'll be as good at school as you were around the circus, and we'll all have reason to be mighty proud of you. Well, goodbye, son. I've got to hurry now. Now, you keep in touch with us, Jerry. Oh, you bet I will. Goodbye, whitey. Hey, and take good care of Splendor. Yeah, friends of old taking care of. See, we better get old now. Yeah, yeah. All right, come on, Jerry. Goodbye, Jerry.  Come on. Now, have some more, Jerry. Now, Jerry, you'll be sure and right to us, and be good and study hard. Oh, I will. And so long, Jerry. Don't forget about your old friend Jason either. We're going to expect big things from you, Jerry. Don't let us down. We'll be seeing each other again someday. Oh, sure. All right, come on, Jerry. All right. Well, goodbye, everybody. Goodbye, Jerry. Don't forget your name. Take the application. Hurry, I can't see him. Up you go, Major. Goodbye, Jerry. Goodbye. Come on. Come on. Come on. Come on. Come on. Come on. Come on. Come on.


Welcome everyone to the session to be really do FP in Java by Ben Evans. We are glad that he could join us today. Without further delay, over to you, Ben. Good morning, everyone, or good afternoon for those folks who are in India. And thank you for the introduction, Ashish. Let me just, first of all, share my screen. And also, so you get a couple of seconds to look at my lovely desktop while I start on my keynote show. So welcome, everybody. So the title of my topic is do we really do functional programming in Java? For those people who haven't met me before, my name is Ben Evans. I'm a senior principal software engineer at Red Hat.  I was lead architect for instrumentation at New Relic. I was co-founder of Object Clarity with Martin Verberg and which we was acquired by Microsoft in 2019. And then before that, I spent a lot of time working in finance. So I was chief architect for this derivatives Deutsche Bank. I worked more with Stanley during the Google IPO, which was, gosh, 17 years ago now. That's that's a long time. And I've also had a career in gaming as well. As well as my career, I done a bunch of things in the community. I have Java champion and Java one rock star speaker. And I worked on the Java community process executive committee, which is the body which which decides upon and approves all new Java standards. So I did that for six years. And I'm also known by living Barcelona now, hence, hence my t-shirt, which shows the Barcelona skyline. But I lived in London for 20 years. And I did a lot of work with the London Java community, helping to organize a big community and also founding a couple of projects, including one that you might have heard of, called at Opt Open JDK. Okay, so we're going to talk about functional programming and what that means in Java today. Now, you may have seen a version of this talk, which is available that I gave at JBC and cons last year. That one is, I guess, more orientated towards people who are Java programmers, rather than folks who are specifically functional programmers. So I'm going to take a slightly different direction. So if you've already seen the video, that's fine. We're going to cover, obviously, quite a bit of the same ground. But we're also going to take it in a different direction for quite a lot of it because it's really those functional aspects that I want to talk about today. The story of functional programming in Java really starts, I guess, with Lambda 8, with Java 8 and landers, of course. You know, this is the point, Java had not really had a notion of Landers before that, not as a first level language construct, if you like. Now, of course, it was always possible to do the sorts of things that we do with Landers in earlier versions of Java. In Java 7 and earlier versions, which is quite old now, it was always possible to write a little tiny in a class, which only had one method on it. And that was then understood to be semantically the same as a Lambda expression. But in practice, it was pretty clunky and it didn't have, you know, functional programming to me is not just about the bare bones and the semantics of what it means to be functional and to be a function. There is a certain amount of syntax and other aspects blended into it. And that's the thing that I think I'll come back to a few times during the course of this morning's talk. So Java 8 is really the point which people focus on because at that point you have Lambda Expressions and, you know, the Amos that within Java's type system. A Lambda is automatically converted to an instance of a class, which implements some target functional interface as they're known in Java, which is basically Java's equivalent of a function type. Okay, I have more to say about that, but that's the sort of basic feel of it. I guess anyone that's programmed to Java in recent years will kind of know that, but that's the framing context. So why? Why do we do that in Java? I would say that there are really five reasons. The point is to provide a usage which is much more expressive, so that rather than having the functional nature hidden behind all of these tiny little limit classes, instead, you know, you can actually see things by writing function literals and having them auto-converted. That's much more expressive, it's clearer, it's more concise. You know, the library code is easier to understand as well. These top three reasons I think are really, really important. There's also the question about improved program safety. People debate this one. I think it certainly has helped. I think that the nature of the way that Java's Landers are constructed with what are called single abstract method types actually does improve people's overall safety quite a bit. The one thing which I think is more debatable, and I've kind of ranked these five properties that we wanted to get out of Landers in order of importance, in order of, you know, for the project to be successful. If they've delivered, you know, top down on these five things, then that's great. The bottom one is data parallelism. Now, before Landers first came out, when all we had was Java 7 and Java 8 was the new thing. There was a lot of talk about how this would automatically enable Java programs to take better advantage of multi-core environments. You know, you can kind of automatically spread out over the course by taking advantage of data parallelism. This has not happened. Number one, I think, is the only one of the five that we can raise a question about as to whether it was really successful, or whether it really hasn't caught on in the way that people might think. And I think the reason for that is, it's, you know, automatic parallelism is really hard. First of all, if you have a stream of tasks, which is in Java, how we do it. We have an abstraction called a stream, which is sort of lazily evaluated, and the data items flow through it. You think, well, okay, if I could split all these up to do some sort of aggregate operation on them. Providing the ordering doesn't matter, and providing there's no dependency between them. Maybe I can do something. And all those things are true. But actually, it turns out that for quite a large range of stream sizes or collection sizes, if you like, the improvement for parallelizing is not great. And in fact, the communication overhead in terms of something like Amdahl's law plays such a big part of this that it's actually not clear how useful automatic parallelization really is. Certainly I've been in the 10 plus years since since Java 8 came out. I think I've 10 plus or was it 2014? Let me see. Java 18 came out in 2021 Java 11 therefore came out in 2018 so it must have been around 2014 so some not quite 10 years, eight years, eight years Java 8 came out. I've seen a lot of code bases in that time. And I think I've seen the use of parallel streams, maybe half a dozen times. And of those half a dozen times, it was actually incorrect in three of them. So that's not a good track record. At least a couple of the other cases the remaining three, it was marginal whether it provided any performance improvement at all. So it's a lot of work for a performance technique which was not in practice proved to be useful. Okay, well, four out of five is not bad. We get the first three pretty clearly. So that's a success and lambdas have been successful. They have been adopted by Java programmers in huge numbers. Basically, the uptake of Java 8 was the fastest uptake and release of Java in history. People wanted lambdas. So it's become very much part of the culture of the Java programming culture. But is it functional? Let's dig deeper. So the standard thing, if you want to say any language is functional, you have to be able to treat code as if it was data. You have to be able to have some notion of a function literal and be able to pass these things around like any other objects. Now, in Java, as we know, there are two types of values, at least until project Valhalla comes along, whenever that will be. Right now, there are two types of values. There are bit patterns, aka primitives, which are identity free. They have no object header. They have no identity. They are just patterns of bits. And you have object references. That's it. Those are the only types of Java value that exists. Not to talk Java values at JVM level. So other other JVM languages such as Scala, Clojure, et cetera, also have to work within that data model. Now, is a lambda expression a pattern of bits? No, clearly not. Therefore, it is an object reference. So when we talk about about lambdas, what we actually are immediately led to is the fact that they are their objects. So the closest thing that we can build to a function in the JVM is an object. Now, you could imagine a very, very simple case. We want an object which has no fields. I'll come back and talk about lambdas and capturing like for now, no fields. And it has one extra method. Java, of course, has a strict inheritance hierarchy. So the type that our function object will implement will be the simplest thing it can be is a subclass of object with one extra method on it. And that basically is where the concept of a SAM type or single abstract method comes from. Or an interface, which only has one non default method on it. And that is the simplest, the most minimal representation of a function that we can make. And that idea has been around semantically since Java 1.1, when in a class is first arrived. So that's the basis. That's what all of this stuff right down in the JVM is going to be implemented at. Now, as I'm sure you remember, the way that this works is the lambda expression is converted to an object, which has the appropriate type. And what is that type? It is a direct subclass of object that implements the appropriate target type interface. Okay. As a result, we also get that the static typing of Java applied to the method signature must also work. So the compiler is able to check that that compile time and say, ah, yes, you've passed in the correct, the correct form of methods to satisfy the signature of the abstract method which has been generated. Under the hood, this uses, well, a couple of things uses an API called method handles and a method handle is kind of like reflection. The method handles are quite similar. It's sort of a lower level technique. It's not as well known. But in fact, it's become increasingly important so much so that in the latest version of Java reflection has actually been replumbed to use method handles. But until Java 17, there were two separate internal APIs for doing reflection and introspection at runtime. The reflection API and then there's method handles method handles we use for lambdas and some other things which we'll talk about. And the reflection API has now been just rebased on top of the on top of on top of method handles. So to API still exist the reflection API the method handles API, but underneath there is only one implementation and that is method handles. So this speaks to the transition the change of Java towards something which is using more of this deep level technology. Which is more advanced and more sophisticated down in the runtime, but also provides us with something which looks as though it's it's closer to a functional language. So I'm does despite the similarities despite the fact that you might have guessed that this is just some tactic sugar over in the classes that is not the case. Instead, there is a new mechanism in the JVM. It's been around since Java seven, but it's been a very slow burn for how much it's starting to just spread throughout the platform. It's called invoke dynamic. Interestingly, invoke dynamic. One of the things that enables you to do is it enables you to change the implementation of lambdas. So the first versions of lambdas came out in Java eight update zero are different to today's lambdas. The implementation for how lambdas are implemented has been modified in a backwards compatible way. You can take Java eight bytecode and you can apply it to a Java 17 runtime and you will see a different implementation be used without recompilation. This is one of the powers that the invoke dynamic has it's an extremely powerful mechanism it's been well thought out and well designed. It uses a new bytecode called invoke dynamic, which is the first genuinely new bytecode that Java has ever had. And today it's still the only one that's new. They'll have a bring a couple of new ones, but until that happens invoke dynamic is all we've got. You can relax parts of the static typing system here. You can you can do all sorts of really cool things with invoke dynamic and method handle. The other thing which is which is awesome about it is that it in many cases it's now as fast as regular method dispatch. The whole idea behind this one of the goals was to reimagine reflection in a way that was as performant as as regular code and without the performance hits that reflection had. Okay, so there's some cool stuff happening at the end level is to take away from here. But what about, you know, the the actual functionalness of it how how much does this provide us with a basis that in real functional programming. Well, the other piece of Java Landers is a move from external iteration, where we have the Java collections the client code has control. We you know when you get an iterator and you loop over it and this is this is external iteration you deal with individual elements one at a time, you have to deal with boilerplate. You are exposing to a certain degree, a level of internal implementation this is sort of encapsulation violating you can, you can argue about how significant it is. But there's no getting away from the fact that the idea of functional collection handling is to do internal iteration is to is to provide the collection the aggregate to have control, and then to be able to say, here is a function, which describes what I want to done. Now you do that is up to you. You know just just don't go and deal with it don't do the needful run this function over the collection. And that basically is to to reduce boilerplate and to to to allow the scope of the code to collapse, you know, part of this, I said that the syntax matters a lot not not as much as the semantics is hard to say the two are tied together. Without clear concise syntax, you cannot compress meaning. In the way that we can with with functional approaches that's that's that's the idea that by having transparency we can we can put more code, more concentrated code on the page and still have it be comprehensible to the programmer. So syntax does matter for that. And that's one of the areas where Java, as we'll see this fall down. So what have we ended up with we've ended up with functions as first plus values we've ended up with ultimate reduce. We've ended up with a Java util function package, which has some function objects in it with functional composition and things like that right. This is table stakes, in my opinion. Is this functional programming. Well, maybe. What I would say is that it gives us a view of Java's type system which I can express like this now. So I think this is really a decent description of Java eight or 11 with 17 of course we've got we know the amount to which this is slightly functional is shifted and I'll have something to say about some of these specific words a bit later on. But you know if I use use words to describe Java's type system like static and nominal and object imperative type raised, modestly type inferred and slightly functional. That is, you know, and if at this point you want to go and watch another talk by all means do that's kind of my conclusion. I think there's an interesting journey to be had to explain that and to also provide some nuance around what I mean, precisely by slightly functional here. But that's that's essentially the conclusion like we're not going to ever turn Java into Haskell. So let's, let's take a step forward and see what is it that would make a language functional what what else can we add. Well, I would argue that for things which are really functional. It's a question of how many of these seven things do you have. My magnificent seventh functional program and you want to talk about purity of functions, we want to talk about meat with data, we want to talk about higher order functions, tell recursion closures laziness and currying. Those are the seven things, which, which you know, I say if you're going to go beyond just just simple lambdas closures and and filter map reduce this is the next the next step. It's a big step up from where where languages like Java are to the next level. So, so how do we do. Okay, so pure function function that doesn't look all to the state of any entity side effect free like a mathematical function. This is the standard description that we have of pure functions. And because it just, it returns results and dependent only on the arguments not on any external state, which could be modified. It's, it's transparent, and you can memorize it and so on and so forth. Now, the JVM of course doesn't have functions. So the JVM has methods and the way that the JVM is structured is the code goes into methods. And the methods go into classes. And the classes go into packages and packages go into go into modules. So there was there was a hierarchy namespace as a hierarchy of scopes as you go up, but the fundamental point is the JVM only loads and links classes. It is the minimum unit of functionality that the JVM will ever deal with. And the last point is, that is a basic point of the Java security model, you can't just take a free function and load it in. There's no way of doing it has to come in through a class, which of course is another constraint on why why landers in Java have to be function objects. Okay, because they have to be instances of a class which has been linked. So we only have methods. So pure method is one that doesn't modify object or static state it doesn't contain objects to to modify fields, which are mutable. It doesn't contain any external state. And it does not call any, any non pure method. Well, this is quite a restrictive set of conditions. And I would say that this is one of the places where it shows up the real difficulty of using the JVM for pure functional presenting functional programming. And that is, you know, that's not a great start. If we if we have this, this very much the sense that the JVM is based around mutability. It also makes it difficult to write pure functions. It also makes it difficult to write immutable objects. So, immutability is extremely powerful it makes code much easier to reason about fundamentally because objects have a trivial state model. They are constructed in the only state that they will ever exist in. And they are, you can copy them around between threads, even between, you know, VMs or instances, and the mutability of data is really very, very powerful. And in fact, you know, you can you can even extend the idea of immutability to say, you know, are there are there any almost immutable approaches where we still get a lot of benefits. But we can still, we can extend it slightly and make it slightly mutable or whatever. Now, of course, famously, Java has string classes, and the Java string class is effectively immutable. And by which I mean that you, you, it does have one piece of mutable state, but you can prove that any data races which result from computing that state, which in the case of Java string class is the hash code, all data back races of the nine. And in fact, the way the string class works is the first, you check to see whether the hash code has been computed, as you use it. And if not, you have you could have multiple threads racing to compute the hash code, but they will all end up with the same value. So in that case, it's kind of like a promise or a Java completable future where you can have multiple threads that race but the resulting data races of the nine. So that is one example of how you can extend immutability. But Java doesn't have great support for it. Yes, we have final. And you can mark fields and local variables as final, and they will not be updated, but only the references immutable. So you can't mark an entire object tree or object subgraph as being immutable, only the first link in it is matched. So you have to make sure that it's it's final everywhere. And that obviously is prone to bugs. What happens if you need to make use of data which comes from a library which isn't immutable. Your nice reasoning about immutability has been broken now. So of course, there are some horrible things you can do with reflection to invalidate it should you wish to. But generally speaking, not what not what you should do. So Java does have some attempts to do proper immutability. We have copying and with us so we have things like the Java time API, which was a complete rewrite of the unfortunate Java utility original Java functionality for for date and time. So the Java dot time is completely mutable and it sets up this idea with using factory methods everywhere and these with us. And that is an idea which is reflected in in project Valhalla, which I've mentioned a couple of times. Okay, so that's immutability. Yes, there is basic support for it, but it is only basic support. Let's move on. Let's take a look at what's next. So next up we have higher order functions. This is straightforward. It's a function which takes either takes function parameter or it returns a function. So for example, in Java, you have the function types. So that is perfectly fine. You take in a function, which takes in a string and you return a function of strings to strings. So I've called my function, my higher function here, prefixer, it takes in a prefix and it returns a function, which, which, which prefixes a string with with whatever you passed in. So so far, so good, we can do that. And as you can see that we have this code and you can actually, you know, the Java compiler is smart enough to be able to convert it to this form here. So you don't really need the extra brackets here. You can, you can write this all in one line, which is, I guess it's okay. So that's fine. This actually has some subtleties to do with type erasure. Because notice that we have the generic type arguments here that this is takes in a string and it returns a function strings string turns out there are some corner cases where where type erasure can come back and haunt you. So I shan't I shan't go into that now. I haven't got enough time really, and instead just say that the higher order function support in Java is reasonable. It's not, you know, it's not the same poor story that we saw with with with pure functions, or that kind of half story that we saw with the mutability. Oh, well, let's move on. Let's talk about recursion. Okay, so the standard view. This is a Java view of a factorial calculation. This isn't a great example, because you basically overflow even Java's longs very very quickly. So if you actually try to use this code, you will find that it gets up to about 31 or 32. I think it's 32 factorial, which is larger than Java's longs. So that's not, that's not actually a lot of space to demonstrate the property that we're showing here, but because you get overflow of the arithmetic.  So you, you can convert it into a form like this. And of course this is a standard trick by using a helper function, which is private. Now in a language like JavaScript, or something which supports nested functions, you could put that nested method inside this one but Java doesn't do nested methods. Instead, you have to use this, you have to have a helper factorial shakes into elements and returns this. You could do this using a lambda expression, but actually at that point you'd need a private interface. And the resulting bytecode isn't anything like as clear, whereas this one I think kind of is you use a two argument.  You're using the fact that you have a two argument function, and you are storing state effectively in the stack. That's how this does implement implementation works. I won't show the bytecode for the actual the front door function. It's our factorial, because it's not very interesting. But what I will do is I'll show the bytecode for help factorial to help factor. This takes in two parameters, both of which are long and I don't know if you folks know how to read Java bytecode. This is pretty straightforward. What we did what we're doing is we're taking reloading our first argument, loading zero and comparing them. And if it's not zero, then we're going to continue down into this part. If it is zero, we're going to return. So bytecodes zero through seven are basically the test condition to check to see whether it's zero or not. And from bytecode eight onwards. And if the numbering seems a little strange, by the way, that's because Java bytecode. Some of the top codes have arguments to them. So for example, a bytecode three, we have an if not equal instruction. And the target of that is instruction eight. So, so what that means is that the two bytes that follow. So bytecode four and bytecode five are actually the bytes zero zero and zero eight. And they're combined to make the target for the jump instruction. So that's why the stream seems to skip from three to six. It actually it actually uses up some of the stream in order to hold the arguments. Okay. And then so if bytecode eight onwards, we produce the two multiplications and then notice the online 14 we do an invoke static. So we do a recursive call right before the return. So this is a classic case of tail recursion or generally tail calls. And now we could do this. Notice the bytecode is identical for a lot by code zero through 13. But now in this version of this, we produce modification of the two, the two variables zero and two, and jump back up to the top again. So there we, there we go. We are, we are repeatedly moving through the, the code and when we hit the end, rather than doing another call with jumping back to zero again. So this is a conversion of a recursive function call, which is always represented by an invoke instruction into iteration. Okay. So that's, that's very standard technique. And some languages do this. So, Scala, for example, Kotlin, they will do this. But Java doesn't. Java, a method call like this one to help fact return help fact by minus one items J is always translated into a function call into a method call. It is never converted automatically converted to iteration. And there is no way at Java language level of making it do that. So the tail recursion in Java is not optimized and come by the stack. Java code, compile it, and then run some sort of bytecode transformer on it to convert it into the form. And that would be totally legal. And your program would run fine. And that's basically what, what things like Scala did. But by default, job without doing that rewriting, Java cell recursion is not optimized and will blow this up. Okay, the reason for this and there's been some discussion about about whether we could fix this. And, you know, it's been an idea which has been talked about for at least 10 years. Basically, it comes down to the expectation that the stack trace produced by Java will be completely valid. So, so that you will be able to see every frame on it. And that that's more important than fully optimized cell recursion. You can see that argument it is a behavior change. But there's no getting away from the fact that this this feels not only sub optimal, but that actually it's a bit of a bit of a poor show that we can't really do proper to our recursion here when it's clearly possible in other languages. Never mind, move on. Let's close us. So, closure broadly a lambda expression which captures some state. You can think about this type of thing, where you, you have a lambda who, which is pulling in that I, of course, what happens if we uncomment the line. Interesting.  And that has a requirement that any parameters that appear in in lambdas, so like the eye here that they have to be either final or effectively final it is a compilation error to attempt to reassign after the lambda expression. Okay. This restriction is is is is, I think a little onerous. I'll explain why it happens in a second. But you are. But it is there. I personally always preferred that we had to explicitly write out the final, just to make it clear that we were performing the capture, but other programs seem to seem to resemble that. So, now you can get away with it, not writing final in time, providing you don't actually do a reassignment later. So let's take a closer look at some more by code and see what's actually happening there. So if you look at what what happens lambda bodies in Java turned into private static methods. That's why they're not really in the classes. If you if you compile a Java class for the lander in it, you will not see a second file on desk, which of course they would be if it was an inner class. So instead the lambda body has been turned into a private static method, and the captured variables are passed as arguments. And what happens is the, the int. So this is a function from strings to strings. So it's going to require one, what we call dynamic argument, which is the string, but it's also prepended with the int, which is what we call a static argument. Because the static argument is captured at the point where the lambda expression is created. The line I, the value of I 42 is copied as a static argument at this at the point where the object F is created. So that is already has already happened has already been captured when we execute the line, which creates F is captured at that point, and then it's passed into the body of the lambda later on. By the way, if you if you if you're playing along at home. So this is Java rate by code. The Java 11 and Java 17 by code will look quite different to that to this, because the code and the way that string concatenation is done in Java 11 and 17 is different to how it's done on Java rate. So, but the method signature the fact you're capturing the end will be the same. It's just the implementation for the string concatenation is different. So, the big question this is this is where we come back to think about this from a functional perspective, is this really a closure. Well, I'm not sure. Java is strictly a pass by value language. Okay primitives are passed as the value objects are passed as a bitwise copy of the reference. Okay. So this is passed by that pattern, because that's kind of what it is. It's also worth, worth noting that this means the, the changes to primitives that you make. If you if you change modified a primitive inside a inside a lambda like this one, you try to modify I hear all you're doing is modifying the copied value. You have to pass that back to call a context. So languages that have a notion of environment like scholar, I think J Ruby as well. There is no notion of the capturing environment that's been that's being passed in here, because typically closures will pass by reference, and we can't pass by reference for an primitive. So non Java languages that want to support true closures or pass by reference, their runtime environments must provide the support for it. The JVM is not going to do that for you out of the box. So that you if you wanted to do that, you have to provide it within the runtime. I think they might have been a question about that so I hope that answered the question. Okay, how are we doing. Okay, I've got about 15 minutes. Let's push press on. We have five minutes. Five minutes for questions. Okay. So let's speed up a bit. So laziness values that are not completely needed. Java screams do use laziness. The operations are usually lazy. Some of them are eager. And generally speaking, the, the, the terminal operation, the thing which completes the pipeline of a stream is typically eager as well. That always has to be eager. So values are pulled through through the pipeline until they hit an eager operation where the stream is materialized. So for example, if you're sorting, you need to see the entire stream. So that has to be an eager operation. But in general, as far as possible, Java streams are lazy, but that's it. There's no direct language level support. There's no JVM support for general lasing values. And in fact, not many JVM languages support a laziness directly. Clojure is, is lazily evaluated. And you only have laziness for sequences. That's so that that is, you know, laziness is not just a Java problem. It's also a general JVM language problem. I think Java gets a swing and a mess here for this one. For carrying and parcel application. So supplying some but not all arguments for function. Java has no automatic support for carrying. And in fact, Java does not have a complete set of general function types. It has function and by function and, and, and operator interfaces, but no general function one through function N, like we see in, for example, Scala. Related to this, Java syntax also trips us up here because Java syntax doesn't allow hiding of the method calls. So in a language like Kotlin, you can just have a, an object which contains a function. And you can just have a core syntax on it, which is just some brackets in Java that is not allowed you always write out the name of the method when you're when you're calling it. So it's typically the apply method. And that's why Java code which uses function objects is typically more, more of a buzz. Now we could imagine a different world. We imagine something where we decided we did want to do carrying in Java. So we have the standard interface for a by function, which has gotten an application of a function to T to you. This is the full generic form where you have to you and are, and then you have a generic default method called and then which, which is placed application. Okay, so you return this and what you're actually doing is you're binding up some, some data inside it by returning a new lambda expression. So you can then imagine that we would actually have two functions like this. A curry left and a curry right where basically you would just apply different functions to this. Okay. So the main problems that we're seeing with the type system and collections are the Java's type system is not single rooted into an object do not have anything to do with each other as types. So what that means is you cannot put an int into list, for example. There are also problems with void. And the design of the Java collections in themselves implies mutability. Mutability is not a well separated concern of the Java collections interfaces. So and all of the collections have on the modification and adding methods and the way that that's handled is not is not good. So if you, if you try to use a method, you want to define an immutable collection, like a, a, oh, I don't know, an immutable list, for example, the way that you would do that is you would throw unsupported operation exception on any attempt to modify. That's not an exception solution, in my opinion, because unsupported operation exception is a is a runtime exception so it's unchecked, and there was nothing in calling code which will tell you that it might do that. So there's no encoding of the of the immutability of the of the implementation at type level. Streams gets something's right, but the problems with streams are collections of first class and they are embedded everywhere through the JDK. There's lots and lots of of the JDK uses the collections and all sorts of places. Streams are not because streams were only added in Java eight, they have limited applicability. It's also true that Java has no tight level traversable concept, as we see in Scala. So we have a, you know, just only the ability to iterate with iterable was no notion of a type which represents an internally iterable. object. The collections in addition are not functional collections, they don't have any ability to do map and filter they're not functionally transparent. Streams are somewhat, but there is a limit to how far you can push that. And in particular, because of the necessity of using the stream constructors first as not first class flat map is extremely limited in Java. It's not obvious and it's not intuitive how to use it. So lots of Java programmers don't really they do map and filter and reduce, but they get very worried as soon as flat map shows up. Okay, so the here is our type system. It's static, it's enforced, we use class files for everything. And, you know, I think I kind of like this quote from my buddy Curtis bow that strong and weak typing so I always make sure I say static typing. It's phenomenal that we are not a structural typing language at all types are only compatible with explicit inheritance exists and everything has a has a name, at least for L values. So for at least for things which are on the left hand side one assignment is the only way to talk about the type is by name, and there is no duck typing. The model is one of Java strong points it's very simple. It's not pure oh, it simplifies teaching it because you have primitives. The type are raised because we have parameterized types only exist at compile time, and the generation of bike code removes information information destroyed, even a class file level. Lots of complain about this. It's often quite misunderstood. And finally, slightly functional things. The collections are very concrete. The final point is, it is only slightly functional but does it matter. Java developers are well used to lambda expressions now they're well used to the support of map filter and reduce and basic functional patterns. And perhaps that's all they need. If people would grow up to be functional programmers and decide that that's the style of programming that works for them. There are plenty of other languages to choose from there is closure and scholar and Kotlin and Haskell beyond that. So, perhaps in the end, it's not very functional, but it doesn't really matter. Thanks very much. If you if you're interested in approaching this more deeply from from the Java point of view, and also talking about closure and Kotlin money book, the well grounded Java developer has got a lot of material about about this topic in it. Thanks for having me today. Thank you. We do have one question, one more question from Michelle. Is this modern Java support pattern matching or are there any plans of what you're aware of to support it. Do you think it's an important feature of FB language. Yes. Okay, so this is a really interesting subject. So I've talked all the way through about a project called Valhalla. And at the moment, the future of Java. There are four main projects that are in flight to to evolve Java into into its next major form if you like. It's kind of like Pokemon evolution forms. But the, the, the next form which is going to come is really defined by two of those projects one of them is project Valhalla, which is a rethinking of the data model, and is about VM level concerns. Solve some of the functional programming problems for us, things around unification of the type system, and dealing with with primitives versus object references. So that solves a bunch of nasty problems that there are in one part of the language. But the other project, the one which I think is, is closer to the developer is called project amber. And project amber is different from the other projects because it's been focused on small incremental changes into the language as time has gone on so Java now has a release cadence of every six months. So we were actually seeing new versions coming out and little increments to the language of being delivered. So probably the first one was switch expressions. So this basically it was a first step towards pattern matching by changing Java switch statement, which is very very see like, and providing a form of it which actually uses is an expression. So from there, the intent was to expand the notion of what switch could be by introducing patterns. The patterns were actually introduced. First, not in the switch statement, but actually in Java's instance of. So basically that provides a pattern, which matches against the type, but then also introduces a new local variable, which is scoped to the to the block, but is of the appropriate type. So that is the basic first instance of a pattern, and incrementally things are being added to the language now. So Java has a process which adds in features using what are called preview features. So feature shows up and you can only use it by explicitly enabling it. And then we do a couple of iterations of that until until the feature is solid. And then it becomes a final part of the language. So where we are with Java 17 which came out last September, and it's the most current and up to date version is, we have some, we have switch expressions. We have the type patterns, and that's kind of about it. There are some other things which you can switch on by by by adding on the preview features, but it's still in the process of being delivered. The intent is to you to deliver an entire set of features for pattern matching, but we're still getting there. Another thing which has also been added related to that is algebraic data types. So Java 17 sports records, which are product types, and it also supports sealed types, which are some types. So that's that that is one really nice feature. And with with just the addition of algebraic data types there has been some movement there as well. Okay, should we take another question. Okay, we have two more. Jyothish is asking, so is it not recommended to do FP in Java, better to use other suitable languages. What's your opinion about writing FP style code in Java. Well, you can do it. I mean, of course you can do it lots of and it depends what you mean. That's one of the messages of the talk is that it depends what you mean by functional programming. It's a different view. Functional programming is not a monolithic thing any more than object oriented programming is a thing. I sometimes say about OO that you could name any property of OO languages, and I can find you an example of a language, which we both agree is object oriented, and which does not have the feature that you that you mentioned.  Different languages have different takes on what FP is. And I always think that rather than it being, you know, a binary is this language FP or not. It's a question of a sliding scale, and also a personal preference what works for you, what works in, you know, in the way that you choose to program. So can you write FP code in Java? Yes, of course you can. And an experienced programmer who has learned to program in an FP language, quite often will write better Java code when they come back to Java and they apply what they've learned. This is why I think it's important to have the different styles and to have experience in several different languages and several different styles of languages. Because they are, you know, they provide insight and a better way of approaching problems in, you know, even in a language which is not formally in that style and tradition. Yeah, we have last one. I will take last question. And maybe next questions can be taken up at the hangout area. The last is what are the other languages that overpass the Java in FP. Also, will Java be able to catch those other FP languages? Okay, so there's a couple of things here. So first of all, it depends on whether you're talking about languages which run on the JVM or not. Now, again, this is a choice. This is a trade off that engineers have to make. The JVM is the most well tested and highest performing general purpose language runtime that we have, you know, I'm not knocking beam beam is a great virtual machine. But the JVM is just much more widely deployed. And, you know, in its domain, which is general purpose, specifically general purpose, it can't be beaten. So you decide, do you want to stay on the JVM, or do you want to go somewhere else? If you want to go somewhere else then beam is an excellent choice, you know, you have a line of things like that. Or if you want to go down the static type route you have, you have Haskell, but both of those approaches require you to leave the JVM. And it's rich ecosystem, and it's community, and it's ease of finding programmers, and all of the things which make you want to be on the JVM, you lose if you go to one of those non JVM languages. So, to answer that question, what about non Java languages on the JVM. Okay, sure.  The three major non Java languages, which do FP, well I would say are Kotlin, Scala, and Clojure. And of those languages, Kotlin is a modern Java. It's basically someone designed a language with all the things that we've learned about Java over 20 plus years, and made them into a language which was better at doing clean up a lot of the rough edges, had a lot of nice new language features that people find to be productive. So that is why Kotlin is essentially a better mouse trap, a better version of Java, which does have better FP support. So if you want that, have that. Now Scala is an interesting case because it's been around for a long time. Scala's been around since before Java 8 came out. So it goes back to at least Java 6, that sort of timeframe. And it was originally designed as a research language, which just got more popular in industry. And originally Scala was the way of doing functional programming that was better than Java. It was the better mouse trap and instead, it's now moved on to become its own thing. So Scala is now a very solidly functional programming language. And I used to make jokes that sometimes in the Scala community, you'd find two sorts of folks. Folks that wanted to write Haskell on the JVM and folks that just wanted a better Java. And over time, I think the language has developed much more in the strongly functional direction. So it's an excellent choice if that's what you want at the cost of moving further away from Java. And then there's Clojure. And Clojure is different again. It's dynamically typed. So it's not a statically typed language in the same way that Java is. It has a very interesting, very lightweight runtime. It's very lisp. People can argue about whether Clojure is really a lisp dialect or not. I tend to think of it as a lisp dialect with just a bit of extra syntax. I really like it. I actually do programming Clojure from time to time if I have something which I feel like I want to want to explore it a bit more. So yeah, so that's your choice. Do you want something a bit like Java but better? Do you want something which is statically typed and heading more off in the Haskell direction, in which case pick Scala, or do you want something dynamically typed and a bit lispy in which case Clojure? So as with everything in software, it depends what you're looking for and it depends what you're trying to achieve with it.


Hi everyone, my name is Lee. I'm from Arizona State University and I'll present our paper, Delegating Private Set Interest and Mechanicality and its Application to Contact Tracing. This is a short work with Kai from Google and him from Telecom Parties. So I'll start with an overview of contact tracing. We see an application for our PSICR, the current solutions of contact tracing and its limitation. Later, I will go more detail how we can handle privacy concerns and how to improve a contact tracing performance. So you know, contact tracing is to find out all individuals that an infected person has been in contact with. And we want to do this because we would like to stop the disease spread. So how is contact tracing done? It can do manually by interviewing the patients. So you can now where and when they have been. So this solution has privacy concerns and offensive to scale. In this paper, we focus on mobile contact tracing. The phone application can detect all possible nearby contacts. However, it must be privacy sensitive, must be high scalable, especially on the user device and requires less false positive or negative rate. So most current contact tracing approaches are based on Bluetooth and work as well. When Alice and Bob are close in SIGFIX, Bob use a C to generate and broadcast a random token. So you can see here the number one, two and three. And Alice save all the nearby random tokens to her phone. A few days later, Bob is positive with the disease. He applies all the CIS that used for his random token. So the server can see number one, two, three. And now Alice downloads all the nearby random tokens on the CIS from the server and check make posters. So the users broadcast and save random numbers. So it looks like that the personal information never shared or collected. But it's not always true. There are several problems include security issues, for example, the linked attack or replace attack. The current solution is not scalable for the end user device. And they have the highest false positive or negative rate. So in this talk, we focus on the linked attack. And we want to address this problem. And we also want to improve the performance of the contact tracing, especially on the user device. So I will present the detail of security issue here.  So when doing the compare reasons, Alice can learn which token is infected. So she can see that token number one, two, three is infected token. And then she can infer when and where and from whom she received this token and then can re-identify both. So for example, Alice put an Uber ad known and receive this token at that time. So she can infer the infected status of the Uber driver. And actually, Apple and Google solution store these tokens at the OS level, but it still has some privacy issues. So moreover, an attacker can install the Bluetooth sleeping device to different physical locations and then collect the random token. So is it possible for the attacker to keep track when and where they receive it with tokens? And the attacker can do that to learn the travel road of the individuals. So this picture is the real attack of Apple and Google solution. So beside the security issue, there is a performance problem, especially on the end user device. So they call that the user needs to download the token on the scene of all infected users. So for 32,000 new daily impressions, the DP3T approach requires 450 megabyte download in the token. And Google and Apple approach requires only seven megabytes download in the scene, but they need 66 million AES operation to generate the token. So clearly that you need a good phone to do the contact tracing. So in the rest of my talk, I will present our solution to prevent the link attack using private matching, private set intersets and connectivity. And we also show how to improve the performance of contact tracing with the outshot scene protocol. So I'll start with the link attack. The main reason of this attack is that all the infected tokens are publicly available and therefore known by the attacker. So previous solution would propose a simple solution to address this problem. The main idea is still allow Alice to check his exposure status without knowing all the infected tokens. And they use PSICR for this. So PSICR is a two-party protocol where the server has a set of X and Alice has a set of Y and Alice learns the size of the interactions and nothing else. So by doing so, Alice doesn't know which token is infected. So she can infer both infected status. However, this solution is heavy on public key operations and requires exponentiation for each item. Therefore it's inefficient when the set size is large. And here is the contact tracing system. And they have several systems here. And you can see that they either expensive on the running time or the communication cost. So for the poor phone, can we outsource the contact tracing computation to the cloud? So I will go to our delegated PSICR protocol and with our delegated contact tracing system. So along with that we introduce the new crypto-tune which we call or previous distributed key PLF. So a simple solution for delegated contact tracing system is that we introduce another cloud server. And Alice outsources her receiving token to that server who the server, this is the cloud server and the back end server runs PSICR. And then we turn the Rbook to Alice. However, these solutions preview the Alice travel history to the cloud server because the cloud server known all the non-infected tokens. So in our paper we propose a delegated contact tracing system where Alice can introduce her receiving token to several cloud servers using secret sharing. So it means that the sum of the value here equal to the token. So you can see number 123 can be the sum of number 100, 20 and 3. Now cloud servers and the back end servers run secure computations and Alice is the person to get an output whether there is a match. The secure computation here is delegated PSICR. So input Alice has Y, the set of Y, the back end server has a set of X and the cloud server with no input. And Alice learns the size of the interaction and nothing else. So this paper propose the first delegated PSICR protocol. Before going to the protocol, I would like to present a previous PIF functionality and it's the definition of our new OPF. So the traditional OPF we have one sender and one receiver. And the sender with the key k, the receiver input, the value Y and receive fky. So you can think h of Y to the k, the half function of Y to the k is the OPF. So clearly a property is that if x equal to Y, then kx equal to fky. We introduced a new crypto term which we call oblivious distributed key pf. So instead of having one receiver, now we have many receivers. The sender have the same key as before, but the key is distributed. So for the first receiver, if he inputs Y1, he will receive fk1Y1. Similarly, the last receiver input Yn will receive fknyn. And we have the property that if x equal to sum all the Yi, then fk of x equal to sum all the fkyYi. So you can think like the value Y is also distributed. And another important property is that if we have the combiner who can collect all the OPF value fkyYi, the combiner can reconstruct fky by some of all fkyYi. And the combiner learn nothing about fkyYi or the value Y. So given that functionality, we go into our delegated PSICR protocol. So the main idea is that Alice distributes her token to cloud servers. So say Alice has a number of Y1 and Y2. Each cloud server has a share of Y1 and the share of Y2. And then these cloud servers run ODKPS with the backend server. So the backend server has the key k and the cloud server receives fkyY. So you can see that for Y1, the cloud server receives fk1Y11. And now we introduce a combiner who can combine all the OPF value here. And he can compute fkyY1 and fkyY2, right? And because the backend server has the key, the backend server can compute all OPF values on his set. So he can compute fkX1, fkXn. And now what we want is that if the combiner have have the two, the same OPF values, so for example, if the combiner have Y1 equal to some fkyY, then the combiner will receive the secret values of the backend servers. And otherwise, this is the random value. And then somehow, if Alice knows all the secret values here, Alice can do the comparison between the secret values and then see whether there is a match. So we use the polynomial to implement this step. So quickly, the server interpolates the polynomials on the OPF values and the secret value. So this is the polynomial going through the OPF values, fkXi and the secret value Si. And then the server sends the coefficient to the combiner. The combiner either you add the polynomial on the OPF value. So clearly, if X equal to Y, then you have OPF value equal. So the combiner can learn the secret value. And otherwise, the OPF value here is random. So the polynomial on the random values is the random value. And now the combiner sends all the x, y to Alice and she needs to set it in the server order so that Alice doesn't know which one is in the interactions. Similarly, the backend server sends all the set of secret values to Alice. And now Alice can compute the intersection of x, y and x. So to reduce the communication cost, you can see here the size of the secret value proportional to the set size of the backend server. But the secret value can be a random. So we can reduce the communication cost here by using PRG. And we also use the hash to mean scheme to reduce the cost. So please see the paper for more detail. So by interacting our dedicated PSICR to contact tracing systems, we have the lowest communication cost. And plus in the running time, because in our system, the user can outsource all the communication to the cloud. And we also can prevent the link attack. We also benchmark the performance of end user device. So for 4,000 tokens, the server only require the user only require a few millisecond to do the dedicated PSICR protocol. And it requires only a few like 200 kilobyte per second. This is a very reasonable cost for the phone. And for the cloud server, it takes about a few minutes to do the PSICR or contact tracing on the very large set size. So, and this is for single threading. So if you have multiple threading, then the cost, the running time can be reduced to some seconds. Yeah. Thank you for listening and you can see the talk on e-print and the demo of our implementation on e-print.


the most beautiful thing about life is that you get a do-over, right? You have today and then you have tomorrow and you hopefully have a day after that. YOLO really becomes a thing. Keep watching to find out what book we're talking about today. It's Kyla Denango and I am talking all about death.  Okay? The author of the book is Aqueke Ameza. The genre of the book is fiction. The theme of the book is literature romance. Okay? So y'all, this book was off the hook. So I didn't read her prior book. So this was my first time reading this author and I'm in the first chapter going with this, right? You got people out at bars. They're hooking up and I'm just like, I fell in love with a limb. Oh my goodness. I could see him in my mind. Okay? And before I get too far, let me tell you about my favorite quote in the book. And it is actually a quote by Jonah. And so Jonah says, one of my favorite things about people is how we can make disasters of our lives and then recover now. You have to read the book to find out why Jonah is so important. Okay? But we're following the story of Faye and she's dating and then she meets this absolute love. And you know, you have your usual conflict. It actually was very abnormal. But you have a conflict and I kept going back to this quote because Jonah is like, you can make a complete disaster of your life and then you can recover, right? You can always find the next thing. You can look towards the next step. You can find a way to make it better. And that was the theme I think for Faye's entire life, right? And so of course, in hindsight, now that I finished the book, it makes sense as one of the few times that we see Jonah so that it would be so important. But, but Faye really started to live that. That was a really important part to her entire storyline, even when her life is not a disaster. And you're just like, okay, but what disaster are you talking about? Oh, oh, I should have just waited a couple more pages. But there are very few authors where I can just picture them, you know, and typically I'm like, oh, I would love for this to become a movie. I want to see what they would look like. If y'all don't call me to help with casting, a limb could see them in my mind, right? So you do eventually go from Brooklyn to the tropical, the sun-drenched skin, all of the stuff you're seeing here on the cover. But you're just going to be patient, right? And I'm still not sure of the title.  There were a couple of images of death in the book. And I'm still not quite sure. I would love to attend an author's session or an author's like tell-all and have a quick talk to us about the title because there's a there's a couple interpretations. I'm gonna just leave it like that. And another book that has a title that can be left up to interpretation is We Are Not Like Them. So I'll see you in the next video. Bye.


You won't need this, you can do it. You got anything like that? No. No? You got a paper in there? No. Okay, we'll give you a pen.  We're just not going to get sweaty. Just write on your hand numbers, okay? Just some information, okay? They're going to brief you in there. If you've got any questions, make sure you ask them, okay? Here you go. Do you have a sling? What is this number? 1-1. Oh, it's true. Go, go, go! Go, go, go, go! Go, go, go, let's go!