为什么许你说不会for循环、maven、git的人low就不许我说连Lambda都用得不熟的人没资格做程序员呢?
前些时看了有人在问答区提问,说他招了个程序员这也不会,那也不会,连他写的代码都看不懂,觉得别人无比的low这类。
首先我觉得术业有专攻,每个人都有自己的长处,就好像那仁兄帖出的代码(也很佩服他的勇气)本来也就无所谓,但居然拿 这一坨狗屎样的代码出来说别人看不懂,我只想说,不是你的代码太稀烂,别人不看也很正常吧。就好像一坨稀屎,明知调不起来还要去调那不是有问题吗?就好像是这段代码,虽然不算什么,但基本上有了注释之后地球人都能明白。
//合并Opc变量到字典 list.GroupBy(o => o.DeviceName, (deviceName, groupList) => {//合并列表数据将opc变量合并到每一个设备组成列表 Dictionary<string, object> device = null; Dictionary<string, object[]> vars = null; vars = new Dictionary<string, object[]>(); var gl = groupList.ToList().FindAll(t => { return deviceName == t.DeviceName; }); foreach (var var in groupList) { try { vars.Add(var.OpcName, new object[] { var.OpcName, var.OpcDataType, var.OpcValue }); } catch (Exception ex) { OnLog($"{ex}", LogInfoType.Error); } } device = new Dictionary<string, object> { {"Code",gl.Max(t=>t.Code) }, {"DateTime",gl.Max(t=>t.DateTime) }, {"Protocol",gl.Max(t=>t.Protocol) }, {"FrontServerId",gl.Max(t=>t.FrontServerId) }, {"DeviceName",deviceName }, {"DeviceVars",vars } }; return device; }).GroupBy(o => string.Format("{0}", o["FrontServerId"]), (frontServerId, groupList) => {//将设备列表合并到前置机形成前置机列表 Dictionary<string, object> frontServer = null, dvs = null; dvs = new Dictionary<string, object>(); foreach (var dv in groupList) { dvs.Add(string.Format("{0}", dv["DeviceName"]), dv["DeviceVars"]); } frontServer = new Dictionary<string, object> { {"Code",groupList.Max(t=>t["Code"]) }, {"DateTime",groupList.Max(t=>t["DateTime"]) }, {"Protocol",groupList.Max(t=>t["Protocol"]) }, {"FrontServerId",$"{frontServerId}" }, {"DeviceData",dvs } }; return frontServer; }).ToList().ForEach(fs => metaData = new Dictionary<string, object> { //将前置机列表取最后一条组成字典即单个前置机对象 {"FuncCode",fs["Code"]}, {"Date",fs["DateTime"]}, {"Protocol",fs["Protocol"]}, {"FrontServerId",fs["FrontServerId"] }, {"DeviceData",fs["DeviceData"] } } ); var jsonData = JsonConvert.SerializeObject(metaData); //序列化组成转出待清洗数据包 result = new Dictionary<string, object> { {"Md5",utility.GetMD5(jsonData) }, { "MetaData",jsonData} };
我帖的目的,并不是为了炫耀什么,而是表明一个态度:任何人都有自己的长处或优点。
你招人的目的是写段代码让他看不懂来羞辱吗?我想你的目的还是为了招他来做事吧。但如果是这样的话,你是不是应该放弃自己的成见。把你的代码讲解让他能明白,进而形成帮你做事的力量呢?
如果是本人,不但会把这段详细的讲解, 而且要让对方有明确的回复已经清楚。因为我的目的是为了让对方了解清楚而溶入到工作团队中。而之前看到的某人给人的感觉是:自己水平一般般,遇到一个比自己水平差的人就想方设法的去侮辱别人,而且还发到网上让更多的人知道自己多牛,这种通过踩贬别人提升自己的行为让人非常不耻!
欢迎大家畅所欲言~