Welcome to Asian Review. I'm your host Bill Sharp. Our show today is the Taiwan military, the good, the bad, and the ugly. And joining us via Skype from his home in Taiwan is US Army retired Lieutenant Colonel Scott J. Elinger, who spent 22 years in the Army as a China Foreign Area officer. He's well known for his expertise on Taiwan in general and Taiwan Military Affairs specifically. He has seven years of direct experience in dealing with Taiwan's military. So today we want to hear from him what are the Taiwan military's strengths and weaknesses. Welcome to Asian Review. Well hello, thank you very much Bill for having me on the show here. I really appreciate that the invitation and the ability here to speak with you and our guests. Great, great, great. Well during the last four or five years the Taiwan military has really been going through some fairly difficult changes. Trying to make a transition from a force based on conscription to one based on volunteer volunteerism. So can you tell us a little bit about those changes and challenges the Taiwan military is facing? Well I can, well we'll start out with a little bit of how this transition started. I remember about about say about eight years ago, nine years ago, the discussion points and they've been discussing this for a very long time. It's just when do they want to make this decision on going from compulsory service all the way over to an all volunteer force. And because of the the historical things that here happened in Taiwan, you know very similar to Korea, compulsory services you know mandatory. Originally it went from like three years to two years then it went to down to like a year and a half and then to 14 months and then now it's transitioning to its new pattern. And so the all volunteer force right now is something that has been politicized for both political parties here and it's there for Garner it's types of their voting targets here. But when it comes to the all volunteer force here in Taiwan I mean there's been a lot of work for it but there's been a lot of road bumps along the way in trying to make this happen. And the one thing I saw that was probably the most difficult part. What are some of those road bumps? What are some of the obstacles that this transition has been running into? Well first of all I think what the most difficult part was how do you actually create a recruiting type of command or recruiting type of system that really targets individuals here in Taiwan both male and female to actually raise their right hand and actually join the ranks. And something that we spent a lot of time dealing with them and how to how do you create you know honor duty level country to just raise your right hand say I'm going to join and actually volunteer. And then the other part was looking at the other percentage of people that look at the military for you know creating a better lifestyle and trying to you know building block to creating a your educational path also at looking at creating your you know career path even though you may not be an officer but within the non-commissioned officer enlisted type of system. So what I saw on that was probably the hardest point is how do they create this type of recruiting command or recruiting system that can really inspire the youth here to raise their hand and say hey I want to volunteer. That was the hardest thing that they've been wrestling with it's the incentive program it's it's answering the why question why do I want to volunteer to be in the military and just kind of I think it may lead in some other questions is is in Taiwan for many years joining the military was not one of the top 10 jobs to have or in the United States over the last 25 years being in the US military as an officer a non-commissioned officer was a an honorable job to have and it was it was ranked as one of the I think top 50 jobs to have within the US was in the United States. It doesn't even hit the list. Let me ask you this you know there's some theory I would say a theory there's some discussion a point of view that the democratization of Taiwan really killed the army. From my perspective I wouldn't say that it's destroyed the military it's that I think right now it's transitioning it's transitioning from this the conscription to all volunteer force and so with that I think it's just with the road bump it's the road bump is how do you transition from conscription to all volunteer force and that that's the road bump and I think it's going through the political dynamic of okay what party is going to garner the vote so that they have more people because to get rid of conscription means okay all these all these males don't have to do now it used to be 14 months and I think now it's changed over to mandatory four months and then they're placed on a on a mobilization reserve status that seems ridiculous to me four months I I mean that just seems to be meaningless to me and then what my understanding is although they're supposed to attend reserve sessions that the number of people that actually get called up for reserve duty is very minnable and I've often I've talked to people in Taiwan to flag level officers Taiwan flag level officers say even if they caught up all the reserves they have insufficient equipment to equip them with so it seems to me the reserve component in Taiwan military is pretty weak well that's something we've had discussions with before my prior time was you know wrestling with you know what is Taiwan reserve command and how to institute a professional reserve force it doesn't have to be exactly mirror image like the United States but something very similar that they have a National Guard or an Army reserve or an Air Force reserve neighbors or Marine Corps reserve that's very similar where you create kind of a ramp off so if you don't act the duty service for let's say four years five years or six years eight years and then you just you wish to pursue pursue a civilian career is maintaining that that individual in a reserve capacity or you have an institution that creates the reserve system very similar to the United States where you go through a professional training course you get all your training done and then you then you have the weekend drills that we have in the United States and then you do two weeks during the summer and I think that's something where if Taiwan the the legislature as well as the politicians if they really thought about it hard I think that'd be a great system where they could probably get volunteers with to the level that they want and they can have a professional enough type of reserve force that will be able to do their duties in accordance with the their missions that are attack that are signed to them but again it goes back to I think it's it's the it's the will of the the Ministry of National Defense along with the politicians to actually create this type of reserve system that where you look at the mobilization system that they have is you've done your conscription time which now it's four months of active time which is basically you're doing your basic training you're doing your skill skill set for whatever military operational occupational specialty you're going to go into your MOS and then once you're done with that then you come off of that status and you're mobilized you know what I want to ask you about this there's what I call mobilization is I think they get recalled twice within an eight-year period to mobilize they go to their assigned unit they do it for X amount of days which is short period of time then they're done and then they go back to whatever their their civilian career is there seems to be some plan that's come out of the ME MMD recently the Ministry of National Defense where they recall retired NCOs to active duty it's a volunteer thing if you want to come out of retirement for say like a year or two years then you'll go back to active duty but you'll be considered part of the reserves I don't quite sure if I have that right but it's something like that if you heard of that plan I think they've probably you know I've been off been off active duty for three years I might have been changed in the last three years but that's something I think that's probably that's the beginning of looking at how the United States does what we call the AGR system such the the active guard slash reserve type of system where we that's been there's been those discussions where it's something very similar to that where they look at people that are ETS that you know that's term not retired but they they left after X amount of years then bring them back on to an active status and then let them come back in that might be something new but I think that's step one that's stuck one to the overall you know maintaining the skill sets needed to lead lead soldiers airmen sailors and Marines in in a crisis situation you know I I read someplace an article that the timeline military is considered the 15th most capable military in the world have if you ever heard anything of that sort yes I mean yes I have and I think with my observations is they're a very professional military and what do you mean by professional military you better define that because not everybody might know exactly where you're coming from on that all professional okay so the job at hand they're able to do the task they're able to plan the mission they're able to execute the training and they'll execute it to a standard that they've set for themselves and then they do it in in a in a system where within the military culture the military professional way of doing things doing their mission requirements they do it right by the book and they have their regulations they have the doctrine that set late in front of them and then they follow it by the tee and so they follow what what the doctrine is and and with that that's what creates I think from my observations are very professional how they do it so know exactly what they're supposed to do and they'll go do it and so that's what I've observed I've seen that in that aspect the other part is I think with you know being ranked in the top 15 is they based a lot of the doctrine off of the United States they updated it in accordance with how we change in I don't say as fast as we change but they they they updated the doctor and I think with that they're able to adjust it so it fits what their requirements are in some aspects they may not as fast we do but they do eventually change it because I've heard some people say that in terms of doctrine they're behind the times because they did not allow the the the interaction with the US military that they really wish they had there is an erection I mean there's quite a few training exchanges that do occur but this kind of goes into your title of you know the good the bad and the ugly some of these things so I can kind of box it in for you here and the good part is very professional military so they do what the standards are they train in accordance with how the doctrine is laid out for them to do whatever their mission requirements are in accordance with their service or 30 seconds of when we go into the bad part is I would say the bad part is the ability to change and change rapidly and make adjustments in accordance with how modernization is has changed how the United States and how other Western nations have fought their battles we get those action at after action reviews actor after action reports call me ars once those come back the United States is always morphing its system to fight better tomorrow you know we're always changing very fluid system we're always looking at how to change as fast as we can to meet the changes the battlefield stop I'm gonna stop you there because I'm being told we have to go to break but we'll pick this up when we come back in about 30 seconds about a minute okay see you see in a couple minutes hi this is a Jane Sugimura I'm the co-host for condo insider and we're on think tech Hawaii every Thursday at 3 o'clock and we're here to talk about condominium living and issues that affect condominium residents and owners and I hope you'll join us every week on Thursday aloha aloha this is business in Hawaii with Reg Baker I'm the host of business in Hawaii and we're a show about positive stories of business in Hawaii both the companies and the individuals we broadcast live every Thursday at 2 o'clock on think tech Hawaii calm and we can also be found on Olalo during normal scheduling please join us so we can share with you some of the experience and insight to having a successful business or career here in Hawaii aloha welcome back to Asian review I'm your host Bill Sharp my guest today is retired U.S. Army Lieutenant Colonel Scott J. Elinger he's joining us from his home in Taiwan joining us via Skype he has served 22 years in U.S. Army it was a China Foreign Service officer China Foreign Area Study Officer very good Chinese he's living in Asia a total of 18 years in Taiwan mainland China Southeast Asia Japan Korea so he knows then he knows the neighborhood before the break we were talking about the good the bad and the ugly which is the title of today's show of the Taiwan military and we're talking about Taiwan's how should we say challenge and changing its military culture adapting to changes in military thinking in a fairly rapid fashion so why don't we pick it up from there okay so I remember we were discussing kind of we're transitioning to some of the issues and challenges that Taiwan faces and that's changing the doctrine in accordance with how how things change within today and so what I observed was I would say that they're probably about you know X amount of years I don't want to say how many years but they're they're behind and what it is it's the ability to rapidly change as our doctrine changes then Taiwan lags behind in making those changes and the gap kind of widens a little bit and I think with with some of the exchanges that we've had with Taiwan I mean that there's we have good exchanges and so where we go into kind of the ugly part is that during these interactions that we have is we give them advice in how you want to make these changes in accordance with whatever skill set it's applying to or type of doctrine it's applying to and what Taiwan will go it'll go back to what it used to what it used to be doing 10 years ago and they don't want to break out of this this is how we used to do it and changing is a difficult thing to do and it's hard and it's painful and so it's breaking through that and that's the ugly part is the the ability to make the change and the willpower of the senior leadership and the mid-level leadership to take the risk on let's change and that's the ugly part and that's the one part that I I observed so many times that just make the change and if there's a mistake it doesn't matter you just train again and you make your you make your adjustments in accordance with how you did something as we do in the US military is you do something do your mission you do your training you do an action action after action report you you look at it it's okay where we make the mistakes and then you go out next week and you train again or you may just train again the next day but the problem isn't something very similar what happened the United States military in the 90s is the zero defect mentality is you don't want to let your mistake mistakes be shown because your evaluation or your promotion is not going to go go to the next level Taiwan's kind of stuck in that zero defect mentality so that's another ugly part that I observed and I think very simple change to to it is where I've advised you know brigade commanders battalion commanders I said you as a brigade commander you hand the above and then you protect your below and battalion commander you deal with your particular gate commander get the resource name protect your company commanders let them train if they make mistakes it doesn't matter it's trying to reverse that culture of instead of top always observing the bottom is let that the bottom kind of protect itself from the top and fence off senior leadership from always trying to look at this zero defect mentality and trying to like have brigade commanders command squads and platoons okay it's changing that that type of mentality okay good you know so much so much to talk about in so little time but let's talk about amphibious assault or amphibious invasion of Taiwan which you know everybody talks about you know from time to time so what what is Taiwan's ability to repel an amphibious invasion obviously from China well that's a thesis and so we start writing our thesis right now here it's about 300 pages a question in the short time we have but give us some idea I from the the ability from Taiwan what I've observed their ability to defend it's there they can defend it it goes back into the its ability of how you know what's your reaction time and this goes into any any type of defensive type of battlefield or strategy that set up very similar to other like for Korea for instance we can take Korea it's your warning time and if you have enough warning time are you able to defend and get to your battle positions to defend against an offensive attack same thing applies to Taiwan so it's all it's all depicted on time requirements if there's enough time to mobilize your reserves then the defense will happen and I think would be for Taiwan's requirements of defending as long as they can for coalition forces to assist in any type of crisis it's all dependent on what time they have to mobilize so what I've observed their ability to defend yes they can do it to cover all the main amphibious assault landing areas yes they can do it but it's all based on time in your reaction coalition forces means the US getting there from Japan and other places in the Pacific correct I'm not gonna get the political things but we will use the term coalition forces that okay okay this is Taiwan in a crisis situation yes okay well that that's good to hear I'm glad that you pointed that out now you know it seems to me that saying when it's got a much different approach towards the military than the mind Joe it seems to me I hope we're not being unfair here but it seemed that mind Joe was not really very interested in the military and the military kind of was hurt by by his lack of attention whereas Tsai Ing-wen really seems to want to beef up the morale of the military and inject a higher sense of professionalism she seems to have visited a lot of military bases in the fairly short time that she's been in office has a lot of ideas about building up Taiwan's own defense industries what kind of what I've described it and I just it's only descriptions only an opinion but the way I look at mind Joe was I call him the Jimmy Carter of Taiwan I mean he he really I would say you know the military of course is something that you know it's part national defense part of the nation but I from what I felt in in what I could just from a from an abstract feeling is he just military wasn't important and it I would agree with a second third seat to everything else and it was more used for humanitarian disaster relief missions and that was the primary focus of what he wanted to use the military for instead of like cake military is great for humanitarian disaster relief yes it's very important mission set United States is important yes but when it came to actually looking at the morale of the military and giving them the funding and resources to go through the transition to an all volunteer force it wasn't there and it really created within the military some negative feelings a lot of the I would say feel great officers and below we're not happy some of the senior leadership I saw these left they retired so I'm out and then of course then you have the political appointees that they made the rank because of their political connections very similar to the United States but those those individuals they had to tell the bottom line of whatever the president said so I saw that within the military morale wasn't the highest I saw the zero defect mentality get worse from that and so that that's just observations of what I saw over during the time that mind you it was the president unfortunately I just I saw that and you had people kind of battle through that that that presidency and his policies for the military which I thought it hampered quite a bit with the new president I think she's along with some of her advisors have really looked at these issues of looking around and hopefully within the next two to three years she'll be able to change this morale she can change the military and look at programs to create I would say the professionalism needed within the military and a professional military culture that allows the junior non-commissioned officers junior officers middle mid-grade officers mid-grade non-commissioned officers to aspire into what they have and then creating a national image that the military is an honorable and a valuable part of society where people look up to the military and you know they salute you know they salute you on the road saying hey thank you for your service which in the US military when I was an uniform or if they know I'm a veteran they thank me for my service it's creating that society to respect the military and hopefully signing one and her advisors on defense can make that transition society loves the military and honors them okay Scott we're coming down here to our last few minutes I got a couple more questions I want to ask you but I'm gonna ask you to give me some fairly short answers spying seems that when my Joe was in office that there was a there's an explosion of spy cases occurring in the Taiwan military of course this means mainland intelligence agents recruiting Taiwan military officers often at very high level often a flag level what's your take on that and I'm sorry that we don't have too much time to discuss this but what's your what's your take on that my quick take on that is it it's probably has to do something with the retirement system and also with the salaries yeah Taiwan over the last couple years is raised salaries but probably not raised them enough where as the mainland China wants to you know they they do dangles of incentives and money it becomes lucrative and so I think you have some of the bad apples you know the 2% the 1% or the point fine whatever the percentage is you know that the bad apples that decide to take these incentives it's unfortunate and I think it's something where Taiwan really needs to instill it goes it goes back to an honorable feeling of being in the military great last 30 seconds in the last 30 seconds is there anything that you want to add in I think that the last top I think that I think another topic for the future if we want to talk about it is looking at a professional military culture and how it intersects with society's culture and so in this aspect is professional military culture and how does that relate to Taiwan's society's culture what are some of the issues and what causes problems when there's too much of society's culture within the military culture I think a great topic for us to talk about in a future segment that's a really good point that's a really good point well I think that about brings us to our close here I want to continue but the clock tells us it's about time to go and I want to thank our guests for joining us today and I want to thank you for viewing next week my guest will be Mr. Michael Turton he's a well-known and also very provocative blogger who will be joining us again via Skype from Taiwan see you then okay thank you Bill and I know Michael's we're a good friend of mine


What's going on everyone? Sam here with late in sports cards and I am ripping one box of 2021-22 Topsywafa champions league chrome soccer hobby for Matthew F. So good luck Matthew Here we go, buddy I'm sorry. Got me enough points the last lifetime I know some victors a big points guy. That's all I know Some victor just emulates panini points in general. All right. Good luck here, Matthew Got polisic base.  And silver la la londoski Byron munich Leonel messi nice one there Got usyptomir and blue sergino dest Serginio dest Samuel adose Got refractor rubin ds Give me my pretty gold vinyl and I'll be content andy robertson Got silver refractor kind of taylor future stars friend and torres I'm real close to buying the gold Got lucas ocampos on the lava Not numbered it's always sam's fault with the points raphia liao hedgery There you go, and glorie virgil van dyke 5k. Holy cow. Is that are you serious? Fractor auto ryan graven birch Nice one there Congrats, but uh on that one, man the uh Kind of like seppia negative refractor it's a 225 of jordan seat batchou Maximilian arnold It's a huge car the graven birch auto.  Good luck buddy marquinhos uh tiboperson Bata and marco degrasa On the uh, mini diamonds not numbered That'll do it for your box there, uh, matthew. Congrats on the hits as always man. Thank you again. We'll get those right out to you. Thanks, brother


Welcome to the Everton News Daily. Stories continue around a potential 12-point deduction by the Premier League Independent Commission, where Everton are concerned. These stories were broken this week with awful timing really, within hours of the announcement that Chairman Bill Kenrith had passed away, these stories were everywhere about Everton receiving a possible 12-point deduction. The headlines, obviously, have made people take attention of it. A lot of these stories around it basically said that the 12-point deduction was just one course of action which the Independent Commission may come up with. But on top of that, 777 have reportedly said that they have contingency plans in place in case such a penalty was awarded. It is hard to see how Everton could be awarded. The right thing could be punished with a 12-point deduction for what seemingly appeared to be one charge. Yes, if they've broken some rules, if, and it is if at the moment, then there must be some sort or some form of punishment. But 12 points just seems absolutely crazy to me and to a lot of other people as well. This seems to be a story that will run and run until, I guess, we know the outcome of this commission, which could be four weeks, six weeks, whatever. I don't think it's going to be a very quick conclusion, but clearly for the football club we want to know the outcome ASAP and then depending on the outcome of that, Everton, I'm sure, will have to take advice on how to combat whatever penalty they are given if they are, of course, found guilty. And it isn't if, at the moment, Everton have robustly defending their position. That is the club's sake on it. I'm going to have to see what happens, but just right now there are a lot of chainlets going all in on Everton with regards to this. So, you know, it doesn't sound good, but like we say, there is only one possible outcome of which they are a few. The other thing that brings into question is the fact that this is out before any kind of conclusion has been made from this hearing and therefore it would surely prejudice an outcome, whether it's subconscious or not. It's everywhere and if you are on this independent commission, how could it not come into your mind or into your subconscious when you're seeing it everywhere. So, it's an interest and one and it's one, I hope Everton are prepared to fight if it goes against them. There have been five fixture changes announced today regarding Everton. Tremendous. The Newcastle home game, which should have taken place on Tuesday, the 5th of December is now Thursday, the 7th of December. Kick-off 7.30, that match will be shown live on Amazon Prime. Means that Chelsea game has now moved from the Saturday to the Sunday at 2 o'clock. This isn't shown on live TV. It's simply been moved because the Premier League have moved our game with Newcastle. Burnley away on Saturday the 16th of December, it was a 3 o'clock kick-off. It is now a 5.30 kick-off and will be shown live on Sky Sports. Manchester City at home should be scheduled for Boxing Day. That has now been moved to the 27th of December. That game will kick off at 8.15 and will be shown live on Amazon Prime. Aston Villa at Gooderson Park is now on the 14th of January, which is a Sunday. It's a 4.30 kick-off and that is live on Sky Sports. Four home fixtures changed. Former Everton manager David Moyes said that he was saddened to hear about the death of Everton chairman Bill Kenwright, but he is focused ahead of two important games, the West Ham United, West Ham Play, Olympiacos and then Everton at home. Amongst a lot of the things he said, he said it was such sad news to hear about Bill Kenwright. He gave me my first job in football and as a chairman he was everything a young coach would want. Bill Kenwright was great with me and my thoughts go out to his partner Jenny and his family and friends as well. Him and Bill Kenwright did have a good partnership with Everton. Obviously 11 years David Moyes was Everton manager. It was quite a stable period for our football club. We were in Europe and got to an FA Cup final, semi-finals or cup competitions before David Moyes did move on to Manchester United. David Moyes adding to a lot of other tributes that have poured in for Everton chairman Bill Kenwright this week. Finally, some transfer news. Newcastle United are reportedly keeping tabs on Everton midfielder Amadou O'n Arna ahead of the January transfer window. Over 85 million pounds has been mentioned for the Everton midfielder. Newcastle of course have lost the midfielder. Sandro Ternallee who has been suspended until August 2024 due to some legal betting that he shouldn't have been doing as a footballer of course and therefore they are looking to strengthen their midfield options and this is just a story that has caught the headlines today. That is it for the news day. Do give the video a thumbs up, subscribe if you haven't and if you want to become a Toffy TV Premier member the link is in the description and QR codes on the screen now. See you later.


How do deep questions about history and language affect the way that we design software and think about where technology ought to be or where we want technology to be? What role religion and religious values play in people's lives? What is our moral relationship to the natural world? Do we owe the natural world anything? Why do we think certain things are important and pretend to neglect other things? And what ways does that configure the worlds we bring into existence?


Thank you. Good morning. It's so nice to see all of you. This is literally my favorite thing to do.  This is my happy place. I'm also really, really excited to be sharing this stage with amazing speakers. I feel like this lineup is kind of ridiculously good and ridiculously intimidating. It's kind of awesome. Also, I'm super psyched to notice that 33% of our speakers are thought bot employees, which I think is kind of cool. And if I can just recruit one more before the end of the day, that's 50%. So Linda, I mean, think about it. Sandy, you know, Tom, anybody? Talk to me at the break. So I, like Linda, am a higher education dropout and mediocre programmer. But I'm trying to get better. I'm trying to become a better programmer. And one of the ways I'm doing that is to focus on the fundamentals. So this talk is going to be a live coding talk. We're going to write some code here.  But the point of all this is actually not for me to reach the end.  The point is interaction. Imagine that we are all pairing. I'm driving and you are navigating. So please talk. Please give feedback. Please ask questions. I want to hear from you. My bar for success of a talk is how much back and forth we have. I want to have conversations. I want to stop and talk about things and delve into little side things. I love that. It's my favorite thing. So let's do that. Let's get started. Let's look at some code. This is, by the way, live coding in the bath. Can I have a monitor? There it is. Excellent. Reason Vim, by the way, obviously, right? Any Vim fans in the audience? Yes. Excellent. Any Emacs fans in the audience? Wow. Okay. I mean, I kind of like Emacs, too. It's nice. Okay. So please read this code. I can bump the font just a little bit. So here's something I realized. Here's what it looks like when I run my tests. At this font size, it actually works. But if I bump up the font even more, it doesn't work. So let me, let's, let's, I'll prove it to you. So here's a fail. And when my tests fail, it looks like this. You can see at the bottom, there's the failure. And here's what happens. Let's do that again. I'll get rid of the fail. When they do work, they go, that goes away.  So unfortunately, this is the max font size right here. I'm really sorry. This was kind of one of those things I don't know how I could have anticipated this exactly. So please bear with me. My apologies for any hardness to read. But please squint and read this code.  Once you get the gist of that. Okay. So just a quick overview. This is a class that sends invitations. It takes a CSV of people we want to invite somewhere and a message that we want to send each of them. For each of the recipients, which we'll get to, we create a mailer, we send a mail to their name and their email, we include the message and then we deliver it. And the way we get the recipients is by parsing the CSV that comes in and turning it into a hash. So how do we feel about this code? Any comments? Initial impressions? What's that? What's that? Ouch. Was that your response? Often code I wrote makes people say ouch. Yeah. What's ouch to you about it? Yeah. So the one feedback was what if my, what if parsing the recipients fails? And I'm sort of in the middle of delivering. So I'll send like 50 emails and then I'll hit a parse error. And then like, what happened to the rest? Well, who knows, you know, air break exceptions. Not sure. Yeah. That's good feedback. That's good. So this is a man who sent a lot of email I imagine probably through background jobs with retrial jobs, I hope. Other thoughts on this code? Yeah. You are, you're, you're about 25 minutes ahead of exactly where we are. So nice job. His feedback was he expected CSV to be an injected dependency. And he thought it was weird to be sending in a CSV full of names and then parsing it in there. Is that a fair summary? That's, that is exactly what I was hoping you would say. So to me, so this is, this is not ridiculous code to me. This is code that I actually probably would write as a first pass. So my general approach to solving any problem is to first make it work, make the test pass, and then make it beautiful later. So I will look at this and say, okay, we take, we take in a CSV full of unparsed data, we parse it, and then we send, and then we send email for each of those things. And that sounds like very much like we have multiple jobs in this class, right? There's multiple responsibilities here. And we all know that we want to follow something called SRP, single responsibility principle. Or I shouldn't say that we all know. You might consider following SRP. It sometimes can make your code better if your classes have a very focused job. And so often, I will find myself in this position where I'll muddy up a class with another responsibility, and I'll say, okay, now it's time to extract it. So let's extract this code. And we're going to do, so we're going to do the extract class refactoring right now. We're going to do it sort of slowly and I'm going to try to do it as cleanly as possible. And this is how I try to do it day to day. Again, we're focusing on the fundamentals. It's going to get a little more complicated soon, but we're going to start with some simple stuff. So what's the first step in the extract class refactoring? Anybody? Name the class that's reasonable. Yeah, the parsing of the recipients. What does that mean for a first step? Okay, so there's an instance variable for the recipients instead. Yeah, so for me, the thing I like to think about for my my first step is I like to sort of write the code I wish I had, right? This is kind of a classic TDD trick, and we are going to be TD in this by the way, I have tests. This is what it looks like when the tests run and they pass, all the thing pops up and it goes away. If they passed, you don't need to see anything, right? Like, that's just no information needed other than success. When they fail, that little box down there will stay with the error message. And by the way, notice that it takes me two keystrokes and basically no time to run my tests. And that's important.  People that tend to do that will abandon TDD and say it's too slow. And it's like, well, TDD isn't too slow. What you were doing is too slow. So running tests should be, do not leave the editor activity, it should be in the editor activity. So let's start writing what the code we wish we had. I wish we had a parser. Whenever I have to parse something and something else, I always want parsing to be on its own. Parsing is one of those great tasks. You can just always pretty much draw a box around it and say, parsing happens over here. Great job for a single isolated class. So I wish we had a parser. What do we do now? Run the tests. Correct answer. What happens on a new slide is constant parser. That's pretty fair.  So let's make a parser. Is the next task, is the next thing we do? Do we make a parser? What's that? Just the class. I'm going to go even one step a little bit more. I'm moving even smaller steps. I'm going to make the spec first. I know I'm going to have a parser. I want targeted specs for the parser. So the next thing I'm going to do is make some specs. Spec, parser, spec. I'm going to run this again. I get the same failure. This is actually great. Because I'm extracting a class from an existing class, the unit tests for the invitations class are now basically an integration test, right? The integration test, this invitation class and the new parser class I'm creating. And so when I start to create a when I'm writing code in general, I start from an integration test, I let that fail, and then I start writing a unit test and watch and make those passed. And we're going to jump back and forth between the tests for these different files and take turns and make sure that the message in them stays similar. So we have a test for our parser. We get this uninitialized constant parser. I'm going to vertically split this. We'll see how that works. We don't have a ton of resolution to play with. But here's our parser. This is how I work most of the time in like 640 by 480. It's pretty awesome. Okay. That right there, that was that test passing. So it went away out of our face. That means, okay, now there's in fact a constant called parser. And we found it. So now let's go back to here and re-run the test for invitations spec, for the invitations. So I run the invitations spec and those passed. Those happened to stick around. Okay. So now we're green again. So again, next step, write the code we wish we had. Now that we have this parser, it doesn't do a lot, but we have it. I wish in recipients, I could just ask the parser to handle the recipients. Like that. So let's run our spec again and see what we get. Come on. No method error. Undefined method recipients for parser. I should give you a second to read these errors. I've done this talk a couple of times, so I might be able to read them faster than you. No method error. Undefined method recipients on parser. That's reasonable. It's a brand new class. It has not that many methods, except what Ruby gives us, and certainly does not have a recipients method. So now we need to drive out the behavior of the recipients method on our new parser class. So at this point, we basically are moving, we're in the middle of extract class as a refactoring, but we're actually going to now descend one level of abstraction, or I guess, yeah, sort of. We're going to push one level down the stack into the refactoring of move method. We basically want to move the contents of this recipients method into the parser class. So I actually kind of have a test for this already. So here's the tricky thing. There is a difference between move method when you move a public method and when you move a private method. You okay? Cool. So because we're moving a private method, we actually only have tests that sort of indirectly test that behavior. So I write direct tests for all my public methods on my classes, but for my private methods, I do not test them directly. I let them get tested implicitly as part of testing the public methods. Are you okay with that? Sandy says yes. Yes! It's nerve-racking. Sandy Mets is sitting right there. I know if I mess up, she's going to come yell at me. She's an aggressive person. You don't know that about her. Like, physically, like, she'll hurt you. You test a private method directly. Sandy Mets will seriously, like, have had it happen. Okay, just kidding. She's super nice. She's the nicest, ridiculously nice. Okay. So we are going to, so here's what I'm going to do. I'm going to do every programmer's favorite thing and we're going to copy and paste. It's going to be great. So I'm going to use the tests for the deliver method in invitations, this one right here, which is only public method, to drive out the behavior of this private method that we're pulling out into our new parser class. So let's go look at the tests. This, by the way, are the tests for invitations. This should be, oops. It's actually deliver. That's embarrassing. Cool. So it sends emails to all the invi-ties. We first stuff out the mailer. We'll come back to that. I make a CSV. By the way, this little dot strip here doc thing, I stole this from active support. It's super handy. Have you ever had a here doc and you have to jam it all the way over to the left and it looks totally goofy? You're familiar with this idea? If you're not, look up here docs and then once you look up here docs, look up strip here doc and you'll have an awesome pair of wonderful power. Okay. So we grab a CSV. We throw that CSV into the invitations class with a string and then we expect the mailer to have received two method calls for invitation for each user in our CSV. So again, now that we're extracting a parser, this has kind of become a component test. It's become a test that tests multiple classes at once and so I'm going to copy over this test and I'm going to fiddle with it so that we have something that works, that tests our recipients method directly. So let's grab this. I use visual mode which is a total smell. You shouldn't do it but I did it because my screen's too small. Let's print this. Yeah, there we go. Juniel's here too. Juniel, Vim, master, extraordinaire. There's a little intimidating audience to write code in front of, using Vim and doing oh oh in front of Juniel and sanding mats, you know. All right. So let's change this around. We're not going to stop the mailer. That doesn't happen anymore. We still have this CSV string. I still want to do that. But now we're not going to check if messages get sent. We're in fact going to check the result. So we're going to say, hey, parser, here's your CSV. And I want you to call the recipients method and then store the result off. And then I'm going to expect this result to equal an array of hashes. So let's say that's going to look like name. And that goes to user one and your email. I have to use string keys here. You'll see why in a moment one at example. Okay. So that's our first hash. There should be two. This should be to user two. That should be to user two. Let's lose that. And if all has gone well, which probably hasn't, we should get an error and not a syntax error. Just kidding. We need to close the equals and whatnot. Good. Believe it or not, that's what we want. Okay. Wrong number argument. So just a recap. So I'm calling, I have a CSV, a string that represents a CSV and CSV pretty simply has an email and name in it. This email and name and that email and name. We ask the parser to parse it given that string. And we expect the result to be an array of hashes with name to name and email to email. And we have a failure. So just a quick recap. We had an integration type test. We pulled it in here. We modified it. So we're testing this method more directly now. Let's now fix this argument error. We have wrong number arguments, one for zero. Anybody know how to fix that? Yeah. Confidence. Someone's like, yep, I got it. How do we fix it? What do we do? He's like, oh, I have to actually answer the question. What's that? We need initializer. Absolutely. So this class needs to take a, oops, I have a snipper for this. It's my favorite thing. CSV. What? Hold on to him. It goes together. There we go. I will come back there. I will turn this talk around. Okay. We're going to rerun our test.  All I did was have, I had an error which said, hey, I'm calling initialize with one thing and you don't accept that. And so all I did was say, okay, initialize takes that one thing. And then I just throw that result on the floor and move on with my life. Because all I want to do is get that message to change. That's it. I want that message I got from my test to be a new message, to give me something to tell me the next thing to do. So I'm intentionally moving in very small pieces, very small steps. Next, unify method recipients for parser. Okay. No problem. I don't have to make that work. Actually, let's do it this way. So now I could go right this recipients method, but what I'm actually going to do is I'm going to steal the recipients method from parser or from invitations. But I'm going to comment it out. Because the test just told me there is not a method called recipients right now. And so I'm just going to make a method called recipients and then let the test tell me what it actually needs to do. And here we have our first actual test failure as opposed to test error. We expected the result to be an array of hashes that look like the array of hashes I typed up there. But we got nil because the method has no body. So we want to comment this. Are you ready to test? And it blows up. Ah. Does anybody know why that blew up? That's not a great error. Can you figure it out? It's admittedly a little bit confusing. Just shout it out. Mm-hmm. Exactly. Yeah, we are, we're calling, we have, see we have at CSV in here. And because we made that small step up here, we didn't actually assign it. But if we do that, hey, green. Excellent. So we have just extracted, we're working on extract class. As part of extract class, we did move method. We're making some good progress. Now, let's see. Let's come back to, this is parser spec, we're good. Invitations, we're good. Now, I want to come back to the invitation spec. But first, questions, comments, concerns. How are you feeling? How's your mental state right now? As my pair, I need to know how you are. Yes. We have a woo. Yes, sir. We're still not using the parser. Totally right. We should come back and use the parser. I think that should be the next thing. Other comments, concerns, thoughts. Yeah. Great question. Would I inject a double instead of using the actual class or object? And we were going to do exactly that in just a moment. That's a great question. Perfect question. Awesome. So let's actually use our parser. Crazy idea. Let's use the code we wrote. So let's get rid of this. And let's run the invitation spec, which is over here. And it blows up. And we know why. Or I know why. It's because of that. Great. And now we're green again. We're using a parser. We've extracted it. Hopefully your mental state is now great because we are now actually delegating to the parser correctly. Here's your test. Here's the parser. Things are going well. This is good. So let's go. There's a quick change we can make to invitations, which is this. We don't need to store off CSV anymore, right? Because we pass it right into the parser. And that's actually a little bit weird. Let's go look at our test now for invitations. We'll lose the parser for a moment. Come back to here. Invitation spec. You know what I just had the impulse to do that was like really strong? Anybody know? Commit. You know? It's like if things go all bad. Okay. So no matter how much trouble we get into, we know we can get back to there. Tests are green. We're feeling pretty good. So let's make sure. Yep. Green everything's green. Okay. So if we're getting a lot of trouble, we know we can rescue. I do that when I'm working by the way. Like whip commits, work in progress, WIP are underrated. They can save you. Okay. So let's look at our test right now and see how they make us feel emotionally. I think the tests are a little smelly. So right now, this is still basically an integration test. Or I think component test is maybe the better word, component test, meaning like testing multiple components simultaneously. I'm pretty sure that's the right terminology. I might refer to them as integration test again. But we are testing the parser through the invitations now. And we already have unit tests for the parser. So what I'd actually like to do now is isolate the invitations from the parser. Because right now they're very much they're joined together as we test them. And I like to have the invitations tested independently of its collaborators. Now we're already doing this with this stub mailer business up here. So here we're creating a double mailer and we're allowing it to receive invitation and return this double. So we've already isolated invitation from mailer and that lets us do expectations like this or assertions like you must have received this message. And I want to have a similar situation for parser. So let's start out by extracting a stub parser method from our tests. And some people I think don't actually realize that you can extract methods from our specs. I do it all the time. This is my default first refactoring that I go to to clean up duplication and whatnot. So let's call a stub parser method and into it we will yank this. Oops. Let's grab these five lines and throw them here. And what do we need to do? We need to we want to isolate invitations from the parser so we need to create a parser double. So here's our CSV. We have a parser. This is going to be a fake parser that we're going to will stand in for our real parser. We are going to say, Hey, parser, when someone asks you for your recipients, we're actually just going to give a canned response of recipients. So actually we're going to change this. We're going to steal from the parser spec. Oops. Let's steal our beautiful array of hashes. Don't worry about that styling. It's cool. Recipients equals an array of hashes. That's some nice indentation. Good job. Good job, Vim. That's the automatic indentation that Vim has chosen. Close enough.  It's cool. We make a mess first and then we clean it up. That's my style. Okay. So we went to submit parser. Now I need to actually say, Hey, when the invitations class uses this parser, use this fake one. So I have a little snippet for this. We're going to allow parser to receive new. My snippets are a little bit off and return the parser. So when I, let's wrap this. When someone calls parser.new with CSV return parser. And we need a CSV, which is a little bit weird, but we're going to talk about that in a second. And then, okay, so now if I want to use this, let's see what happens. Here is a smell that we have just bumped into. Undefined method, undefined local variable or method CSV. Where is that coming from? Well, it is coming from right here. So my invitation needs a CSV, which is kind of actually kind of goofy and was pointed out by someone very astute in the fourth row over here. But for now, we need to give it a CSV. So let's, let's actually for now just return a CSV from here. Okay. And then let's be fancy. You guys like being fancy? Do CSV. And that'll be here. And that's your bringer. This little, if you want to tap, this is just going to return the CSV at the end. It lets us refer to it in here and then returns the CSV at the end. So, cool. Back to green. So we extracted our stub parser method, but this is extracted. This method has, I think, revealed us interesting smell, which is that we need this CSV and the CSV is basically unused inside invitations. Right. That is going to become important. So let's, but let's talk about what we just did. We isolated invitations and parser. Now, why is this good? Who has reasons for why it might be good to stub out a collaborator like we just did there? Yeah. It lets you unit test them separately. Yep. Other, other benefits. Why might you stub out collaborators like this? Why am I going through all this work? Yeah. You can swap out CSV. Yep. We can swap out messages. So for instance, I have, it's, it makes it really easy to specify exactly what I want the parser to say. So before I had to give it a literal CSV string and let the parser parse it out. And now I can just say, here's a fake parser to stand in for the real one. And when you ask it what its recipients are, here's a prerecorded answer. Now that's nice. That's nice now. And it's nice at other times, particularly because it lets you make something that's not deterministic, deterministic, right? For recipients, recipients is always going to return the same thing when you, if you give the same string. But let's imagine this was something that used time or hit an external service. These are all really good reasons that you would want to stub those things. So you can always have the same response come back. This is kind of the idea of handling like something like VCR or fake web or mock web or something like that. Yeah, right? Web mock, web mock. There it is. Yeah, awesome. Okay, so this is nice now. We've extracted a class. We've moved a method. We've isolated this. I think we're steadily marching towards like better code. I think things are good. But there's sort of one nice thing that we can do now. And this is in fact just kind of almost the point of the talk is to get to this point. Which is I would like to invert control. And this is what was roughly suggested earlier in the talk, which is it's actually kind of weird that we pass in CSV at all to invitations. Now we're passing in CSV. Let's go check out invitations. So here are all the instances of CSV. This should move to the parser. But here, just two. We use it to build the parser. We pass here like here's the CSV. And it's like, thanks. Making it a parser. Cool. Wouldn't be great if we just got a parser. It would be great if we just got a parser. There'd be some definite benefits for that. And the process of instead of, so right now, here's what our control looks like. So I'm going to go, let's move up a level to the invitations controller. So we create an invitations controller. This is a fake controller, by the way. I'm totally like pretending this is Rails. It's totally not Rails. I got you guys good. You should see what's an application controller. Jokes galore. This is all online. You can check it out later. But this is fake Rails. This is not real Rails. So here's how control is structured now. We have invitations controller, which creates invitations, which creates a parser, which uses CSV to parse things. So everything kind of points down. This is normal control, like top down control. It's kind of a standard way of thinking about programming. Inverting control flips that around and says, what if you instead built your dependencies at the top level and then pass them down to lower levels? So that you actually don't see the word new very often in your lower levels. It's an interesting way of building. And this is part of solid. You've heard of solid? The solid principles? This is the I. I is inversion of control. This is something that confused me when I first heard of it. Inversion control sounds weird, sounds funky, not super hard. One way to accomplish an inversion of control is with dependency injection. So this just says, rather than giving invitations the CSV and then having invitations build a parser, what if we just build a parser and give the parser to invitations? That is using dependency injection to accomplish inversion of control. And that's going to be our final refactoring step. How's the mental state? Yeah, question? What if we just gave invitations the recipients? Yeah. I like that even better. Version two of the talk will in fact probably just pass in recipients directly. We may even get there. We'll see. Maybe we can get that. That could be our final refactoring if we're speedy and awesome. Other questions? What other thoughts, concerns? I said a lot of like large three word things there that are potentially a little scary. How are you feeling? What questions do you have? Great question. Yes. So in the specs, I extracted methods. Could I use before? I could. I don't generally reach to before until later. So my first pass of refactoring specs is always to use normal Ruby things. Use methods. Methods work great. I occasionally will reach for let's and before's, but pretty rarely. Those are kind of my last resort things. What I typically find is when I pull stuff into a before, what I typically get is I add a new test and the new test doesn't really want exactly the world that's in the before. It wants something a little bit different. So it kind of modifies the world a little bit before it runs. And then we have this weird thing where I need to go read the test, see the changes of the world, go read the before, figure out what the world is. Okay, see changes here. And I find bouncing around a lot in my tests and it sort of creates this complexity. So I will occasionally put stuff into before, but it's sort of my every once in a while refactoring and not a routine refactoring for me. And I find it tends to make my tests a little bit cleaner. Okay, so let's invert control real quick. And this is actually going to be pretty straight, pretty quick. So last page. Let's do this in our tests for invitations. Instead of passing a CSV, let's pass a parser. So let's say we're going to get back a parser instead of a CSV. Actually, and then here, instead of this we get a parser. And then we can actually lose this whole CSV thing, which is beautiful. And we can lose a little of indentation. We can stop stubbing parser. And in fact, just return this parser right here. Let's see if we're green. We're so close to green. This is again a weird and crazy error message because of this is CSV, the built-in standard library CSV, not being super helpful. But basically what we're doing now is passing in a parser here. And then in the class, we're treating that as a CSV. So we're passing a parser to a parser, which is very interesting from a computer science standpoint. And it reminds me of a Tom Stewart talk about decidability. But for our purposes, this is not super helpful. So let's instead just say, hey, actually this is just a parser now. And if we rerun our spec, something blows up. Oh, thank you. This is why it's great to pair with 400 people simultaneously. Because all errors are shallow when you have 800 eyes looking at it simultaneously. Awesome. So now we've inverted control. And we've also broken something.  By the way, my .files are online, so if you're curious how I'm getting this cool test thing at the bottom and how I'm doing it off in the editor, it's all on my .files, go check it out. So I just ran our sort of integration-y spec that's test through the controller, which means, let's go to invitation controller, which I showed you a little earlier. Here, we're still passing in this parameter directly. But we actually need to do, this is where the actual version of control is happening. Okay, rather than passing in a CSV file, let that we read, let's make a parser right here. And the parameters of that will be the CSV file. And we'll read that. And now we can change this to parser. And we can run our tests again. And they pass. That right there was the inversion of control. That's where we switched from, hey, invitations, you build your own dependencies to, hey, invitations, I'm going to build your dependency and give it to you directly. Is this better or worse? Well, like all things in programming, there's a trade-off, right? Don't ever let anyone tell you that there are hard and fast rules in programming. Anytime someone says something is always good, they're pretty much always wrong. Crap! A back-up-up into a corner. They're maybe, they're often wrong, right? Pros and cons. Well, cons are, some people find this a little bit more confusing. You end up with dependencies in a controller. You specify a ton of dependencies in the controller, and then dependencies sort of flow down into your system. That kind of weirds people out. So that's one of the cons. It can sometimes be hard. You end up with these classes that are... This class right here takes a message in a parser. What are message in parser? Who knows, right? I'm just gonna take your word for it that parser parses stuff and messages is some sort of message that is message-like, but you can't really see what's going on here. It's actually a little bit more obvious when there are class names, but this is maybe a little bit harder to read. Context might be a little bit harder to get. However, testing becomes more simple.  So the tests can get simplified, which is a big win there. And this is also interesting. If you're into solid in general, which you should check out, solid, as a set of principles, this makes it easier to follow something called open-closed principle, because it lets you... So basically, on apps where I followed this, I will have commits adding functionality where it is purely green, and there are no changes. It's just new code. And if I want to remove functionality, it's purely red. And that's basically what open-closed principle gives to you. It's worth digging into that, playing with that a little bit, but one way of achieving that is using getting inversion of control with dependency injection. And we're towards the end, so if I have a couple closing questions, and then I'll let you head out. So before we go, I just have one... I have a jingle for you that I crafted. I wrote for you to remember the main principle of this talk, which is, if you want to follow SRP, don't manage your dependencies. Thank you.


And our business news figures from the Central Bank of Nigeria, CBN, have revealed that the external reserves have dropped to $39.82 billion in February the 2nd, 2020, from $40.53 billion as of December 30, 2021 mark to the lowest point in over three months. At the first monetary policy committee meeting this year, the governor of Central Bank of Nigeria, Godwin Imefele, noted the continued improvement in external reserves despite ongoing foreign exchange market pressures. The country's external reserves had jumped from $39.82 billion on October 15, 2021 to a high of $41.83 billion on October 29, on the back of Eurobond inflow and the International Monetary Fund's special drawing rights.