Design a site like this with WordPress.com
Get started

Laptop Upgrade and Coding Environment Issues

Upgrading my laptop to M1 Apple presents a challenge to create a Windows coding environment to use.

I am a proud owner of the new Apple M1 MacBook Pro 16” laptop. Well, it’s on order. I should get it sometime in March so, that gives me time to setup a working Windows environment and have Visual Studio installed. But I have a problem.

Why is that an issue? I got Parallels to load Windows on. Long story short, running the Intel version of Windows on M1 is not a good idea. Was I caught off guard with this issue? No, I had plans to resolve the problem by Remoting into the Dell laptop that the University provided.

I planned to RDP into the University laptop from my M1-based Apple Mini and MacBook, but I ran into a problem. That laptop is configured not to remote into it and has a group policy that prevents me from turning on RDP. Well, there goes that idea.

My next option is to use my Ubuntu Mac Mini (I have two Mini’s) and install a Windows VM. I am currently using it for my Homebridge server, and having a Windows VM wouldn’t be much of an issue. That seemed like a good idea until I checked the memory on it. It only had 8 Gb of RAM, which is the maximum allowed for that mini. Allocating six gigs of RAM for the VM for Windows 10 didn’t sound like a good idea. So ok, I need something else.

I remembered that I have my old 27″ Mac that I planned on trading in for a gift card. That will work perfectly since it has plenty of RAM and hard drive space. So I downloaded Windows 10 and got a product key from my visual studio subscription. I now had a computer that I could RDP into and do my work.

During RDP setup, I saw a link saying that opening up a port is a security risk to your internal network. It suggested that I should connect via a VPN instead. That sounded like a good idea.

I created an OpenVPN Cloud free account and got my Windows developing environment as a Host RDP Server and my other M1 Apple computers as the clients. Bingo Bango, it all works now. I can now continue to go to my favorite coffee shop, Jitterz, remote into my Windows machine and continue coding.

Well I thought all was good until I tried to VPN into work. While it connected, network traffic wasn’t going through it since traffic is going through the OpenVPN connection. I’m not sure if I can tunnel into the computer and direct university traffic through their VPN.

I’m sure there is a way to do that but it is beyond my skill set. I’m back to the open the RDP port on my router.

I’m sure there were better ways of resolving my issue, but it gave me something to do over the weekend, and now I am a happy camper. Happy Coding!

Advertisement

Fat Controllers: Going on a Diet

After watching a training video I learn something new that will make me a better developer.

In my quest to be a better developer, I watched a video in LinkedIn Learning called ASP.NET MVC: Building for Productivity and Maintainability by Jess Chadwick and was impressed with what he taught. One of the main topics I got from this is that my controllers are fat. Very fat. In fact, they need to go on a diet big time.

My controllers had everything including the kitchen sink in them. It worked but it was getting hard to follow the logic flow. Even worse, if I had to come back to do maintenance it took a while to relearn what I was doing. Jess taught me how to separate business logic from the controller using services.

Why hadn’t I been doing this stuff from the beginning? Well, simply put, I wasn’t taught to write code that way. Besides my Computer Science classes in college, I was self-taught on c# and the .NET MVC Framework. All those tutorials on video or books never covered the best practices in coding. Now, after watching this video, I know better.

I had a project that I am working on that had a couple of reports that felt was a good candidate to try out this system of services. I figured out how to wire it up and create the service provider and then the corresponding service. Then created the method in the controller to use the service.

I already had a fat method from one report so I converted that to use a service. Now the controller has two methods with about ten lines each that are easy to follow. Nice and slim and all the business logic separated in a service. I really like this system.

Another benefit in using services is Unit testing. It will be a lot easier to do a Unit test against the services rather than against a fat controller. I tried learning to do Unit testing against my fat controller and I ended up giving up. I couldn’t figure out how to do it but now, with services, I can see it will be a lot easier to do.

If I had time, I would redo all of the controllers for my project but unfortunately, I don’t. I’m not giving up. Any chance I have I’ll continue to put my fat controllers on the diet. Any new project and I will definitely be using the new method. I feel I have progressed as a developer and that is good.

Has anyone else seen the video? If so, tell me what you learned from it.

Happy coding everyone!