I'm finding more and more that I enjoy programming in C instead of other languages like C# and Java because it seems that you get to do more actual programming or deal with the more primitive parts of the language on a regular basis. Honestly, it's hard for me to pinpoint but it's just different. I'll give you a brief example:
Something I'm working on in C:
Code:
void update_scan(MEMBLOCK *mb_list, SEARCH_CONDITION condition, unsigned int val)
{
MEMBLOCK *mb = mb_list;
while(mb)
{
update_memblock(mb, condition, val);
mb = mb->next;
}
}
And something I'm dealing with in C#:
Code:
public string Protect(AuthenticationTicket data)
public class CustomJwtFormat : ISecureDataFormat<AuthenticationTicket>
{
private readonly string _issuer = string.Empty;
public CustomJwtFormat(string issuer)
{
_issuer = issuer;
}
public string Protect(AuthenticationTicket data)
{
if (data == null)
{
throw new ArgumentNullException("data");
}
string audienceId = ConfigurationManager.AppSettings["as:AudienceId"];
string symmetricKeyAsBase64 = ConfigurationManager.AppSettings["as:AudienceSecret"];
var keyByteArray = TextEncodings.Base64Url.Decode(symmetricKeyAsBase64);
var signingKey = new HmacSigningCredentials(keyByteArray);
var issued = data.Properties.IssuedUtc;
var expires = data.Properties.ExpiresUtc;
var token = new JwtSecurityToken(_issuer, audienceId, data.Identity.Claims, issued.Value.UtcDateTime, expires.Value.UtcDateTime, signingKey);
var handler = new JwtSecurityTokenHandler();
var jwt = handler.WriteToken(token);
return jwt;
}
Obviously, this isn't really a fair comparison because those two code blocks do something entirely different, but my point is that when I'm working in C#, especially in the popular web dev world right now, it seems I'm always having to fight to understand what on earth this convoluted mess like:
Code:
var token = new JwtSecurityToken(_issuer, audienceId, data.Identity.Claims, issued.Value.UtcDateTime, expires.Value.UtcDateTime, signingKey);
var handler = new JwtSecurityTokenHandler();
var jwt = handler.WriteToken(token);
return jwt;
Is doing. It just seems like so much text and noise for not very much going on. There seems to be an overflow of jargon used in the .NET world as well, which doesn't seem to do anything other than make things sound more complicated than they are. For example:
Code:
public override Task ValidateClientAuthentication(OAuthValidateClientAuthenticationContext context)
{
context.Validated();
return Task.FromResult<object>(null);
}
public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context)
{
var allowedOrigin = "*";
context.OwinContext.Response.Headers.Add("Access-Control-Allow-Origin", new[] { allowedOrigin });
var userManager = context.OwinContext.GetUserManager<BusinessAccountManager>();
BusinessAccount user = await userManager.FindAsync(context.UserName, context.Password);
All this this.that.thekitchensink.dowhateverproviderservice blahblah. And the long names like this: "OAuthValidateClientAuthenticationContext" honestly it just seems like terribly convoluted code to me.
I'm self-taught so I'm sort of an outsider on this... is this just how Object-Oriented Programming is versus procedural code or is it just that I'm probably seeing a lot more messy code in the C# world because it's full of newbies? Another thing which I really dislike about other languages versus C is in C I tend to be struggling with the language/compiler itself, which I enjoy whereas when I'm trying to do C# and back-end web development, I tend to spend most of the time struggling with and trying to figure out other people's code that my application depends on. I don't enjoy this.
Anyways, has anyone else noticed this? Is this a C vs. other language thing or is it just the people/community/tools that I've specifically been involved with in the other languages?